如何将文件参数传递给詹金斯管道中的另一个构建作业?

Tom*_*eyn 5 jenkins jenkins-pipeline jenkins-2

如何将当前工作区中的文件作为参数传递给构建作业,例如:

build job: 'other-project', parameters: [[$class: 'FileParameterValue', ????]]
Run Code Online (Sandbox Code Playgroud)

Dan*_*dez 2

您可以传递文件的完整路径,您可以这样做:

node('master') {
  //Read the workspace path
  String path = pwd();
  String pathFile = "${path}/exampleDir/fileExample.ext";
  //Do whatever you wish with the file path 
}
Run Code Online (Sandbox Code Playgroud)