[英]How to use job parameter or environment variable in Jenkins for archiving artifacts?
I have got a little issue with archiving artifacts using Jenkins我在使用 Jenkins 归档工件时遇到了一些问题
I would like to use a 'job parameter' (or environment variable) to archive the artifacts我想使用“作业参数”(或环境变量)来存档工件
I tried the following options in 'Files to archive' but nothing worked我在“要存档的文件”中尝试了以下选项,但没有任何效果
1) **/${MODULE_NAME}/*.dll
2) **/$MODULE_NAME/*.dll
3) **/%MODULE_NAME%/*.dll
4) **/$ENV:MODULE_NAME/*.dll
Kindly let me know whether there's any way to use 'job parameter' or 'environment variable' in Jenkins请告诉我是否有任何方法可以在 Jenkins 中使用“作业参数”或“环境变量”
I checked and you're doing that correctly (I tried to use **/${MODULE_NAME}/*.txt
in Files to archive
section). 我检查了一下,然后您所做的正确(我尝试在
Files to archive
部分中使用**/${MODULE_NAME}/*.txt
)。 Here is my test configuration: 这是我的测试配置:
and
和
So, it's ok to have this error: 因此,可以出现此错误:
'**/${MODULE_NAME}/*.txt' doesn't match anything: '**' exists but not '**/${MODULE_NAME}/*.txt'
When I run the job everything is fine. 当我执行工作时,一切都很好。 In my case, console output is:
就我而言,控制台输出为:
Started by user admin
Building on master in workspace /var/jenkins_home/workspace/freestyle
[freestyle] $ /bin/sh -xe /tmp/jenkins6987280264619488185.sh
+ cd directory1/directory2/directory3
+ touch test.txt
+ echo 24
+ ls
test.txt
Archiving artifacts
Finished: SUCCESS
I recommend you to check other part of configuration and also check if your file is created in the right path. 我建议您检查配置的其他部分,并检查文件是否在正确的路径中创建。
I guess is not possible yet to expand variables, you must pre-parse the files before archiving.我猜还不可能扩展变量,您必须在存档之前预先解析文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.