I'm working on triggering a Jenkins Pipeline job when a commit is added to a particular branch on GitHub.
I do not see an appropriate Build Triggers on the Jenkins job options, like I would for a Jenkins Freestyle job.
How do I set a Jenkins Pipeline job to be triggered when a branch is updated with a new commit?
So far, I haven't found explicit answers to this scenario, Only trigger Jenkins Pipeline job on commit to master, only answered regarding Multi-branch jobs.
Any help on this question would be greatly appreciated!
To trigger a Jenkins pipeline with a new commit to Git branch you need to add the web hook on Git repository settings and select Pushes trigger event.
Or if you want Jenkins pipeline to perform some specific step on a specific branch .. you can try adding a condition in your Jenkinsfile like below..
def branchName = "${env.BRANCH_NAME}"
if(branchName == 'dev'){
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With