Jenkins multibranch pipeline always performs checkout on master node. In my case I want to make my build on another node. My script in Jenkinsfile looks like this:
node('osx') {
...
}
I'm forced to checkout env.BRANCH
on my node myself again to perform a build. It will be much better to perform pipeline build on selected node from the beginning, but I can not find how to do it.
Head over to your Jenkins instance and create a new item. Enter a name for the job, and select the “Multibranch Pipeline” option at the end of the screen. Then, click on the OK button. In the next screen, go to the “Branch sources” tab, click on the “Add source” button, and choose “Git” from the dropdown menu.
Jenkins Pipeline Vs. Multibranch Pipeline. A multibranch pipeline is meant for building multiple branches from a repository and deploy to multiple environments if required. A pipeline job supports both pipeline steps to be added in Jenkins configuration and form SCM.
Step 1: Open Jenkins home page ( http://localhost:8080 in local) & click on New Item from the left side menu. Step 2: Enter Jenkins job name & choose the style as multibranch pipeline and click OK. Step 3: In the configure page, we need to configure only one thing – The Git Repo source.
Do you have checkout scm
in your Jenkinsfile on the branch?
Like so:
node('osx') {
checkout scm
...
}
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