简体   繁体   English

在 groovy 脚本中的 jenkins 管道步骤中触发作业

[英]Trigger a job within a jenkins pipeline step in groovy script

I have a below pipeline job.我有一个低于管道的工作。 http://abc:8080/job/US/job/UK/job/UAT/job/DEVOPS/job/Testing/job/test-readcsv/configure http://abc:8080/job/US/job/UK/job/UAT/job/DEVOPS/job/Testing/job/test-readcsv/configure

Within the groovy script of above job I need to trigger the below job.在上述作业的 groovy 脚本中,我需要触发以下作业。 http://abc:8080/job/US/job/UK/job/UAT/job/DEVOPS/job/Release/job/1.5.5.11-Release/configure Can someone please help in triggering the job. http://abc:8080/job/US/job/UK/job/UAT/job/DEVOPS/job/Release/job/1.5.5.11-Release/configure 有人可以帮忙触发工作吗?

I am using below command but it gets failed with error - java.lang.NoSuchMethodError: No such DSL method '$' found among step我正在使用以下命令,但它因错误而失败 - java.lang.NoSuchMethodError: No such DSL method '$' found between step

echo "Triggering job for branch ${env.BRANCH_NAME}" echo "触发分支 ${env.BRANCH_NAME} 的作业"

build job: "../../Release/1.5.5.11-Release", wait: false, parameters: [string(${csvContent}), string(${params.param1}), string(${params.param2})]构建作业:“../../Release/1.5.5.11-Release”,等待:false,参数:[string(${csvContent}), string(${params.param1}), string(${params.参数2})]

Here is an example of how I do it in one of my Jenkins files.这是我如何在我的 Jenkins 文件之一中执行此操作的示例。 That error you're seeing is possibly because your parameters are not in double quotes.您看到的那个错误可能是因为您的参数不在双引号中。

    stage('Trigger Pipeline'){
      steps {
          script {
                 build job:'Path/to/job' , parameters:[
                 string(name: "param1",  value: "${params.foo}"),
                 string(name: "param2",  value: "${params.bar}"),
               ]
            } 
      }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM