我有一个Jenkins的工作流管道,它调用了一个groovy脚本。然后我的groovy脚本运行许多作业,每个作业都调用一个bash脚本来执行实际的测试。我希望能够在运行时从jenkins UI(构建w/ parameters时)在管道中设置一个变量,并使该参数可以从我的bash脚本访问。这是否可能使用工作流管道?
dgenwo3n1#
pipeline { agent any stages { stage('parent_job') { steps { script { env.GLOBAL_VARIABLE = "foo" build job: "call_child_bash", wait: true, parameters: [string(name: 'parent_variable', value: "foo")] } } } } }
字符串
儿童工作
pipeline { agent any stages { stage('child_bash') { steps { script { env.GLOBAL_VARIABLE = params.parent_variable sh "/tmp/sandbox/child_bash.sh" } } } } }
型x1c 0d1x的数据
子bash:/tmp/sandbox/child_bash.sh
echo "the global GLOBAL_VARIABLE value is $GLOBAL_VARIABLE"
型
父作业结果
的
下级作业结果
1条答案
按热度按时间dgenwo3n1#
无插件
上级职务
字符串
儿童工作
型
x1c 0d1x的数据
子bash:/tmp/sandbox/child_bash.sh
型
父作业结果
的
下级作业结果
的