3

I have a git repository that is a few years old with 100s of branch. I only really want to get Jenkins to start running builds on newly pushed branches and not the previous ones.

Currently I'm trying to trigger it via a URL within the post-receive hook:

http://jenkins/git/notifyCommit?url=git@git:myrepository.git&branches=${BRANCH}

It does activate the build, but does so with every branch from what I can see, and not the branch that is specified in the URL.

Is there a way to specify a branch to build. Maybe work out where the "completed" branch list is in the database/configuration and update it so that it won't try to build those branches (since it thinks it has done them)?

gak
  • 29,596
  • 24
  • 111
  • 150

1 Answers1

4

Setting up build with the "This build is parameterized" option enabled with a "branch" string variable works with this:

curl -s "http://jenkins/job/job_name/buildWithParameters?branch=${BRANCH}"

See http://julianhigman.com/blog/2012/02/22/building-github-branches-with-jenkins/ for setting up your job configuration.

gak
  • 29,596
  • 24
  • 111
  • 150