Jenkins Cli Build Project without passing file parameter -
is there way call jenkins job using jenkins-cli without passing file parameter?
i have 1 jenkins job accepts following parameter (key1,key2,file-parameter) here jenins-cli call project.
java -jar jenkins-cli.jar \ -s <url> build <jenkins-project> \ -p key1=value1 -p file_parameter=filename
here if don't pass key2 build triggered want trigger build without passing file parameter.
if getting following error - no default value parameter file_parameter.
jenkins exposes other protocols remote execution such http , ssh.
given job 2 parameters
string_parameter =string param file_parameter =file upload param
here sample usage.
curl -x post $jenkins_url/job/hello/build \ --form file0=@my.txt \ --form json='{"parameter": [{"name":"file_parameter", "file":"file0"}, {"name":"string_parameter","value":"a_value_with_file"}]}'
and here string passed in. (file parameters skipped)
curl -x post $jenkins_url/job/hello/build \ --form file0=@my.txt \ --form json='{"parameter": [ {"name":"string_parameter","value":"no_file_used"}]}'
Comments
Post a Comment