Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Multibranch pipeline: How to select a build node?

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.

like image 284
Pazonec Avatar asked Sep 11 '16 12:09

Pazonec


People also ask

How do you do the Multibranch pipeline in Jenkins?

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.

What is the difference between Jenkins pipeline and Multibranch pipeline?

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.

How do you build a Multibranch pipeline?

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.


1 Answers

Do you have checkout scm in your Jenkinsfile on the branch?

Like so:

node('osx') {
    checkout scm
    ...
}
like image 172
Robert Mikes Avatar answered Oct 21 '22 14:10

Robert Mikes