POKE ME for any consultancy

Wednesday, February 11, 2015

Jenkins Command line Reference for login and trigger a job

$ curl http://myjenkins/job/myjob/lastBuild/api/json | grep --color result\":null
$ echo $?
 Trigger a Jenkins Job from command line
 $ wget http://yourserver/job/MyJobname/build?delay=0sec
$ wget -O - $HUDSON_URL/job/JOBNAME/build

Trigger a Jenkins Job without authentication
$ curl http://jenkins:8080/job/my%20job/build

Trigger a Jenkins Job with authentication
$ curl --user dbacher:$MY_API_TOKEN http://jenkins:8080/job/my%20job/build
$ curl --user <your_jenkins_username>:<your_jenkins_API_key> http://<jenkins_server_url>/job/<your_jenkins_job_name>/build

Running commands against a secure Jenkins (basic auth or ssh keys)
$ java -jar jenkins-cli.jar -s http://myjenkins help --username me --password mypassword
$ java -jar jenkins-cli.jar -s http://myjenkins help -i ~/.ssh/id_rsa

Triggering a job build against a secure Jenkins (avoiding a 1.5 year old open bug!)
$ java -jar jenkins-cli.jar -s http://myjenkins build 'My Awesome Jenkins Job' -i ~/.ssh/id_rsa
$ java -jar jenkins-cli.jar -s http://myjenkins build 'My Awesome Jenkins Job' -i ~/.ssh/id_rsa -s -v

Passing parameters when triggering a job build
$ java -jar jenkins-cli.jar -s http://myjenkins build 'Deploy XYZ App' -i ~/.ssh/id_rsa -s -v -p target_env=api.cloudfoundry.com -p branch=master

Reference
http://starkandwayne.com/articles/2013/04/12/jenkins-builds-from-cli/
http://www.scmgalaxy.com/index.php?option=com_k2&view=item&id=890:ways-to-login-jenkins-using-command-line&Itemid=120

Top 10 Website to Host Git Repository Online.


 


1

 

2

 

3

 

4

 

5

; 

6

 

7

 

8

 

9

 

10

 

Troubleshoot If a Linux-build-server suddenly starts getting slow ?

1. System Level troubleshooting

a. RAM related issues
b. Disk Space related Issues
c. Disk I/O read write issues
d. Network Hardware issues
e. Mount issues
f. Too Many process running in the machine
2. Application Level troubleshooting
a. Application is not behaving properly. Hit to Application log file OR application server log file OR web server Log file and try to understand the issues.
b. zombie process issues – Find out if any as such process which is causing the system performance issues.
c. Application Log – depends on the application installed, this can be referred and make use of the experience with the project and troubleshoot.
d. Web Server Log – we can check http, tomcat log as well.
e. Application Server Log – We can see jboss, web logic logs to see if the application server response/receive time is the issues for slowness.
f. Memory Leak of any application – This is one of well known issues in lunux based server due to bad application coding. Many times this can be resolved either by fixing the code or rebooting. But many other solutions are there to apply.
3. Dependent Services troubleshooting
a. SMTP Response time – SMTP server is not responding faster which is causing delay in response and queue up many processes.
b. Network issues – There are many System performance issues is dependent on network or service which is depends on the network.
c. Firewall related issues
d. Antivirus related issues


 Some of the useful commands for troubleshooting are..
1. df –h
2. du –sh
3. top
4. uptime
5. ps –eaf 
6. vmstat
7. ping
8. tail –f <logfile>
9. iostat
10.free
11.kill -9
12.mount
13.sar
14.ifconfig eth0 | enable | disable
15.traceroute
16.netstat -r
17.nslookup
18.route
   There are various options available for each commands and depends on the need during the troubleshooting, right commands can be applied.