詹金斯加载外部Groovy脚本:Powershell和蝙蝠步骤挂

时间:2018-11-07 10:53:06

标签: windows powershell batch-file jenkins jenkins-pipeline

我正在使用脚本生成Jenkins管道。然后加载并执行该管道。在任何Linux节点上,并使用sh语句等都可以正常工作。

我现在遇到了在Windows节点上执行powershellbat步骤的问题:

结帐scm可以正常工作,但是任何带有powershellbat步骤的步骤都将无限期地挂起。从生成的文件复制数据并在单个Jenkinsfile中重放所有内容,按预期进行。

正在运行的示例(不包括库):

“主要” Jenkinsfile:

def pod_label = "my_linux_node"
node(pod_label) {
  stage("Checkout") {
      checkout scm
  }
  stage("Pipeline generation") {
          // genarate pipeline and save in "gen_pipeline.groovy"
  }
  stage("Run Pipeline") {
      pipeline = load "gen_pipeline.groovy"
      pipeline.run_pipeline()
  }
}

脚本1:

def run_pipeline(){
    node('my_win_node') {
       checkout scm
       bat "echo foobar"
    }
}
return this

0 个答案:

没有答案
相关问题