简体   繁体   English

参数化构建Jenkins

[英]Parameterized build Jenkins

I have configured a job in Jenkins and checked "This build is parameterized" option. 我已经在Jenkins中配置了一个作业,并选中了“此构建已参数化”选项。 The parameter name I have given is "My_Param". 我给的参数名称是“ My_Param”。 The Jenkins is installed in the server machine. Jenkins已安装在服务器计算机中。 So I access the Jenkins dashboard through http://<servername>:8080/ In the Build part, I have to call a script by opening cygwin. 因此,我通过http://<servername>:8080/访问Jenkins仪表板。在Build部分中,我必须通过打开cygwin来调用脚本。 So I write 所以我写

#!C:\cygwin\bin\bash --login -i
./build/myscript.sh -full

After the build is completed, I want to move the files to another new directory prefix with Output, This directory name is the parameter I intend to pass. 构建完成后,我想将文件移动到带有Output的另一个新目录前缀,该目录名是我打算传递的参数。 so I write 所以我写

mkdir /cygdrive/c/users/admin/Ouput$My_Param

I run the build and pass param as first But, the directory is created as Output in the server machine and not as Outputfirst 我运行构建和通PARAM为第一 ,但,此目录将在服务器计算机的输出 ,而不是作为Outputfirst创建

Since you noted you use cygwin, I understand the server is on windows. 既然您注意到您使用的是cygwin,我知道服务器在Windows上。

Try parameter windows style environment variable: %My_Param% or linux: ${My_Param} 尝试使用参数Windows风格的环境变量: %My_Param%或linux: $ {My_Param}

I hope this helps. 我希望这有帮助。

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

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