Show Menu
Cheatography

Jenkins CLI Cheat Sheet by

My most common Jenkins CLI commands

Executing and Monitoring a Build Job

ssh -l kohsuke -p <RandomPort> <InternalJenkinsBuildUserName>@<JenkinsHostName> list-jobs
Build Project X
Build Project Y
ssh -l kohsuke -p <RandomPort> bob@JenkinsHost build 'Build\ Project\ x' -v
ssh -l kohsuke -p <RandomPort> bob@JenkinsHost console 'Build\ Project\ x' -f -n500

Stopping a Current Build Job

curl http://<jenkinshost:port>/job/Build%20-Project%20X/lastBuild/stop

Setup

1] Go to
http:/­/je­nki­nsh­ost­:80­80/­use­r/<­Jen­kin­sBu­ild­Use­r>/­con­figure

2] Get public key -
cat ~/.ssh­/id­_rs­a.pub

3] Copy and paste public key into your jenkin's user 'SSH Public Keys' text box
4] Save

1] Go to
http:/­/gr­een­lan­ter­n.l­oca­l:8­080­/co­nfi­gur­eSe­curity/

2] Select 'SSHD Port' to random
3] Discover the random ssh jenkins port via
curl -Lv https:­//j­enk­ins­hos­t/login 2>&1 | grep 'X-SSH­-En­dpoint'

3] Execute public key authen­icated jenkins commands via
ssh -l kohsuke -p <Ra­ndo­mSS­HPo­rt> <Je­nki­nsB­uil­dUs­er>­@<J­enk­ins­Hos­t> list-jobs
       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          Basic Cisco IOS Commands Cheat Sheet
          Top 30 linux shell tricks Cheat Sheet

          More Cheat Sheets by edendekker

          Apache Cassandra CQL Cheat Sheet
          VIM Cheat Sheet Cheat Sheet