Phil, have you looked at the Job DSL plugin? It sounds to me like that
might be useful for you here.
https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin, and
https://github.com/jenkinsci/job-dsl-plugin/wiki
On Friday, June 12, 2015 at 1:05:48 AM UTC-4, Phil C wrote:
Hi,
I'd like to
A plugin or groovy script could quite easily change the git branch of a
job, something like:
Jenkins.getInstance().getItemByFullName(Target).getScm().setBranch(newBranch);
But you could also try using the envinject plugin in Target to fetch the
contents of a stored artifact in the
Thanks Robert,
I'm going to go with your solution. Executing this using the groovy
postbuild action works:
manager.hudson.getItemByFullName(Target).getScm().getBranches().get(0).setName(newBranch);
Phil
On Friday, June 12, 2015 at 7:05:22 AM UTC-7, Robert Sandell wrote:
A plugin or groovy
Don't forget to save the job after you've changed the branch, otherwise the
change will be lost after restart.
def job = manager.hudson.getItemByFullName(Target);
job.getScm().getBranches().get(0).setName(newBranch);
job.save()
On Fri, Jun 12, 2015 at 4:59 PM, Phil C phils...@gmail.com wrote:
Hi Ben,
Yes, I looked at the Job DSL plugin a bit. It looks like it currently only
provides the ability to create new jobs. I couldn't find a way to modify
an existing job. I only read through the documentation, and haven't
actually tried messing around with it yet though. Maybe I'm
For what it's worth, Phil, when I used the Job DSL plugin, I used it to
modify existing jobs. I admit it's been about a year since I worked with
it, but that's what we would do. We had it tied in with the job template
plugin, and I can't 100% remember which piece of it over-wrote existing
jobs,
Hi Richard,
Thanks for the suggestion.
Yes, we have tried parameterized builds. However, the unfortunate
disadvantage of having to provide parameters at build time is that humans
have to provide those parameters, and humans tend to make errors
(especially if they have to do it for every
Would it be easier to just parameterise the Git Branch of the job that you
are changing and then pass a different parameter value in when needed?
(It's hard to know why a build would change the job's Git branch other
than, say, for that job to do something on the Git branch of the job that
has