jenkinsci / jenkinsci/lockable-resources-plugin

Declarative Pipeline: Lock multiple resource types

Open
#150 16 comments 0 reactions 0 assignees View on GitHub
documentation Triage variables exposed by lock actions
Dominant language
Java
Stars
99
Forks
205
Avg merge
2d 13h
Merged PRs (30d)
8

Description

Hi,
I would like to lock two resources during the 'Test' stage below. I'm trying to get one resource with the 'SERVER' label, and one resource with the 'CLIENT' label. According to #23 this should possible but I can't nail down the syntax. Any idea how to accomplish this?

pipeline {
agent any
stages {
stage('Build') {
steps {
echo "Building..."
}
}
stage('Test') {
options {
lock(label: 'SERVER', variable: 'MY_RESOURCE', quantity: 1)
lock(label: 'CLIENT', variable: 'MY_RESOURCE', quantity: 1)
}
steps {
echo "Resource Locked: ${env.MY_RESOURCE}"
echo "Testing..."
}
}
stage('Deploy') {
steps {
input "Are you ready to deploy?"
echo 'Deploying...'
}
}
}
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.