Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Iterate over a file called branches (that should contain a list of branches to be built, one in each line) and triggers another Jenkins job via the REST API and authenticating with the API Token. It pulls the missing revisions from ALL branches as a final step.
for branch in $(cat branches)
echo "---------------"
echo "Branch: $branch"
json="{\"parameter\": [{\"name\": \"branch\", \"value\": \"$branch\"}]}"
curl -F json="$json" -u $1:$2 $JENKINS_URL/job/$2/build?token=$4
hg pull -u

patoarvizu commented Jul 9, 2013

Invocation: jenkinsUsername jenkinsAPIToken targetJob targetJobToken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment