文档章节

gitblit与jenkins集成推送构建通知

shzwork
 shzwork
发布于 05/19 12:06
字数 731
阅读 0
收藏 0

<p>##gitblit与jenkins推送集成</p><p>来源: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>



作者:xzs63
链接:https://www.jianshu.com/p/3a329801a078
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

本文转载自:https://www.jianshu.com/p/3a329801a078

shzwork
粉丝 10
博文 489
码字总数 6494
作品 0
厦门
私信 提问
DevOps第六弹之工具大整合

系列文章 DevOps第零弹之开篇 DevOps第一弹之项目与事务跟踪工具 DevOps第二弹之部署私有Git服务器 DevOps第三弹之效率沟通 DevOps第四弹之接口文档与API测试 DevOps第五弹之持续集成编译环境...

August1996
2017/12/30
0
0
阿里云文件存储NAS开发测试环境最佳实践

软件开发过程中,开发成员经常需要把自己工作集成到项目中,通常每个成员每天至少集成一次。如果项目较小,对外部的依赖较小,那么软件集成可能不会是什么问题。但是目前很多软件项目特别是互...

曜斯
04/19
0
0
gitlab+jenkins+maven持续集成自动化部署平台

背景:为了改变目前手工发布项目的流程烦锁,耗时,容易出错,浪费人力物力财力,低效的状况,搭建基于docker容器化的git+jenkins+maven持续集成自动化部署平台,实现从代码提交到生产部署的...

xiejunbo
2017/10/26
0
0
jenkins构建一个maven项目[五]

标签(linux): jenkins 笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流 构建一个maven项目,即为构建java项目。模拟实验之前先把实验代码推送到 gitlab,jenkins要与g...

陈天刚
2017/08/29
0
0
基于Jenkins+Docker的自动化代码发布流程

前段时间写了一篇初创团队持续集成的落地与实现,主要用python接收gitlab的push请求,然后调用不同的shell脚本来实现。本文将使用基于Jenkins+Docker来实现另一套的自动化CI/CD的代码发布流程...

opsonly
03/28
0
0

没有更多内容

加载失败,请刷新页面

加载更多

八、Docker Swarm

Docker Swarm有两件事:一个企业级的Docker主机安全集群,另一个是用于协调微服务应用程序的引擎。 在集群方面,它将一个或多个Docker节点组合在一起,并允许你将他们作为一个集群来管理。开...

倪伟伟
昨天
5
0
Fragment懒加载其实很简单

前言 记得去年面试的时候, 面了一家小公司, 那个面试官问我, fragment的懒加载做过吗?我说没做过(确实没做过).后来面试快结束了, 又问我, 懒加载没做过是吗?后来可想而知也没收到offer, (ಥ_...

天王盖地虎626
昨天
4
0
聊聊dubbo的TimeoutFilter

序 本文主要研究一下dubbo的TimeoutFilter ListenableFilter dubbo-2.7.2/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/ListenableFilter.java public abstract class Liste......

go4it
昨天
7
0
方法与数组

方法 方法就是完成特定功能的代码块;在很多语言里面都有函数的定义,函数在Java中被称为方法 格式: 修饰符 返回值类型 方法名(参数类型 参数名1,参数类型 参数名2…) throw 异常{ 函数体;...

凹凸凸
昨天
6
0
死磕 java同步系列之StampedLock源码解析

问题 (1)StampedLock是什么? (2)StampedLock具有什么特性? (3)StampedLock是否支持可重入? (4)StampedLock与ReentrantReadWriteLock的对比? 简介 StampedLock是java8中新增的类,...

彤哥读源码
昨天
19
1

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部