Jenkins 允许作业链接 - 一项作业调用另一项作业。我们可以在在其他项目上构建的触发器/调用部分中配置它。
是否可以创建一个“私有(private)”Jenkins 作业,该作业只能从另一个作业中调用,而不能直接调用?
用例是为了避免用户错误地启动内部作业,该作业被提到仅用作作业链中的步骤之一。所有用户都是可信的,这是为了防止错误。
最佳答案
添加到下游/ protected 作业的开头。 请注意,如果您在沙箱中运行脚本,这需要大约 3 个批准。
if (currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause) == null) {
throw new SecurityException("can be only triggered from upstream")
}
关于jenkins - 如何创建一个无法直接调用而只能从另一个作业调用的 "private"Jenkins 作业?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41636692/