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.
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.
Is this possible?
This is described in the Jenkins Remote access API page:
Note that you need to use the URL /build instead of /buildWithParameters
If you need to send both string parameters and a file parameter, you can do the following:
I had to make sure that the parameters
param1
,param2
andfileParm
exist in the Jenkins jobMy_Remote_Jenkins_Job
.The solution I have used (based on Christophers suggestion of using jenkins-cli) is:
Which with a File Parameter of main.c will upload your local hello.c to the the workspace of the Build job as main.c