Define the node in pipeline

19 views
Skip to first unread message

Paul Chubatyy

unread,
Sep 14, 2016, 1:50:59 AM9/14/16
to Jenkins Users
Good morning,

I'm creating a small pipeline script that has multiple stages on the node to be executed:

node('sles12') {
stage('checkout') {
git 'https://github.com/acme/makefiles.git'
git url: 'https://github.com/acme/software.git', branch: env.BRANCH_NAME
sh 'echo `hostname`'
}
}

But Jenkins executes the actions on master node instead of slave. Although it sends me a mixed message in output:

22:17:46 Running on sles12-slave2 in /jenkins/workspace/software/master       <--------- This seems correct
[Pipeline] {
[Pipeline] stage
[Pipeline] { (checkout)
[Pipeline] git
22:17:46  > git config remote.origin.url https://github.com/acme/makefiles.git # timeout=10 <--------- But checkouts happen on master node
22:17:46 Fetching upstream changes from https://github.com/acme/makefiles.git
......Checks out the particular revision.........
[Pipeline] git
22:17:46 > git config remote.origin.url https://github.com/acme/software.git # timeout=10 22:17:47 Fetching upstream changes from https://github.com/acme/software.git ......Checks out the particular revision......... 22:17:47 First time build. Skipping changelog. [Pipeline] sh 22:17:47 [master] Running shell script 22:17:47 + hostname 22:17:47 + echo `hostname` 22:17:47 jenkins-master <------------- This is master node [Pipeline] }


Please advise what am I doing wrong here and how can I make Jenkins to execute my git checkouts and shell commands on the node labeled sles12 instead of master.

Thanks!

niristotle okram

unread,
Sep 16, 2016, 9:31:58 AM9/16/16
to jenkins...@googlegroups.com
Can you try this:

node('sles12') {
stage name: 'checkout'

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/96f75a5f-7e4a-4e9b-a2dd-1756ad6546eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards
nirish okram
Reply all
Reply to author
Forward
0 new messages