gitblit與jenkins集成推送構(gòu)建通知

<p>##gitblit與jenkins推送集成</p><p>來(lái)源:https://voat.co/v/programming/comments/372494

How to setup Gitblit and integrate it with Jenkins CI to build your projects as you push them to repo (programming)

Gitblit is a pure Java based git solution. It falls under one of the forge softwares like Apache Allura that combines ticketing system with web ui for git. I went through a process of setting it up and I thought I can help new users avoid the pain points.

Usage scenario

You want to self-host git repos
You want to setup a Jenkins server to take git repo pushes and run build tests on those branches.
You have a domain name and you can set the A Record for it.

Gitblit

Easy setup
Integrates well with Jenkins
Lightweight - compared to Allura or Gitlab
Lacks self registration functionality for users

Jenkins CI

Easy setup
Robust plugin community
It's what Circle CI, Travis CI uses for their base stack.

Steps:

Download Gitblit from http://gitblit.com/

For most people you'll want the Gitblit GO.
Follow the installation instructions on the site
Configure the gitblit.properties file in /data directory. Be sure to fill in web.canonicalUrl - it needs to be set for Jenkins integration to work properly.

Download and install Jenkins from http://jenkins-ci.org/

Setup Jenkins as described in https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins
If you installed it as a daemon, launch it ( /etc/init.d/jenkins start )
Go to the url for jenkins. go to Manage Jenkins -> Configure Global Settings -> Enable Security
Turn on 'Allow Users to Signup'
Register and then turn 'Allow Users to Signup' off.</p><p>##推送配置</p><p>At this point you have both Gitblit and Jenkins set up. But they aren't interacting yet. We want to make it so when we push the commits to gitblit, Jenkins builds it. ###Go to the settings in a repo already in your gitblit site.</p><p>### Go to the 'receive' section of the repo setting and add jenkins to the 'selected' column in the 'post-receive scripts' sub-section. </p><p>##Go to the /data/groovy directory of Gitblit in your server, edit the jenkins.groovy file.Under jenkinsUrl input your jenkins url.
</p><p>##Restart gitblit.
Login to Jenkins web ui. Go to 'Manage Plugins.' Click on 'Available' and type in Git Plugin into the search box. Install that.</p><p>

Restart Jenkins.

Also in the plugins are the build environment support plugins. Add those. Specifically for NodeJS, you juse have to be aware that NodeJS plugin's Auto Installation does not show NodeJS dropdown. You have to install by inputting the url of where tar.gz exists. Input the subdirectory that would exist if you unpack it.

Go to Manage Jenkins -> Configure System.

Add the proper build environment pre-sets. This is specific to what you want to do. So I leave this out.

Finally, add your build. 'New Item' -> 'Freestyle'

Select git from 'Source Code Management' section. Put the url and other settings. I usually have two build projects made for each git project. One for -Release, and one for -All. I set it up so the branch setting in Jenkins is blank for -All project. That way all feature and dev branches are built and tested.
Next, select 'Poll SCM' and leave it blank. Gitblit's Jenkins groovy plugin will call the Jenkins' hook for building on-demand this way. A way to verify is to try curl /git/notifyCommit?url=/r/ or you can also just put that in the browser as well.
If you want links to those cool 'build status' image as well, install embeddable-build-status plugin for Jenkins. After that, link it in your website or markdown docs.

Congratulations, you now have Gitblit and Jenkins CI set up to take the git commit pushes and build them!</p>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末崎岂,一起剝皮案震驚了整個(gè)濱河市匆帚,隨后出現(xiàn)的幾起案子谣拣,更是在濱河造成了極大的恐慌郁竟,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,941評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異傲隶,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)炭序,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,397評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)苍日,“玉大人惭聂,你說(shuō)我怎么就攤上這事∠嗍眩” “怎么了辜纲?”我有些...
    開封第一講書人閱讀 165,345評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)拦耐。 經(jīng)常有香客問(wèn)我耕腾,道長(zhǎng),這世上最難降的妖魔是什么杀糯? 我笑而不...
    開封第一講書人閱讀 58,851評(píng)論 1 295
  • 正文 為了忘掉前任扫俺,我火速辦了婚禮,結(jié)果婚禮上火脉,老公的妹妹穿的比我還像新娘牵舵。我一直安慰自己,他們只是感情好倦挂,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,868評(píng)論 6 392
  • 文/花漫 我一把揭開白布畸颅。 她就那樣靜靜地躺著,像睡著了一般方援。 火紅的嫁衣襯著肌膚如雪没炒。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,688評(píng)論 1 305
  • 那天犯戏,我揣著相機(jī)與錄音送火,去河邊找鬼。 笑死先匪,一個(gè)胖子當(dāng)著我的面吹牛种吸,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播呀非,決...
    沈念sama閱讀 40,414評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼坚俗,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了岸裙?” 一聲冷哼從身側(cè)響起猖败,我...
    開封第一講書人閱讀 39,319評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎降允,沒想到半個(gè)月后恩闻,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,775評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡剧董,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,945評(píng)論 3 336
  • 正文 我和宋清朗相戀三年幢尚,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了破停。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,096評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡侠草,死狀恐怖辱挥,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情边涕,我是刑警寧澤,帶...
    沈念sama閱讀 35,789評(píng)論 5 346
  • 正文 年R本政府宣布褂微,位于F島的核電站功蜓,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏宠蚂。R本人自食惡果不足惜式撼,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,437評(píng)論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望求厕。 院中可真熱鬧著隆,春花似錦、人聲如沸呀癣。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,993評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)项栏。三九已至浦辨,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間沼沈,已是汗流浹背流酬。 一陣腳步聲響...
    開封第一講書人閱讀 33,107評(píng)論 1 271
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留列另,地道東北人芽腾。 一個(gè)月前我還...
    沈念sama閱讀 48,308評(píng)論 3 372
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像页衙,于是被迫代替她去往敵國(guó)和親摊滔。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,037評(píng)論 2 355