如何从命令行作为文件参数在jenkins中上传文件 [英] How to upload file from command line as file parameter in jenkins
本文介绍了如何从命令行作为文件参数在jenkins中上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用字符串参数从Jenkins的命令行触发build:
I am triggering builds with string parameters from the command line in Jenkins with:
curl http://jenkins:8080/job/Build/buildWithParameters?PARAM=value&token=token
我现在想触发构建从命令行中将文件作为文件参数。
I now want to trigger a build with a file as a file parameter from the command line.
例如,如果我的项目生成main.c,那么我想能够触发构建并上传我的
For example if my project builds main.c then I would like to be able to trigger a build and upload my main.c from the command line.
这是可能吗?
推荐答案
p>这在 Jenkins远程访问 API页面中有所描述:
This is described in the Jenkins Remote access API page:
curl http://jenkins/job/$JOB_NAME/build -F file0=@PATH_TO_FILE -F json='{"parameter": [{"name":"FILE_LOCATION_AS_SET_IN_JENKINS", "file":"file0"}]}'
您需要使用URL / build而不是/ buildWithParameters
Note that you need to use the URL /build instead of /buildWithParameters
这篇关于如何从命令行作为文件参数在jenkins中上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文