I have done something similar, albeit in a scripted pipeline.Install the
"lockable resources" plugin, and define as resources each of the nodes that
could execute your job.
I.e. some name that includes the name of your node.
Assign a label (same label for all those resources) to these resources.Within
your job, request a lock() on the label. Once a lock is set, derive the name of
the node from the name
of the locked resource, then do the rest ...
gr, M
On Tuesday, March 12, 2019, 2:57:03 AM GMT+1, Dusan Nikolov
<[email protected]> wrote:
Hi, what do you mean configure the plugin?
If you're referring to adding lockable resources, that's not necessary - if a
resource doesn't exist it will be created on the fly (which I already
confirmed).
The problem I'm having is described in this thread exactly:
https://issues.jenkins-ci.org/browse/JENKINS-43336
On Monday, March 11, 2019 at 5:58:00 AM UTC-7, Mark Lübbehüsen wrote:
Hi,
after downloading the Lockable Resource Plugin in Jenkins, you have to
configure it in the system configuration of jenkins.
Am Freitag, 8. März 2019 00:58:59 UTC+1 schrieb Dusan Nikolov:
Hi, I'm trying to lock multiple stages in a pipeline and would like to use
NODE_NAME as the resource. Purpose is to allow multiple parallel executions of
the pipeline on different available nodes, but to make a node unavailable while
it's used by one running pipeline instance.
Now, the trick is that pipeline needs to be setup to run on two nodes at the
same time (please see example below).I've tried setting it up by using lock in
options block of the surrounding stage, but since options gets
evaluated/executed before agent is assigned to a stage, this fails to find
NODE_NAME.
pipeline { agent none stages { stage ('main') { parallel { stage ('server') {
agent { label 'server' } options { lock("${NODE_NAME}")} // This doesn't work.
NODE_NAME not available steps { script { echo "${NODE_NAME}" sleep(10) } } }
stage ('client') { agent { label 'client' } options { lock("${NODE_NAME}")} //
This doesn't work. NODE_NAME not available steps { script { echo "${NODE_NAME}"
sleep(10) } } } } } }}
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/67e3c848-aa2f-4a92-9551-d4def5a93fe2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/1935158453.114403.1554469861957%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.