Jenkins 使用锁定插件在输入步骤后对作业进行排队
我们正在使用来防止某些部分的作业同时运行。我希望允许作业使用“输入步骤”启动并收集输入参数,然后在等待任何阻塞锁清除时排队,然后继续。相反,我看到整个作业被阻塞,在清除所有锁之前不允许输入,即使输入步骤在锁块之外 我做错了什么 以下是一个例子:Jenkins 使用锁定插件在输入步骤后对作业进行排队,jenkins,jenkins-plugins,jenkins-pipeline,Jenkins,Jenkins Plugins,Jenkins Pipeline,我们正在使用来防止某些部分的作业同时运行。我希望允许作业使用“输入步骤”启动并收集输入参数,然后在等待任何阻塞锁清除时排队,然后继续。相反,我看到整个作业被阻塞,在清除所有锁之前不允许输入,即使输入步骤在锁块之外 我做错了什么 以下是一个例子: // Define an input step and capture the outcome from it. def outcome = input id: 'deployment', message: 'Deployment Configura
// 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."
}
跟随这篇文章
我可以通过添加
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."
}
}