Facebooktwittergoogle_plusredditpinterestlinkedinmail

Run Jenkins build from command is very simple in Linux system. Jenkins has support to command line client that allows you to access Jenkins from command line.

To Trigger Jenkins build from command line some prequiste are there

  1.  Jenkins service is running.
  2.  Enable security option under “Configure Global Security”

Go to jenkins dashboard in Home page ( e.g http://localhost:8080/ ) -> Manage Jenkins
-> Configure Global Security -> Click on “Enable security” checkbox

You can also configure “Access Control” and “Authorization” option in Global Security page.
Jenkins allow us to trigger Jenkins build with any specific user, For that we have to pass username and password in command line.

Configure Global Security [Jenkins] 2014-07-07 18-44-04

You can check all CLI option in http://<jenkins server >/cli/ ( e.g http://localhost:8080/cli/ ) page.

To access CLI feature in Jenkins download jenkins-cli.jar (http://<jenkins server>/jnlpJars/jenkins-cli.jar) and place this jar your directory or location from you are going to run jenkins build command.

Jenkins Command build Option:-

Syntax :-

java -jar jenkins-cli.jar -s http://<jenkins server>/ build build-name [-c] [-f] [-p] [-r N] [-s] [-v] [-w]

Option Descriptions:-

build-name : Name of the job to build
-c  : Check for SCM changes before starting the build, and if there's no change, exit without doing a build
-f  : Follow the build progress. Like -s only interrupts are not passed through to the build.
-p  : Specify the build parameters in the key=value format.
-s  : Wait until the completion/abortion of the command. Interrupts are passed through to the build.
-v  : Prints out the console output of the build. Use with -s
-w  : Wait until the start of the command

e.g.

java -jar jenkins-cli.jar -s http://localhost:8080/ build 'my-project-build' --username roop --password roop
Run Jenkins Build From Command Linehttp://techieroop.com/wp-content/uploads/2014/07/jenkins.jpghttp://techieroop.com/wp-content/uploads/2014/07/jenkins.jpg Roopendra DevOPSJenkins,,,
Run Jenkins build from command is very simple in Linux system. Jenkins has support to command line client that allows you to access Jenkins from command line.To Trigger Jenkins build from command line some prequiste are there Jenkins service is running.  Enable security option under 'Configure Global Security'Go to...
Run Jenkins build from command is very simple in Linux system. Jenkins has support to command line client that allows you to access Jenkins from command line.<strong>To Trigger Jenkins build from command line some prequiste are there</strong> <ol> <li> Jenkins service is running.</li> <li> Enable security option under "Configure Global Security"</li> </ol> Go to jenkins dashboard in Home page ( e.g http://localhost:8080/ ) -> Manage Jenkins -> Configure Global Security -> Click on "<strong>Enable security</strong>" checkboxYou can also configure "<strong>Access Control</strong>" and "<strong>Authorization</strong>" option in Global Security page. Jenkins allow us to trigger Jenkins build with any specific user, For that we have to pass username and password in command line.<a href="http://techieroop.com/wp-content/uploads/2014/07/Configure-Global-Security-Jenkins-2014-07-07-18-44-04.png"><img class="size-medium wp-image-267 aligncenter" src="http://techieroop.com/wp-content/uploads/2014/07/Configure-Global-Security-Jenkins-2014-07-07-18-44-04-300x276.png" alt="Configure Global Security [Jenkins] 2014-07-07 18-44-04" width="300" height="276" /></a>You can check all CLI option in <strong>http://<jenkins server >/cli/</strong> ( e.g http://localhost:8080/cli/ ) page.To access <strong>CLI</strong> feature in Jenkins download <strong>jenkins-cli.jar</strong> (http://<jenkins server>/jnlpJars/jenkins-cli.jar) and place this jar your directory or location from you are going to run jenkins build command.Jenkins Command build Option:-<strong>Syntax :-</strong> <pre><code>java -jar jenkins-cli.jar -s http://<jenkins server>/ build build-name [-c] [-f] [-p] [-r N] [-s] [-v] [-w] </code></pre> <strong>Option Descriptions:-</strong> <pre><code>build-name : Name of the job to build -c  : Check for SCM changes before starting the build, and if there's no change, exit without doing a build -f  : Follow the build progress. Like -s only interrupts are not passed through to the build. -p  : Specify the build parameters in the key=value format. -s  : Wait until the completion/abortion of the command. Interrupts are passed through to the build. -v  : Prints out the console output of the build. Use with -s -w  : Wait until the start of the command </code></pre> e.g. <pre><code>java -jar jenkins-cli.jar -s http://localhost:8080/ build 'my-project-build' --username roop --password roop</code></pre>
(Visited 22,573 times, 513 visits today)
Facebooktwittergoogle_pluslinkedinrss