It's my test case I want run same job parallely in different locks.if one
lock is busy go to another lock

On Thu, Apr 30, 2020, 14:24 Gianluca <[email protected]> wrote:

>
> It's not really clear what you want ... but nevertheless I think you have
> got the solution.
> You have an "if" ... you just need to figure it out what is the condition
> that makes you go to the else branch.
>
> So, why one job should lock "Resource 1" and another should "Resource 2"?
>
>
> On Thursday, 30 April 2020 09:37:41 UTC+1, Satya Muralidhar Peddireddi
> wrote:
>>
>> pipeline {
>>     agent any
>>     stages {
>>         stage('sample_1') {
>>             steps {
>>                 script {
>>                     if(true) {
>>                         lock(label: 'Resource1') {
>>                             sh label: '', script: 'echo $JAVA_HOME'
>>                             sleep time: 1, unit: 'MINUTES'
>>                         }
>>                     }
>>                     else{
>>                         lock(label: 'Resource2') {
>>                             sh label: '', script: 'echo $JAVA_HOME'
>>                             sleep time: 1, unit: 'MINUTES'
>>                         }
>>                     }
>>                 }
>>             }
>>         }
>>     }
>> }
>>
>>
>> --
> 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/56d4aaa9-5435-4a18-ac5a-a4659222538e%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/56d4aaa9-5435-4a18-ac5a-a4659222538e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CANpaKTbfCUpXsyArq4yCB5Qm4f4k-%3DkEFCN%2Bb5Fq9y-y6vOA1w%40mail.gmail.com.

Reply via email to