Thanks Kevin. I had assumed one could access the hudson.model build related objects in a Groovy system script to modify the SCM information. I have not looked into that yet... Anyone know if that is possible? Or, is that just a really bad idea?
From: jenkinsci-users@googlegroups.com [mailto:jenkinsci-users@googlegroups.com] On Behalf Of Kevin Fleming (BLOOMBERG/ 731 LEXIN) Sent: Thursday, June 27, 2013 1:19 PM To: jenkinsci-users@googlegroups.com Subject: RE: Modifying Git branch dynamically You are; for Jenkins to do what it does (in this case, report on the code changes involved in a build), it must know what code is being checked out and built. It accomplishes that by having its SCM provider(s) do the checkout *before* the job starts running user-provided steps. If the user-provided steps change the code that is used to do the build, there is no practical way for Jenkins to be made aware of that. ----- Original Message ----- From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> At: Jun 27 2013 13:06:34 It seems unusual to require two (nearly) identical Jenkins jobs to support this (only difference is the branch that you are building on). We have a lot of Jenkins jobs and if we can't come up with a solution, we double the number of jobs in the system. That is a lot of "job clutter" for no real good reason. I have to believe that Jenkins has to have some way around this. Other build systems support this type of functionality and Jenkins is pretty flexible. Maybe I am just in denial... From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com] On Behalf Of nicolas de loof Sent: Thursday, June 27, 2013 12:54 PM To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: Re: Modifying Git branch dynamically ok, I guess you have two use cases here that require distinct jobs. One of them may be an empty one, set for git hook to monitor develop branch, and just trigger the second one using parameterized build trigger 2013/6/27 Bob Bick <bb...@netjets.com<mailto:bb...@netjets.com>> Yes, we are using the standard git post-commit trigger. Sorry that was not clear. From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>] On Behalf Of nicolas de loof Sent: Thursday, June 27, 2013 12:30 PM To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: Re: Modifying Git branch dynamically any reason you don't use a standard git post-commit trigger http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository> ? 2013/6/27 Bob Bick <bb...@netjets.com<mailto:bb...@netjets.com>> Sorry Nicolas... Here is the long (actually not too long) story... The Jenkins job supports both Continuous Integration (CI) and On-Demand builds. CI builds are initiated when developers push a commit to our Stash server, in which case it makes an HTTP call to the Jenkins server with the Stash URL. For jobs that match the URL, Jenkins checks the branch specifier to determine whether a code change was made for that branch; and if so, then executes the job. If the branch specifier is "$OVERRIDE_BRANCH", then the CI build is not executed (even though it should be executed. So, long story short, in order to get CI builds to work, I had to set the branch specifier to or CI branch ("develop"). From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> [mailto:jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>] On Behalf Of nicolas de loof Sent: Thursday, June 27, 2013 11:58 AM To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> Subject: Re: Modifying Git branch dynamically sole option I can see is to set branch specifier to $OVERRIDE_BRANCH with default value to "develop" So can't give advise without the long story ;) 2013/6/27 Bob Bick <bb...@netjets.com<mailto:bb...@netjets.com>> Hi, Background Our Jenkins build job uses Git with a default branch specifier set to 'develop'. A build input parameter "OVERRIDE_BRANCH" allows the user to specify an alternative Git branch. A Groovy script build step looks to see if $OVERRIDE_BRANCH has been specified, and if so, it checks out that branch for the build. Problem When I run a build, it runs successfully. However, when I navigate to the Jenkins build output page, it lists the Git code Changes for the develop branch. This makes sense, because Jenkins has no way of knowing that our Groovy script changed the branch. Question Is there a way in Jenkins to tell it that the Git branch (and hence corresponding Git revision) has changed? NOTE I know one "solution" would be to change the Git default branch specifier to the $OVERRIDE_BRANCH parameter; however, that is not desirable for some other reasons. Long story... Thanks for reading this and any help. Bob *** *** *** This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users%2bunsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. *** *** *** This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users%2bunsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. *** *** *** This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users%2bunsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. *** *** *** This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/groups/opt_out. *** *** *** This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail and delete the message. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.