Hi,

I've looked if anybody discussed reentrant lock with jenkins pipeline but 
couldn't find anything at this group.

Consider this scenario when I want to have pipelines ALL, DEPLOY, TESTS. 
Last two pipelines have around 20 lines and I don't want to repeat that in 
ALL so ALL would just call those two pipelines - however I'm getting 
deadlock here.

ALL
lock('env_lock_name')
{
    stage ('DEPLOY')
    {
        build job: 'DEPLOY'
    }

    stage ('TEST')
    {
        build job: 'TEST'
    }
}

DEPLOY:
lock('env_lock_name')
{
    stage ('DEPLOY')
    {
        echo 'DEPLOY'
    }
}

TEST:
lock('env_lock_name')
{
    stage ('TEST')
    {
        echo 'TEST'
    }
}

Pipelines TEST and DEPLOY can be executed standalone so they need lock too.

I want to have lock in 'ALL' pipeline to ensure that nothing will get 
executed between DEPLOY and TEST at this env.

Logic of reentrant lock would resolve it. Do you have something similar 
already at your roadmap? Any ideas what would be a 'workaround' for now?

I could use shared library to move deploy there as a function and call it 
from two places but I would like to have history of deployments in one 
place under DEPLOY pipeline history.

Regards

Kamil


-- 
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/b326db40-9896-4a9c-958d-17989be953a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to