Hello,

Is there a sanctioned way to configure Jenkins to monitor a subset of git 
branches to build automatically, while also supporting builds of particular 
SHAs?

We've managed this hackishly for several years on a few dozen repos, using 
a configured list of branches to watch, an optional BUILD_SHA string 
parameter, and this shell script:

if (( ${#BUILD_SHA} > 0 )); then
  git checkout $BUILD_SHA
fi

The downside of checking out a revision behind Jenkins' back is that the 
build logs will report the wrong SHA. This is now untenable, because we 
want to be able to rely on the Jenkins API to tell us which SHA was used 
for a particular build.

The only way I've found to reliably compel a build of a particular SHA, 
reported correctly by the build page, is to specify the SHA as the solitary 
branch specifier under "Branches to Build", in the Git Plugin 
configuration. 

If we go this route, we're toggling between an empty branch specifier 
(which builds every changed branch), and an occasionally-specified SHA. 
This sacrifices the ability to automatically build only a subset of 
branches and branch prefixes, which will lead to an increase in 
false-positive failed builds, and gripes from users.

In short, we're trying to do three things:

1. Build automatically from a defined set of branches and branch prefixes
2. Build a particular SHA when requested (via the build page, or a chatbot, 
or some other automation)
3. Ensure that the Jenkins API's reporting of the SHA1 revision is truthful

Our ugly "git checkout" script gives us 1 and 2, and providing the SHA via 
an optional branch specifier that's otherwise blank gives us 2 and 3. I'd 
appreciate suggestions on how we might achieve all three.

We're using Jenkins 1.625.1 on Ubuntu 14.04.x, with a bunch of OS X build 
nodes. I had hopes for the Git Parameter Plugin, but we need to be able to 
specify an arbitrary SHA, as opposed to picking from a list, and I couldn't 
even get it to show me the list.

Thanks,

  -nat

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b534ce8f-b229-49bb-a576-510a9b51812a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to