Your SlideShare is downloading. ×
0
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Jenkins and Groovy
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Jenkins and Groovy

4,776

Published on

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,776
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
28
Comments
0
Likes
5
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Jenkins Groovy2011 2 26
    • 2. (@kiy0taka id:kiy0taka) Grails/Groovy Jenkins Plugin Terminal jQuery jQuery UI LT Hudson http://www.ustream.tv/recorded/108018382011 2 26
    • 3. Jenkins2011 2 26
    • 4. 2011 2 26
    • 5. Slide # 6 DevLOVE Groovy 2011.1.242011 2 26
    • 6. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 7 DevLOVE Groovy 2011.1.242011 2 26
    • 7. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 8 DevLOVE Groovy 2011.1.242011 2 26
    • 8. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 8 DevLOVE Groovy 2011.1.242011 2 26
    • 9. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 9 DevLOVE Groovy 2011.1.242011 2 26
    • 10. import java.io.*; BufferedReader bis = new BufferedReader import java.net.*; (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide # 9 DevLOVE Groovy 2011.1.242011 2 26
    • 11. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide #10 DevLOVE Groovy 2011.1.242011 2 26
    • 12. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; public class SocketAccess { while ((line = bis.readLine()) != null) { System.out.println(line); public static void main(String[] args) { } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); } } Slide #10 DevLOVE Groovy 2011.1.242011 2 26
    • 13. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); Slide #11 DevLOVE Groovy 2011.1.242011 2 26
    • 14. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; } InputStream ins = null; catch (IOException e) { OutputStream outs = null; e.printStackTrace(); try { try { soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); } outs = soc.getOutputStream(); catch(IOException ex) {} outs.write("GET / HTTP/1.0nn".getBytes } ()); Slide #11 DevLOVE Groovy 2011.1.242011 2 26
    • 15. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; InputStream ins = null; OutputStream outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #12 DevLOVE Groovy 2011.1.242011 2 26
    • 16. BufferedReader bis = new BufferedReader (new InputStreamReader(ins)); String line; while ((line = bis.readLine()) != null) { System.out.println(line); } Socket soc = null; InputStream ins = null; OutputStream outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #12 DevLOVE Groovy 2011.1.242011 2 26
    • 17. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } def soc = null; def ins = null; def outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #13 DevLOVE Groovy 2011.1.242011 2 26
    • 18. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } def soc = null; def ins = null; def outs = null; soc = new Socket("www.java-users.jp", 80); if (soc != null) soc.close(); ins = soc.getInputStream(); outs = soc.getOutputStream(); outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #13 DevLOVE Groovy 2011.1.242011 2 26
    • 19. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } } new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #14 DevLOVE Groovy 2011.1.242011 2 26
    • 20. bis = new BufferedReader(new InputStreamReader(ins)); def line = null; while ((line = bis.readLine()) != null) { System.out.println(line); } } new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #14 DevLOVE Groovy 2011.1.242011 2 26
    • 21. ins.eachLine{ line -> System.out.println(line); } } new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes ()); Slide #15 DevLOVE Groovy 2011.1.242011 2 26
    • 22. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes()); ins.eachLine { line -> System.out.println(line); } } Slide #16 DevLOVE Groovy 2011.1.242011 2 26
    • 23. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes()); ins.eachLine { line -> System.out.println(line); } } Slide #17 DevLOVE Groovy 2011.1.242011 2 26
    • 24. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".getBytes()); ins.eachLine { line -> System.out.println(line); } } Slide #17 DevLOVE Groovy 2011.1.242011 2 26
    • 25. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> System.out.println(line); } } Slide #18 DevLOVE Groovy 2011.1.242011 2 26
    • 26. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> System.out.println(line); } } Slide #18 DevLOVE Groovy 2011.1.242011 2 26
    • 27. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> println(line); } } Slide #19 DevLOVE Groovy 2011.1.242011 2 26
    • 28. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { line -> println(line); } } Slide #19 DevLOVE Groovy 2011.1.242011 2 26
    • 29. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { println(it); } } Slide #20 DevLOVE Groovy 2011.1.242011 2 26
    • 30. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes); ins.eachLine { println(it); } } Slide #20 DevLOVE Groovy 2011.1.242011 2 26
    • 31. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes) ins.eachLine { println(it) } } Slide #21 DevLOVE Groovy 2011.1.242011 2 26
    • 32. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write("GET / HTTP/1.0nn".bytes) ins.eachLine { println(it) } } Slide #21 DevLOVE Groovy 2011.1.242011 2 26
    • 33. new Socket("www.java-users.jp", 80).withStreams { ins, outs -> outs.write "GET / HTTP/1.0nn".bytes ins.eachLine { println it } } Slide #22 DevLOVE Groovy 2011.1.242011 2 26
    • 34. println new URL("http://www.java-users.jp").text Slide #23 DevLOVE Groovy 2011.1.242011 2 26
    • 35. Grape Maven/Ivy jar 22011 2 26
    • 36. Grape @Grab(‘groupId:artifactId:version’) import groovy.grape.Grape Grape.grab(group:groupId, module:artifactId, version:version) grape install <groupId> <artifactId> <version>2011 2 26
    • 37. @Grab ( ) @Grab(org.apache.poi:poi:3.2-FINAL) import org.apache.poi.hssf.usermodel.* def workBook = new HSSFWorkbook(new File(./foo.xls) workBook.newInputStream()).sheets.each { sheet -> sheet.firstRowNum.upto(sheet.lastRowNum) { sheet.getRow(it).with { row -> row.firstCellNum.upto(row.lastCellNum - 1) { println row.getCell(it).stringCellValue } } } }2011 2 26
    • 38. @Grab ( ) @Grab(org.mortbay.jetty:jetty-embedded:6.1.25) @Grab(com.h2database:h2:1.2.144) @Grab(mysql:mysql-connector-java:5.1.13) import org.mortbay.jetty.Server import org.mortbay.jetty.servlet.Context import org.h2.server.web.WebServlet def server = new Server(8080) new Context(server, "/", Context.SESSIONS) .addServlet(WebServlet, "/*") server.start()2011 2 26
    • 39. 2011 2 26
    • 40. http://groovy.codehaus.org/Download $ unzip groovy-binary-1.7.8.zip -d $JENKINS_HOME/tools/ $ chmod -R +x /opt/groovy-1.7.8/ $ export GROOVY_HOME=/opt/groovy-1.7.8/ $ export PATH=$GROOVY_HOME/bin2011 2 26
    • 41. groovysh2011 2 26
    • 42. groovyConsole2011 2 26
    • 43. �2011 2 26
    • 44. Groovy Jenkins Groovy Jenkins Jenkins Groovy2011 2 26
    • 45. Jenkins2011 2 26
    • 46. Groovy $JENKINS_HOME/init.groovy http://jenkinsserver/script Jenkins CLI Groovy Jenkins groovysh Jenkins2011 2 26
    • 47. init.groovy $JENKINS_HOME/init.groovy Post-initialization script import hudson.model.*; // start in the state that doesnt do any build. Hudson.instance.doQuietDown(); http://wiki.jenkins-ci.org/display/JENKINS/Post-initialization+script2011 2 26
    • 48. Groovy Jenkins http://jenkinsserver/script2011 2 26
    • 49. Jenkins CLI (Script) $ java -jar jenkins-cli.jar > -s http://jenkinsserver > groovy hoge.groovy http://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console http://scriptlerweb.appspot.com/2011 2 26
    • 50. Jenkins CLI (groovysh) $ java -jar jenkins-cli.jar > -s http://jenkinsserver groovysh2011 2 26
    • 51. ... Groovy groovysh2011 2 26
    • 52. JenkinsGroovyConsole GroovyConsole Jenkins GroovyConsole jenkins-cli.jar groovy JenkinsGroovyConsole [jenkins_url] https://gist.github.com/8435072011 2 26
    • 53. @GrabResolver(http://maven.glassfish.org/content/groups/public/) @Grab(org.jenkins-ci.main:cli:1.398) import hudson.cli.CLI import groovy.ui.Console jenkinsUrl = args ? args[0] : http://localhost:8080 Console.metaClass.newScript = { ClassLoader parent, Binding binding -> delegate.shell = new GroovyShell(parent, binding) delegate.shell.metaClass.run = { String scriptText, String fileName, List list -> def file = File.createTempFile(jenkinsgroovyconsole, .groovy) file.text = scriptText new CLI(jenkinsUrl.toURL()).execute([groovy, file.absolutePath], System.in, System.out, System.err) file.delete() null } } new Console(Console.class.classLoader.getRootLoader()).run()2011 2 26
    • 54. Demo (JNLP) (SSH) -Dmven.test.skip=true2011 2 26
    • 55. CI Groovy2011 2 26
    • 56. Jenkins Groovy2011 2 26
    • 57. 1. Groovy2011 2 26
    • 58. 2. Groovy http://groovy.codehaus.org/Download $ unzip groovy-binary-1.7.8.zip -d $JENKINS_HOME/tools/ $ chmod -R +x $JENKINS_HOME/tools/groovy-1.7.8/2011 2 26
    • 59. 3. Jenkins http://jenkinsserver/configure2011 2 26
    • 60. Groovy Job2011 2 26
    • 61. 2011 2 26
    • 62. Commons VFS Jenkins IRC Bot2011 2 26
    • 63. Groovy Grails/Groovy (JGGUG) http://www.jggug.org (?) G*Magazine http://grails.jp/g_mag_jp/2011 2 26
    • 64. 2011 2 26

    ×