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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b44aa8ae-43e1-4e6e-907b-2a6efddbc3e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to