As we all
know there are quite a few situations in real-world where we need to run
our Jenkins Job from the command line like automation of some routine task, build
updates, troubleshooting, etc.
For that Purpose
Jenkins has a built-in command-line interface that allows us to access Jenkins
from a script or from a shell interface.
To execute our Jenkins job from command line we need to follow below steps:
1) Manage Jenkinsร Jenkins CLIร Install the Jenkins CLI jar on local the machine at the same location where Jenkins war is file.
2) For Running a job click on Build Job
under Available Command.
3) Once Click on Build automatically
Command will be displayed on the top of the screen to execute Jenkins job for e.g
4) Now we need to go to the command line and
the path where CLI jar is present and fire the command from Step No 3. Please
Note we need to replace JOB with our actual job name.
We can also view the job status on the Jenkins Dashboard
5) For Checking Job progress on the command
line, we can use the command line in step 3 followed by the –f. There are other optional filed as well which we can use.