Date post: | 20-Jan-2016 |
Category: |
Documents |
Upload: | malcolm-ball |
View: | 215 times |
Download: | 0 times |
Nir Koren DevOps & Integration Lead, SAP Labs IsraelJune 2013
Connect your tools to JenkinsUsing the basic Jenkins API’s
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
© 2012 SAP AG. All rights reserved. 2
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
API connection
Jenkins provides several ways for getting and triggering actions directly on a Jenkins server.
We will review some methods which helps to connect your tools and scripts to Jenkins
SCRIPTS
CODE
REPORTS
© 2012 SAP AG. All rights reserved. 3
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
CLI (Command-Line Interface)
Built-in command line client. JAVA Archive
Jenkins release dependent: http://<HOST>/jenkins/cli
Can do almost everything in Jenkins via CMD / SHELL.
Extendable
© 2012 SAP AG. All rights reserved. 4
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
CLI DEMO
© 2012 SAP AG. All rights reserved. 5
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
CLI USAGE
Scripts and Automation
“Jenkins as a Service”
Unique – short time cases
© 2012 SAP AG. All rights reserved. 6
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
Remote access API
Machine-consumable Remote Access API.
A REST-like style.
XML …/api/xml
JSON …/api/json
PYTHON
© 2012 SAP AG. All rights reserved. 7
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
XML API
Works in almost any action by adding “/api/xml”
© 2012 SAP AG. All rights reserved. 8
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
XML API cont.
Can specify xPath to control the results. Example: /api/xml?xpath=/*/*[0]
Controlling the amount of data you fetch. Example:
api/xml?depth=1
Parsed by any technology to your tools / Apps
© 2012 SAP AG. All rights reserved. 9
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
JSON API
Works in almost any action by adding “/api/json”
© 2012 SAP AG. All rights reserved. 10
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
Additional Actions
Create and Copy jobs
Restart
Trigger a new build
http://<HOST:PORT>/jenkins/createItem
http://<HOST:PORT>/jenkins/restart
© 2012 SAP AG. All rights reserved. 11
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
API DEMO
© 2012 SAP AG. All rights reserved. 12
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
Usages in Jenkins API
Development live dashboard
© 2012 SAP AG. All rights reserved. 13
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
Usages in Jenkins API
Nice HTML mails
© 2012 SAP AG. All rights reserved. 14
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
iPhone / Android / Desktop custom applications
© 2012 SAP AG. All rights reserved. 15
Jenkins User Conference Israel, June 6 2013 #jenkinsconf
Thank you!
Nir Koren @KorenNir
DevOps & Integration Lead
SAP Labs Israel | [email protected]