【发布时间】:2020-03-24 17:28:41
【问题描述】:
管道卡住了,因为“测试应用程序”阶段正在等待 $Node 可用,但 $Node 应该由“启动 VM Azure 机器”阶段启动... 如何解决这个问题?
pipeline {
agent {label 'master'}
stages {
stage("Start VM Azure Machine"){
steps{
build(job: 'Run_or_Stop_Azure_VM', parameters: [string(name:'start_or_deallocate', value: 'start'), string(name: 'Node', value:"${NODE}")] )
}}
stage("Test app"){
steps {
build(job:'App install', parameters: [string(name: 'Node', value:"${NODE}")] )
}}
stage("Deallocate the machine"){
steps{
build(job: 'Run_or_Stop_Azure_VM', parameters: [string(name:'start_or_deallocate', value: 'stop'), string(name: 'Node', value:"${NODE}")] )
}}
}}
【问题讨论】:
-
有什么问题?阶段“开始...”不启动 VM 节点?然后应该报错停止流水线。
-
@zett42 阶段“Start VM..”未启动,因为管道等待 $Node 上线。悖论... stage("Test app") 需要在线 $Node 才能启动
-
请详细说明“Run_or_Stop_Azure_VM”在做什么。
-
它的参数化 FreeStyle 项目:取两个字符串:start_or_deallocate, Node ;限制可以运行此项目的位置: master ;执行 shell 命令: az vm ${start_or_deallocate} --resource-group "resGroup" --name "${Node}" ;
-
好的,我想通了。将:
This project is parameterized: Node更改为This project is parameterized: String。问题已解决
标签: windows azure jenkins jenkins-pipeline virtual-machine