Git + Jenkins + Groovyã®é£æº3 #kyon_mmAdvent
kyon_mm Advent Calendar
ã¤ãã®ãªã³ã¯ã«ããAdventCalendarã®åæ¥ç®ã§ãã
http://connpass.com/event/1457/
ãããªãã
Gradleã§Jenkinsãã©ã°ã¤ã³ã¤ã³ã¹ãã¼ã«èªåå
ãã«ãå¾ãGroovyPostBuildã§èªç±èªå¨ã«æã
æºå
- Groovyã®ã¤ã³ã¹ãã¼ã«
- Gradleã®ã¤ã³ã¹ãã¼ã«
- 対象ã®Jenkinsãµã¼ãã¼ããjenkins-cli.jarããã¦ã³ãã¼ã
3ã«ã¤ãã¦ã¯ãJenkinsã®ç»é¢ãã²ããã[Jenkinsã®ç®¡ç] -> [Jenkins CLI]ã¨ãããã¨æ¬¡ã®ãããªç»é¢ãåºã¾ãã赤æ ã®ãªã³ã¯ãã¯ãªãã¯ããã¨jenkins-cli.jarããã¦ã³ãã¼ãã§ãã¾ãã
åã¯jenkins.warã¨åããã£ã¬ã¯ããªã«ããã¦ããã¨ããããããããªã£ã¦åãå ´æã«ãã¦ãã¾ãã
Gradleã§Jenkinsã®ãã©ã°ã¤ã³ã¤ã³ã¹ãã¼ã«èªåå
Jenkinsã¯ãã®GUIãåªãã¦ããäºã§ããã©ã°ã¤ã³ã®è¿½å ãªã©ãé常ã«ç°¡åã«è¡ãã¾ãããJenkinsãµã¼ãã¼æ¯ã«åããã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ããä½æ¥ãå¢ããã¨é¢åã«ãªãã¾ãã
ããã§ãJenkins CLIã®åºçªã§ãã
Jenkins CLIããã¦ã³ãã¼ãããç»é¢ãè¦ã¦ãããã¨ãããJenkins CLIã«ãã£ã¦å¤ãã®äºãè¡ãäºãå¯è½ã§ãã
Jenkins CLIèªä½ã¯CLI(Command Line Interface)ãªã®ã§ãªã«ã§å®è¡ãã¦ãããã®ã§ãããGroovyã§ãã£ã¦ã¿ã¾ãããã
次ã®ãããªã¹ã¯ãªããã«ãªãã¾ãã
æå®ããå¿
è¦ãããã®ã¯ãJenkinsãµã¼ãã¼ã®URLããã¤ã³ã¹ãã¼ã«ããããã©ã°ã¤ã³ã®ååãã§ãã
ããã§æ³¨æãå¿
è¦ãªã®ã¯ãã¤ã³ã¹ãã¼ã«ããããã©ã°ã¤ã³ã®ååãã§ãã
ããã¯Jenkinsã®ããã©ã°ã¤ã³ã®ç®¡çãç»é¢ã®åã¿ãä¸ã«è¡¨ç¤ºããã¦ããååã§ã¯ããã¾ããããJenkinsã®ãã©ã°ã¤ã³Wikiã«è¡¨ç¤ºããã¦ããIDãã«ãªãã¾ãããã©ã°ã¤ã³Wikiã¯ããã©ã°ã¤ã³ã®ç®¡çãããè¦ããåãã©ã°ã¤ã³åãã¯ãªãã¯ããã¨éãã¾ãã
Gradleã¹ã¯ãªããã¯æ¬¡ã®æãã«ãªãã¾ãã
ãã®ä¾ã§ã¯ãMSBuild, BuildPileLine, Gitãªã©ãã¤ã³ã¹ãã¼ã«ãã¦ãã¾ãã
def jenkins_home = $/d:\Apps\jenkins\jenkins.war/$ def jenkins_cli = $/d:\Apps\jenkins\jenkins-cli.jar/$ def jenkins_url = $/http://localhost:9001//$ defaultTasks 'all' def plugins = ["MSBuild", "build-pipeline-plugin", "git", "configurationslicing", "jobConfigHistory", "groovy-postbuild", "nunit", "preSCMbuildstep", "ssh-slaves", "mercurial", "dynamicparameter", "git-server"] task all << { plugins.each{p -> println "----Installing $p Plugin" ant.java(jar:jenkins_cli, fork:true){ arg(value: "-s") arg(value: jenkins_url) arg(value: "install-plugin") arg(value: p) } } }
ãããå®è¡ããã¨æ¬¡ã®ãããªè¡¨ç¤ºã«ãªãã¾ãã失æããå ´åã¯ãJava Result:1ãã¨åºãã¨æãã®ã§ãããµã¼ãã¼ã®URLããããã©ã°ã¤ã³ã®ååããééã£ã¦ããªãã確èªãã¦ãã ããã
ããã«é¢ãã¦ã¯ãªãã¸ããªã§å
¬éãã¦ãã¾ããåèã«ãã¦ã¿ã¦ãã ããã
https://bitbucket.org/kyon_mm/jenkinsplugininstall