I'm wondering if it's possible to specify a branch to build when triggering a Jenkins job remotely. I'm writing a Python script which involves running a specific Jenkins build.
I'm able to run the build from my script successfully, but I'm wondering if there's a way to make the build run against a specific branch.
The builds are running on Jenkins and I'm using TFS for my source code management.
This is how I'm invoking the job - I tried to add parameters but this didn't do anything.
crumb=CrumbRequester(username="admin", password="2fa99c1e2aa61671d6b4334c8f0e77af", baseurl='http://localhost:8080/')
a = Jenkins('http://localhost:8081/', username="admin", password="2fa99c1e2aa61671d6b4334c8f0e77af", requester=crumb)
job = a.get_job("Project PR_DataCollectionWeb")
job.invoke(build_params={'GIT_BRANCH': git_branch})
I cannot specify a branch to be built when this job runs as the branch that needs to be run cannot be pre-determined.