Pro Yearly is on sale from $80 to $50! »

90分钟:jenkins_scriptler

6002ee051e03f0b762642ee7fafd111f?s=47 Zoom.Quiet
December 04, 2013

 90分钟:jenkins_scriptler

Larry cai

6002ee051e03f0b762642ee7fafd111f?s=128

Zoom.Quiet

December 04, 2013
Tweet

Transcript

  1. Larry cai <larry.caiyu@gmail.com>

  2. Agenda  What is Jenkins Scriptler ?  Exercise 1:

    Jenkins script console  Exercise 2: String, List via command line  Exercise 3: Groovy  Exercise 4: Learn how to use module json to dump data  Exercise 5: Generate online NASDAQ data using json Jenkins Scriptler in 90 minutes 2
  3. Jenkins Scriptler  Administering your jenkins scripts, which is used

    to trouble-shooting and diagnostics or routing tasks in jenkins  Provides a way to share scripts between users via hosted script catalogs on the internet.  Install plugin  Use http://<jenkins job>/scriptler/ or Jenkins -> Scriptler (system menu) Jenkins Scriptler in 90 minutes 3 https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin
  4. Jenkins script  Jenkins script can access to Jenkins instance

    data and manipulate directly  Jenkins script use Groovy, which is an agile and dynamic language for the Java Virtual Machine  a.k.a java-like script language over JVM Jenkins Scriptler in 90 minutes 4
  5. Exercise 1 – Hello World  Jenkins Console the place

    to exercise the Jenkins script Jenkins Scriptler in 90 minutes 5 https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
  6. Exercise 2 – Hook into Jenkins  Get the jenkins

    java instance ji = jenkins.model.Jenkins.instance  All the items (include jobs) jobs = ji.items  Printout the job names started with “test” Jenkins Scriptler in 90 minutes 6
  7. Exercise 3: Jenkins Java API  Script use jenkins JAVA

    API to access internal data http://javadoc.jenkins-ci.org/  Jenkins instance is http://javadoc.jenkins-ci.org/jenkins/model/Jenkins.html  Then locate “getAllItems()” API Jenkins Scriptler in 90 minutes 7
  8. Exercise 4 – Find the needed method  Find the

    Item API and try to printout the url for the jobs  If needed, check the source code if java developers https://github.com/jenkinsci/jenkins/blob/master/core/src/main/  Otherwise Check samples ;-) Jenkins Scriptler in 90 minutes 8
  9. Exercise 5: Put into Jenkins Scriptler  Now put the

    scripts into Jenkins Scriptler  Id & Name: geturl  Add parameter for “job_prefix”, use “$name” Jenkins Scriptler in 90 minutes 9
  10. Exercise 6: learn more Groovy  Install Groovy  Learn

    loop syntax Jenkins Scriptler in 90 minutes 10
  11. Exercise 7: cleanup Jenkins Scriptler in 90 minutes 11

  12. Reference  Market place  http://scriptlerweb.appspot.com/catalog/list  https://github.com/jenkinsci/jenkins-scripts/tree/master/scriptler  Groovy

     http://groovy.codehaus.org  Small guideline  http://earlyandoften.wordpress.com/2013/03/11/mastering-jenkins-m Jenkins Scriptler in 90 minutes 12