jenkins中的访问文件参数 [英] Access file parameter in jenkins

查看:1118
本文介绍了jenkins中的访问文件参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Jenkins从事一项多配置工作( Regression_L1 ),其任务是运行两种测试( test1和test2 ).在多配置作业中,它触发执行程序作业( Regression_executor )以运行所选测试的脚本. Regression_L1 作业只能在 matrix_service_jobs 节点中运行,而矩阵作业只能在从属节点 custom_matrix_service_jobs 节点中运行. Regression_executor 作业只能在带有特定标签(RL1_Test_Machine)的远程计算机中运行.

I'm working on a multiconfiguration job(Regression_L1) in Jenkins whose task is to run 2 kinds of tests(test1 and test2). In the multiconfiguration job, it triggers an executor job(Regression_executor) to run script for the selected test. The Regression_L1 job is restricted to run in matrix_service_jobs node, while the matrix jobs are to run in the slave node custom_matrix_service_jobs node. The Regression_executor job is restricted to run in remote machines with a specific label(RL1_Test_Machine).

我的目标是测试开发人员的自定义版本.因此,我为该作业添加了一个文件参数(配置-文件位置: CUSTOMBUILD/mybuild.zip ).问题是如何访问上传的文件?

My goal is to test custom build from developers. And so I added a File Parameter(config - File Location: CUSTOMBUILD/mybuild.zip) for the job. The question is how can I access the uploaded file?

一些重要信息:

  • Regression_executor的工作空间:/home/regressionexec/
  • Regression_L1的工作空间:/var/work/matrix_service_jobs/Regression_L1
  • Regression_l1矩阵工作区:/var/work/workspace_user_matrix/workspace/Regression_L1/TEST_PHASE/test1/label/custom_matrix_service_jobs//var/work/workspace_user_matrix/workspace/Regression_L1/TEST_PHASE/test2/label/custom_matrix_service_jobs/
  • $ JENKINS_HOME:var/work/jenkins_home
  • Regression_executor's workspace: /home/regressionexec/
  • Regression_L1's workspace: /var/work/matrix_service_jobs/Regression_L1
  • Regression_l1 matrix workspaces: /var/work/workspace_user_matrix/workspace/Regression_L1/TEST_PHASE/test1/label/custom_matrix_service_jobs/ and /var/work/workspace_user_matrix/workspace/Regression_L1/TEST_PHASE/test2/label/custom_matrix_service_jobs/
  • $JENKINS_HOME: var/work/jenkins_home

我不知道在哪里可以找到上载的文件,所以我搜索了ung linux find.结果是: /var/work/jenkins_home/Regression_L1/TEST_PHASE/test2/label/custom_matrix_service_jobs/builds/${BUILD_NUMBER}/fileParameters/CUSTOMBUILD/mybuild.zip.

I did not know where to find the uploaded files so I did a search ung linux find. The result is: /var/work/jenkins_home/Regression_L1/TEST_PHASE/test2/label/custom_matrix_service_jobs/builds/${BUILD_NUMBER}/fileParameters/CUSTOMBUILD/mybuild.zip.

如何将其复制到执行测试脚本的从节点?

How can I copy it to the slave node that executes the test script?

推荐答案

无论您在"文件位置"下输入什么,即为位置和保存变量的变量上传文件的原始文件名.

Whatever you enter under "File location", that would be the location and the variable that holds the original filename of the uploaded file.

但是,在* nix上,/.都不是有效的变量名称字符,因此,在您的情况下,如果文件位置"为CUSTOMBUILD/mybuild.zip,系统将无法创建变量${CUSTOMBUILD/mybuild.zip}

However, on *nix, neither / nor . are valid variable name characters, so in your case, if "File Location" is CUSTOMBUILD/mybuild.zip system cannot create a variable ${CUSTOMBUILD/mybuild.zip}

尽管该文件仍位于${WORKSPACE}/CUSTOMBUILD/mybuild.zip下.您也可以通过此路径访问它.

The file though is still placed under ${WORKSPACE}/CUSTOMBUILD/mybuild.zip. You can access it with this path too.

然后,您可以使用 复制到从属插件 ,以便将文件从主服务器复制到从属服务器

You can then use Copy To Slave plugin, to copy the file from master to your slaves

这篇关于jenkins中的访问文件参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆