gpt4 book ai didi

curl - 如何从命令行上传文件作为 Jenkins 中的文件参数

转载 作者:行者123 更新时间:2023-12-01 21:41:58 28 4
gpt4 key购买 nike

我使用 Jenkins 命令行中的字符串参数触发构建:

curl http://jenkins:8080/job/Build/buildWithParameters?PARAM=value&token=token

我现在想从命令行触发使用文件作为文件参数的构建。

例如,如果我的项目构建 main.c,那么我希望能够触发构建并从命令行上传我的 main.c。

这可能吗?

最佳答案

这在 Jenkins Remote access 中有描述。 API页面:

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

关于curl - 如何从命令行上传文件作为 Jenkins 中的文件参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13348480/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com