运行Jenkins 2.289.1。
我有此pipelineJob职务Dsl设置活动选择参数:
https://plugins.jenkins.io/uno-choice/
pipelineJob("test") {
parameters {
activeChoiceParam('CHOICE-1') {
description('Allows user choose from multiple choices')
filterable()
choiceType('SINGLE_SELECT')
groovyScript {
script('return ["choice1", "choice2", "choice3"];')
fallbackScript('"fallback choice"')
}
}
}
definition {
cpsScm {
scm {
git {
remote {
credentials("${creds}")
url("${gitUrl}")
}
branch("${gitBranch}")
}
}
scriptPath("${pathToFile}")
}
}
}为了确保我一开始就可以运行Job,而不必手动批准将以下内容添加到jcasc中:
jenkins:
security:
globalJobDslSecurityConfiguration:
useScriptSecurity: false但这还不够。在根据上面的作业Dsl运行生成的管道之前,我仍然需要手动批准:

如何配置Job、jcasc或其他东西,以禁用对作业Dsl中发生的任何事情的脚本审批,或者自动批准在作业dsl中可能创建的任何脚本?
希望我不必像这里所建议的那样绕道而行:
https://stackoverflow.com/a/64364086/363603
我知道这个特性是有原因的,但这是因为我正在使用一个本地的jenkins来进行实验,而这目前正在扼杀我的生产力。相关信息:
发布于 2022-06-24 22:34:40
对我有用的是: Manage >> CSRF保护(部分标题-不确定原因)>为Job脚本启用脚本安全性(我禁用的选项的名称)。
https://stackoverflow.com/questions/68146340
复制相似问题