Jenkinspipe道可以写/configuration一个单独的Jenkins作业吗?

我有一个Jenkinspipe道build立docker图像,并用git hash标记它们。 我还有另一个参数化的Jenkinspipe道,这个pipe道需要一些string/select参数来部署泊坞窗图像。 我希望构buildpipe道将一些string附加到部署pipe道中的select参数,这样当用户运行部署pipe道时,他/她只会看到最近成功构build的泊坞窗图像列表供您select。

有人知道怎么做吗?

一种方法是,您的第一份工作是使用最近构build的图像选项卡列表(每行一个)设置一个环境variables。
请参阅声明式pipe道environment指令 。

然后,在“ Jenkinsfile中的dynamic参数? ”之后,可以使用如下的外部函数:

 #!/bin/groovy def envs = loadEnvs(); properties([ parameters([ choice(choices: envs, description: 'Please select an image tag', name: 'Env') ]) ]) 

这应该足以构build一个select参数列表。

“ pipe道:如何pipe理用户input ”(2017年5月10日,两周前)显示了一个替代命令,但在Declarative Pipeline语法中无效:

你必须使用input步骤来实现它。
它会给你这样的东西:

 stage 'promotion' def userInput = input( id: 'userInput', message: 'Let\'s promote?', parameters: [ [$class: 'TextParameterDefinition', defaultValue: 'uat', description: 'Environment', name: 'env'], [$class: 'TextParameterDefinition', defaultValue: 'uat1', description: 'Target', name: 'target'] ]) echo ("Env: "+userInput['env']) echo ("Target: "+userInput['target'])