Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkinsfile管道在中的指定目录中以循环模式运行命令_Jenkins_Jenkins Pipeline_Jenkins Groovy_Jenkins Job Dsl - Fatal编程技术网

Jenkinsfile管道在中的指定目录中以循环模式运行命令

Jenkinsfile管道在中的指定目录中以循环模式运行命令,jenkins,jenkins-pipeline,jenkins-groovy,jenkins-job-dsl,Jenkins,Jenkins Pipeline,Jenkins Groovy,Jenkins Job Dsl,在Jenkins中,管道需要在不同的目录中以循环模式运行多个命令 preBuild=['test\testSchemas\testSchemas','Common\Common'] stage('PreBuild') { when { expression { pipelineParams.preBuild != null } } steps { script { pipelineParams.preBuild.each {

在Jenkins中,管道需要在不同的目录中以循环模式运行多个命令

preBuild=['test\testSchemas\testSchemas','Common\Common']

stage('PreBuild') {
   when { expression { pipelineParams.preBuild != null } }
    steps {
        script {
            pipelineParams.preBuild.each {
              dir(pipelineParams.preBuild.${it}){
                    executeShellCommand("\"${env.NUGET}\" restore -source ${env.NEXUS_SERVER_URL}/repository/nuget-group/ -PackagesDirectory \"Packages\" ${it}")
                    executeShellCommand("\"${buildTool}\" ${pipelineParams.buildCommand} ${it}")
                      }
                    }
                }
              }
            } 

由于某些语法错误而出现错误,您能否在此方面提供帮助?我是Jeninsfile的新手

change
dir(pipelineParams.preBuild.${it})
。到
dir(it)
dir(“{it}”)
@yong,感谢您用dir(it)回复,它正在工作。再次感谢您的帮助