Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Here are some useful references.

It also seems that until we enable Allow anonymous read access, this cli does not work for build. See https://stackoverflow.com/questions/30066657/jenkins-cant-find-the-job-when-build-job-why

Here are some of the examples.

Following examples are coded to wait till Job is completed and it pulls in console output as well. Also, it will be able to retrieve status by just looking at return code.

Invoke Job without any parameters

java -jar jenkins-cli.jar -s http://<hostname>:8080 build ExecuteParameters1 -f -s -v --username auto --password <password>

Invoke Job with parameters

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>

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.

  • No labels