Here are some useful references.
It also seems Note that until we enable Allow anonymous read access, this the cli does not work for build. See https://stackoverflow.com/questions/30066657/jenkins-cant-find-the-job-when-build-job-why
...
Invoke Job without any parameters
Code Block | ||||
---|---|---|---|---|
| ||||
java -jar jenkins-cli.jar -s http://<hostname>:8080 build ExecuteParameters1 -f -s -v --username auto --password <password> |
...
Invoke Job with parameters
Code Block | ||||
---|---|---|---|---|
| ||||
java -jar jenkins-cli.jar -s http://<hostname>:8080 build ExecuteParameters1 -f -s -v -p ORACLE_HOME=/tmp -p INPUT1=2 -p INPUT2=3 --username auto --password <password> |
Tip |
---|
This can be done from FlexDeploy unix shell plugin using the command below.
$JAVA_HOME/bin/java -jar /u01/jenkins/jenkins-cli.jar -s $FDJENKINS_URL build <Job Name> -f -s -v -p INPUT1=$WF_INP1 -p INPUT2=$WF_INP2 --username $FDJENKINS_USERNAME --password JENKINS_PASSWORD |
Now let's check what was passed to Jenkins job and it matches our input parameters.
Now let's try to fail Jenkins job by passing wrong arguments. In this case, we will pass incorrect folder and job will fail.
...