我们正在使用Lockable Resource Plugin来阻止我们工作的某些部分同时运行。我想允许一个作业启动并使用“输入步骤”然后队列收集输入参数,同时等待任何阻塞锁清除,然后继续。相反,我看到整个作业阻塞并且不允许我输入输入,直到所有锁被清除,即使我在Lock块之外有输入步骤。
我做错了什么?
以下是一个例子:
// Define an input step and capture the outcome from it.
def outcome = input id: 'deployment',
message: 'Deployment Configuration',
ok: 'Deploy',
parameters: [
[
$class : 'hudson.model.ChoiceParameterDefinition', choices: "development",
name : 'stack',
description: 'select a stack to deploy'
],
[
$class : 'hudson.model.ChoiceParameterDefinition', choices: "choice1\nchoice2",
name : 'profile',
description: 'select a profile to deploy'
],
]
def profile = "${outcome.get('profile')}"
def stack = "${outcome.get('stack')}"
echo "profile: ${profile}"
echo "stack: ${stack}"
// use lockable resource to prevent multiple jobs of the same project from running at the same time.
lock(resource: "deployment") {
sh "echo running deployment script here."
}
答案 0 :(得分:0)
关注此帖Jenkins Pipeline: “input” step blocks executor 我能够通过添加
解决问题stage('deploy') {
}
在我的街区附近。例如。
// Define an input step and capture the outcome from it.
def outcome = input id: 'deployment',
message: 'Deployment Configuration',
ok: 'Deploy',
parameters: [
[
$class : 'hudson.model.ChoiceParameterDefinition', choices: "development",
name : 'stack',
description: 'select a stack to deploy'
],
[
$class : 'hudson.model.ChoiceParameterDefinition', choices: "choice1\nchoice2",
name : 'profile',
description: 'select a profile to deploy'
],
]
def profile = "${outcome.get('profile')}"
def stack = "${outcome.get('stack')}"
stage('deploy') {
echo "profile: ${profile}"
echo "stack: ${stack}"
// use lockable resource to prevent multiple jobs of the same project from running at the same time.
lock(resource: "deployment") {
sh "echo running deployment script here."
}
}