【发布时间】:2018-08-23 09:16:52
【问题描述】:
我正在编写一个 Jenkins DSL 脚本(groovy),它将创建一个 Jenkins 作业。我希望该作业启用的选项之一是显示“如果某些作业正在运行则阻止构建”的框
我尝试使用在这里找到的“blockOn”代码: https://jenkinsci.github.io/job-dsl-plugin/#path/freeStyleJob-blockOn
但是当我运行我的 DSL 脚本时,作业被创建并且没有选中“如果某些作业正在运行,则块构建”框
下面是被执行的整个 DSL 脚本:
job('Testing-DSL') {
blockOn(['2.Dummy_job', '1 .Dummy_job']) {
blockLevel('GLOBAL')
scanQueueFor('ALL')
} //closing blockOn section
description('''\
This is just a template job that I use to reference how groovy code should look<br>
''')
logRotator(-1, 30, -1, -1)
parameters {
choiceParam('CHOICE1', ['choice_option1', 'option2'], 'Some description for this param')
stringParam('STRING1', 'Default_Value_string1', 'Some description for this option')
} //closing parameters section
steps {
shell('''\
echo $CHOICE1
echo $STRING1
''')
} //closing steps section
} //closing job section
【问题讨论】: