Jenkins and Gitblit integration for automatic build after commit

Source: Internet
Author: User
Tags jenkins ci



Gitblit is a pure Java git-based solution. It belongs to one of the counterfeit software such as Apache Allura, which combines ticketing systems with Web UIs. I went through a setup process and I think I can help new users avoid pain points.


Usage Scenarios
    • You want to self-host git repos
    • You want to set up a Jenkins server to perform git repo push and run build tests on those branches.
    • You have a domain name and you can set a record for it.
Gitblit
    • Easy to install
    • Well-integrated with Jenkins,
    • Lightweight-compared to Allura or Gitlab
    • Lack of user self-registration capabilities
Jenkins CI
    • Easy to install
    • Powerful plug-in community
    • This is the Circle Ci,travis CI used for their underlying stack.
Footsteps:
  1. from http://gitblit.com/ Download Gitblit For most people, you will want to Gitblit GO.
  2. Follow the installation instructions on the website
  3. gitblit.propertiesin the /datathe configuration file in the directory . be sure to fill out web.canonicalUrl-you need to set up Jenkins integration to work properly.
  4. from http://jenkins-ci.org/ Download and install Jenkins
  5. Follow https://wiki.jenkins-ci.org/display/JENKINS/Installing + The description in Jenkins set Jenkins
  6. If you installed it as a daemon, start it ( /etc/init.d/jenkins start)
  7. go to Jenkins's URL. go to manage Jenkins-> Configure global Settings-> Enable security
  8. Enable "Allow user registration"
  9. Register and then turn off allow user registration.


at this point you have set up Gitblit and Jenkins. But they haven't interacted yet. When we push the commit to gitblit, we want to do it, Jenkins builds it.


  1. go to Settings in an existing repo in the Gitblit site. go to the receive section of the repo setting and add it jenkinsto the selected column of the Post-receive scripts sub-section.
  2. go to /data/groovy The Gitblit directory in the server, edit the Jenkins.groovy file. at thejenkinsUrlinput of your Jenkins URL.
  3. Restart Gitblit.
  4. sign in to the Jenkins Web UI. go to "Manage plugins". Click "Available" and enter it in theGit Plugin search box. install it.
  5. Restart Jenkins.
  6. There is also a build environment support plugin in the plugin. Add those. especially for Nodejs, you have to know that the automatic installation of the Nodejs plugin does not display the Nodejs drop-down list. You must install by entering a URL that tar.gz exists. Enter a subdirectory that exists when the extract is decompressed.
  7. go to manage Jenkins-> Configure the System. Add the appropriate build environment preset. This is specific to what you want to do. so I left it.
  8. Finally, add your build. ' New Item '-> ' freestyle '
  9. Select Git from the Source control section. put URLs and other settings. I usually make two build projects for each GIT project. one for <projectName>-release, the other for <projectName>-all. I set it so that the branch settings for Jenkins are blank for <projectName>-all items. in this way, all features and development branches are built and tested.
  10. Next, select "Poll SCM" and leave it blank. Gitblit's Jenkins Groovy plugin will call Jenkins's hooks to build this way as needed. The method of validation is an attempt, curl <jenkinsUrl>/git/notifyCommit?url=<gitblitUrl>/r/<repoName>or you can put it in a browser.
  11. If you want to link to those cool "build status" images, please embeddable-build-status install plug-ins for Jenkins. after that, link it to your website or to a reduced price document.


Congratulations, you have now set up Gitblit and Jenkins CI to make git commit push and build them!






From: https://voat.co/v/programming/comments/372494



Jenkins and Gitblit integration for automatic build after commit


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.