Workflow: will executing node('some_machine') twice yield the same current directory

26 views
Skip to first unread message

Nick Witkowski

unread,
Feb 16, 2016, 12:31:04 PM2/16/16
to Jenkins Users
Hi,

I have a question regarding workflow or now the pipeline plugin.
If I execute the following workflow job:

node('A') {
sh "pwd"
}

node('A') {
sh "pwd"
}

Is the second execution guaranteed to execute on the same node and directory? 

What I really want to do is:
parallel(build stuff in parallel)
//no errors
parallel(upload binaries to repo)

Therefore I'd like to know if executing on a node always yields the same job directory.

Thank you!

Nick

James Nord

unread,
Feb 16, 2016, 4:28:17 PM2/16/16
to Jenkins Users
short answer no - it is not guaranteed.

- you may have more than 1 executor on that node and you may have multiple simultaneous runs of the same pipeline so they would get different workspaces.

There are also other reasons why you should not do that...

If you need the files to be there look at the `stash` command.

Nick Witkowski

unread,
Feb 16, 2016, 4:30:20 PM2/16/16
to jenkins...@googlegroups.com
Ok thanks! I will look into stash.
--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/ioWrnYV0hdI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5cf121ba-d0f2-422e-b41a-0b9d6f48c968%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages