Question about Jenkins integration and Git branches

724 views
Skip to first unread message

Jonte Norman

unread,
Dec 6, 2013, 9:15:42 AM12/6/13
to scmma...@googlegroups.com
Hi,
 
I have a problem when I'm running push to a multi-branch Git repo in SCM Manager with a trigger setup against our Jenkins server.
Our Jenkins server is password protected so I have configured SCM Manager with a user account with only read and build access to the Jenkins server, and also with the url, token, job name and API token in the repo configuration.
The problem is that whatever branch I am pushing to, Jenkins just start building, which is not what I want :) I want it to build only when I'm pushing to the specific branch I entered under the "branches to build" config entry in Jenkins.
I really hope that I have overlooked some of Jenkins 500 or so configuration options :) and that it is possible to trigger a build of a specific Git branch in Jenkins from SCM Manager?

I'm running a setup with the following versions:
SCM Manager 1.34 standalone with scm-jenkins-plugin version 1.7
Jenkins Server 1.542 with Jenkins Git plugin version 2.0 and Jenkins Git Client plugin version 1.4.6

Any help would be truly appreciated!

Best regards,

//Jon

Edgar Durão

unread,
Dec 6, 2013, 9:50:39 AM12/6/13
to scmmanager
Hi,

my 2cents: Independently of which branch you do the commit, the scm plugin always notifies Jenkins about it.

It has that behavior in our setup used too.

Guess the only way to accomplish what you need will be to have a hook that if the commit was not for that branch, simply doesn't notify the Jenkins instance.

If you could try to adapt the plugin to that, or ask Sebastian if he could personalize it.


Regards,

Edgar Durão



Com os melhores cumprimentos,

Edgar Durão

Email: ed...@durao.net // edgar...@gmail.com
G+: http://google.com/+edgardurao


--
You received this message because you are subscribed to the Google Groups "scmmanager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scmmanager+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jonte Norman

unread,
Dec 6, 2013, 4:36:48 PM12/6/13
to scmma...@googlegroups.com

Thank you for sharing that info Edgar. Good to know I'm not the only one getting the problem :)

Thought that it should be possible to restrict what would trigger a build in Jenkins by specifying only one branch in the "branches to build" option in Jenkins but unfortunately that did not work either...

May I ask how you solved it? Or did you just go with Jenkins server pollling SCM Manager for changes like every minute?

Having Git repos with multiple central branches and only wanting to run build on a specific one when triggering Jenkins seems like a lot of people should be having trouble with?

Best regards,

//Jon

You received this message because you are subscribed to a topic in the Google Groups "scmmanager" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scmmanager/kMdQFadMFk8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scmmanager+...@googlegroups.com.

Sebastian Sdorra

unread,
Dec 9, 2013, 9:40:25 AM12/9/13
to scmma...@googlegroups.com
Hi,
I'm not sure if this will fix your problem but you could use the global configuration of the jenkins plugin. The global configuration uses the push notification mechanism of jenkins. The global configuration forces jenkins to check the repository for changes and does not force jenkins to build the job. Please have a look at https://bitbucket.org/sdorra/scm-manager/wiki/jenkins-plugin

Sebastian


2013/12/6 Jonte Norman <jon...@gmail.com>

Jonte Norman

unread,
Dec 9, 2013, 11:09:51 AM12/9/13
to scmma...@googlegroups.com
Hi Sebastian,

Thank you for your answer.

I already tried using the global config by specifying my Jenkins server basename there: http//servername.domain.com:8080/ but that did not work. I also tried combining the global configuration with a username and the API token for that user in the Jenkins repo config but still no luck. Never got any signs in the log that SCM Manager tried to do notifyCommit, only the following entries:

11:43:49.643 [Hook-28] WARN  sonia.scm.jenkins.JenkinsHook - jenkins configuration for repository testing.git is not valid
11:43:49.651 [Hook-28] INFO  sonia.scm.jenkins.JenkinsGlobalHookHandler - request returned 200

I solved the problem by allowing the anonymous user general read permissions on the Jenkins server (which actually does not seem to give the user rights to see and do anything in Jenkins) and then I used the SCM Manager Web Hook pluging with the following notifyCommit url: http://servername.domain.com:8080/git/notifyCommit?url=https://scmserver.domain.com/git/${repository.name}&origin/develop and  a yearly poll configuration setup in Jenkins.

Best regards,

//Jon

Sebastian Sdorra

unread,
Dec 10, 2013, 7:43:15 AM12/10/13
to scmma...@googlegroups.com
Hi,
The log from scm-manager for the global configuration looks correct. Did you have enabled polling as you tested with the global configuration?

Sebastian


2013/12/9 Jonte Norman <jon...@gmail.com>

Jonte Norman

unread,
Dec 10, 2013, 10:59:09 AM12/10/13
to scmma...@googlegroups.com
Yes polling is enabled with a @yearly polling period in Jenkins, but that does not seem to work. Is it correct to configure only the baseurl of the Jenkins server, ie: http://servername.domain.com:8080/ in the general SCM config and nothing in the Jenkins repo config? Should SCM Manager then automatically add "/git/notifyCommit?url=https://scmserver.domain.com/git/${repository.name}" after the baseurl?

Best regards,

//Jon

Sebastian Sdorra

unread,
Dec 13, 2013, 2:16:15 AM12/13/13
to scmma...@googlegroups.com
Yes, the jenkins plugin adds the url with the parameter automatically to the base url. You can see the whole url in the log if you enable trace logging (https://bitbucket.org/sdorra/scm-manager/wiki/faq).

Sebastian


2013/12/10 Jonte Norman <jon...@gmail.com>

Jonte Norman

unread,
Dec 13, 2013, 8:19:26 AM12/13/13
to scmma...@googlegroups.com
Hi Sebastian,

Thank you for all your help!

Really sorry! It was a mistake I made which caused the problem with the global Jenkins configuration :(

I had configured the wrong base url to my scm server. I think I got a bit confused with what to enter there because I'm running SCM Manager behind an Apache proxy config so I had specified base url like this: http://servername.domain.com:8080/ and our Jenkins server was not allowed to communicate with the scm server on port 8080. As soon as I changed it to: https://servername.domain.com everything started working as it should.

Is it okay to remove the Jenkins plugin now or is it still needed for the global Jenkins configuration entries in SCM Manager?

Best regards,

//Jon

Sebastian Sdorra

unread,
Dec 13, 2013, 8:25:14 AM12/13/13
to scmma...@googlegroups.com
You need the jenkins plugin for the global configuration, because the global configuration is installed by the jenkins plugin. You can disable the "per repository" configuration by setting the "Config->General->Jenkins Configuration->Do not allow repository configuration" property.

Sebastian


2013/12/13 Jonte Norman <jon...@gmail.com>
Reply all
Reply to author
Forward
0 new messages