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:
- from http://gitblit.com/ Download Gitblit For most people, you will want to Gitblit GO.
- Follow the installation instructions on the website
- 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.
- from http://jenkins-ci.org/ Download and install Jenkins
- Follow https://wiki.jenkins-ci.org/display/JENKINS/Installing + The description in Jenkins set Jenkins
- If you installed it as a daemon, start it ( /etc/init.d/jenkins start)
- go to Jenkins's URL. go to manage Jenkins-> Configure global Settings-> Enable security
- Enable "Allow user registration"
- 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.
- 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.
- go to /data/groovy The Gitblit directory in the server, edit the Jenkins.groovy file. at thejenkinsUrlinput of your Jenkins URL.
- Restart Gitblit.
- sign in to the Jenkins Web UI. go to "Manage plugins". Click "Available" and enter it in theGit Plugin search box. install it.
- Restart Jenkins.
- 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.
- 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.
- Finally, add your build. ' New Item '-> ' freestyle '
- 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.
- 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.
- 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