Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins and Git?

My firm right now is using Subversion and we have Jenkins pulling the SCM for changes and if anything changes it will do the Maven build.

We are moving to Git, but I don't see any way to pull a Git repository for changes... Am I missing something?

like image 705
techsjs2013 Avatar asked Feb 12 '13 20:02

techsjs2013


People also ask

Does Jenkins need Git?

Since Jenkins needs to push tags to the origin repo, it will need a basic Git configuration. Let's do that now. Go to Jenkins > Manage Jenkins > Configure System > Git plugin.

Can we integrate Jenkins with Git?

Git is an essential plugin that everyone working with Jenkins will need. You can get to the point of configuring a Jenkins job only once. Then, all subsequent changes for the delivery pipeline can be done using a version control system like Git.

Is Jenkins and GitHub same?

Jenkins and GitHub Actions share some similarities in workflow configuration: Jenkins creates workflows using Declarative Pipelines, which are similar to GitHub Actions workflow files. Jenkins uses stages to run a collection of steps, while GitHub Actions uses jobs to group one or more steps or individual commands.


2 Answers

You can configure the Jenkins Git plugin to poll your repo for changes, but the recommended method is to add a post-receive (aka post-commit) hook to your repo. This way Jenkins is notified instantly on every commit.

You can read more here: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

like image 171
CIGuy Avatar answered Sep 29 '22 12:09

CIGuy


You may not have the Git plugin installed, which is why you can't see the options. You would never have had to do this for subversion as the plugin for that ships by default. You can either use the automatic installer supplied in Jenkins to install the plugin, or you can do it manually (useful if you are behind corporate firewall).

Some useful links: The Git plugin: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

The GitHub plugin: https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Plugin

The Bitbucket plugin: https://wiki.jenkins-ci.org/display/JENKINS/Bitbucket+OAuth+Plugin

The Google Code plugin: https://wiki.jenkins-ci.org/display/JENKINS/Repo+Plugin

The Git parameter plugin: https://wiki.jenkins-ci.org/display/JENKINS/Git+Parameter+Plugin

The GitLab hook plugin: https://wiki.jenkins-ci.org/display/JENKINS/Gitlab+Hook+Plugin

A big list of all plugins: https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-Sourcecodemanagement

CloudBees provides Jenkins continuous integration and Git hosting as a service - which might also help you http://www.cloudbees.com/#slide-2 .

Good luck with your migration. We have found a few gotchas in the Maven release plugin when performing a similar migration - if I had to do it again I would make some pro-type releases beforehand.

like image 35
Darren White Avatar answered Sep 29 '22 14:09

Darren White