{"id":17098,"date":"2018-07-30T11:45:36","date_gmt":"2018-07-30T02:45:36","guid":{"rendered":"http:\/\/labs.gree.jp\/blog\/?p=17098"},"modified":"2018-07-30T11:48:25","modified_gmt":"2018-07-30T02:48:25","slug":"jenkinsfile%e3%80%81%e6%9b%b8%e3%81%84%e3%81%a6%e3%81%be%e3%81%99%e3%81%8b%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/labs.gree.jp\/blog\/2018\/07\/17098\/","title":{"rendered":"Jenkinsfile\u3001\u66f8\u3044\u3066\u307e\u3059\u304b\uff1f"},"content":{"rendered":"<p>\u30a4\u30f3\u30d5\u30e9\u306e\u99d2\u5d0e\u3067\u3059\u3002Jenkins \u306e Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3064\u3044\u3066\u306e\u304a\u8a71\u3067\u3059\u3002<\/p>\n<p>\u65e9\u901f\u3067\u3059\u304c Jenkins \u306e Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u3001\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3082\u3057\u304b\u3057\u305f\u3089\u4ee5\u524d\u3061\u3087\u3063\u3068\u66f8\u3044\u3066\u3044\u305f\u3051\u3069\u3084\u3081\u3066\u3057\u307e\u3063\u305f\u3068\u304b\u3001\u5f93\u6765\u306e GUI \u8a2d\u5b9a\u306e\u307b\u3046\u304c\u697d\u3060\u3001\u3068\u306a\u3093\u3068\u306a\u304f\u656c\u9060\u3057\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u65b9\u3082\u3044\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u79c1\u304c\u5b9f\u969b\u305d\u3046\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u6700\u8fd1\u306b\u306a\u3063\u3066\u3084\u3063\u3068 Jenkinsfile - Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u304c\u8eab\u8fd1\u306b\u611f\u3058\u3089\u308c\u3066\u304d\u307e\u3057\u305f\u306e\u3067\u3001\u73fe\u72b6\u306e\u7c21\u5358\u306a\u307e\u3068\u3081\u3092\u66f8\u3044\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u5c11\u3057\u3067\u3082\u4f3c\u305f\u72b6\u6cc1\u306e\u65b9\u3078\u306e\u30d2\u30f3\u30c8\u3084\u304d\u3063\u304b\u3051\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n<h2>Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u306f\u96e3\u3057\u3044\uff1f<\/h2>\n<p>\u79c1\u306f\u6b63\u76f4\u30012016\u5e74\u306b Jenkins 2 \u306e\u76ee\u7389\u6a5f\u80fd\u3068\u3057\u3066 Pipeline \u304c\u51fa\u305f\u5f53\u521d\u306f\u3001\u3068\u3063\u3064\u304d\u306b\u304f\u3044\u2026\u308f\u304b\u3089\u3093\u2026\u3068\u601d\u3063\u3066\u304a\u308a\u307e\u3057\u305f\u3002Jenkins \u3092\u4e0a\u3063\u9762\u3067\u306a\u3093\u3068\u306a\u304f\u4f7f\u3063\u3066\u3044\u305f\u81ea\u5206\u306e\u3088\u3046\u306a\u4eba\u9593\u306b\u306f\u96e3\u3057\u304b\u3063\u305f\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u305d\u306e\u5f8c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u305f Declarative Pipeline \u306b\u3088\u308b Syntax \u5237\u65b0\u3084\u3001Pipeline \u95a2\u9023\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u6d3b\u767a\u306a\u66f4\u65b0\u306a\u3069\u3092\u7d4c\u3066\u3001\u4eca\u3067\u306f\u65e7\u6765\u306e GUI \u306b\u3088\u308b\u30dd\u30c1\u30dd\u30c1\u3068\u540c\u7b49\u304b\u305d\u308c\u4ee5\u4e0a\u306b\u624b\u8efd\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u611f\u3058\u307e\u3059\u3002<\/p>\n<h2>Declarative Pipeline \u3068\u306f<\/h2>\n<p>Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u306f\u73fe\u72b6 2 \u7a2e\u985e\u306e\u8a18\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>Jenkins v2.0 \u3068\u5171\u306b\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u305f Scripted Pipeline<\/li>\n<li>\u3088\u308a\u7c21\u6f54\u306b\u66f8\u3051\u308b\u3088\u3046\u306b\u306a\u3063\u305f Declarative Pipeline (2017\/02\uff5e)<\/li>\n<\/ul>\n<p><a href=\"https:\/\/jenkins.io\/doc\/book\/pipeline\/syntax\/#compare\">Pipeline \u306e\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u3082\u6bd4\u8f03\u304c\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059<\/a>\u304c\u3001 \u524d\u8005\u306f Groovy \u306e\u30b3\u30fc\u30c9\u3092\u76f4\u63a5\u6271\u3048\u308b\u3053\u3068\u3067\u9ad8\u3044\u67d4\u8edf\u6027\u3092\u6301\u3064\u53cd\u9762\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u611f\u304c\u5168\u9762\u306b\u51fa\u3066\u304a\u308a\u6271\u3044\u306b\u304f\u3055\u3082\u3042\u308a\u307e\u3059\u3002\u5f8c\u8005\u306e Declarative Pipeline \u306f\u30b7\u30f3\u30d7\u30eb\u306b\u57fa\u672c\u7684\u306a\u30b8\u30e7\u30d6\u5b9a\u7fa9\u3092\u8a18\u8ff0\u3067\u304d\u3001\u307e\u305f script \u30d6\u30ed\u30c3\u30af\u3092\u4f7f\u3046\u3053\u3068\u3067\u90e8\u5206\u7684\u306b Scripted Pipeline \u540c\u69d8\u306e\u51e6\u7406\u3092\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u304b\u3089\u65b0\u3057\u304f\u66f8\u304d\u306f\u3058\u3081\u308b\u5834\u5408\u306f Declarative Pipeline \u3092\u4f7f\u3046\u3088\u3046\u306b\u3059\u308b\u306e\u304c\u30d9\u30bf\u30fc\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>Web \u4e0a\u306e\u60c5\u5831\u3092\u8abf\u3079\u308b\u969b\u306f\u3069\u3061\u3089\u306b\u8a00\u53ca\u3057\u3066\u3044\u308b\u306e\u304b\u610f\u8b58\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u6df7\u4e71\u304c\u5c11\u306a\u3044\u3067\u3057\u3087\u3046\u3002\u57fa\u672c\u7684\u306b\u306f <code>pipeline {}<\/code> \u3067\u59cb\u307e\u3063\u3066\u3044\u308b\u3082\u306e\u304c Declarative Pipeline\u3001<code>node {}<\/code> \u3067\u59cb\u307e\u3063\u3066\u3044\u308b\u3082\u306e\u304c Scripted Pipeline \u3067\u3059\u3002<\/p>\n<h2>\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u958b\u767a<\/h2>\n<p>\u306a\u3093\u3068\u8a00\u3063\u3066\u3082<a href=\"https:\/\/jenkins.io\/doc\/book\/pipeline\/development\/\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306e\u60c5\u5831\u304c\u5145\u5b9f\u3057\u3066\u304a\u308a\u307e\u3059\u304c\u3001 \u4e00\u90e8\u629c\u7c8b\u3001\u88dc\u8db3\u3057\u3066\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n<h3>Generator<\/h3>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u66f8\u304d\u65b9\u306b\u8a70\u307e\u3063\u305f\u3089 Generator \u304c\u4fbf\u5229\u3067\u3059\u3002\u73fe\u5728\u306f 2\u7a2e\u985e\u306e Generator \u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u5404\u6240\u306b \"Pipeline Syntax\" \u306e\u30ea\u30f3\u30af\u3068\u3057\u3066\u7f6e\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>Snippet Generator\n<ul>\n<li><code>&lt;jenkins host&gt;\/job\/&lt;job name&gt;\/pipeline-syntax\/<\/code><\/li>\n<li>steps \u30d6\u30ed\u30c3\u30af\u5185\u306b\u66f8\u304f\u500b\u5225\u306e step \u3092\u751f\u6210<\/li>\n<\/ul>\n<\/li>\n<li>Declarative Directive Generator\n<ul>\n<li><code>&lt;jenkins host&gt;\/job\/&lt;job name&gt;\/directive-generator\/<\/code><\/li>\n<li>Declarative Pipeline \u3067\u4f7f\u3046\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u751f\u6210<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5927\u67a0\u306f\u3053\u3053\u304b\u3089\u306e\u5207\u308a\u8cbc\u308a\u3067\u63c3\u3048\u3089\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002step \u306e\u5f15\u6570\u3084\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u308f\u304b\u3089\u306a\u3044\u3068\u304d\u306b\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<h3>Lint &amp; BlueOcean Editor<\/h3>\n<p>Declarative Pipeline \u306f <a href=\"https:\/\/jenkins.io\/doc\/book\/pipeline\/development\/#linter\">Jenkins \u672c\u4f53\u306b\u3088\u308b lint \u30c4\u30fc\u30eb<\/a> \u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>\n# SSH \u7d4c\u7531\u3067\n$ ssh $JENKINS_HOSTNAME declarative-linter < Jenkinsfile\n<\/pre>\n<p>\u76f4\u63a5 SSH \u3059\u308b\u306e\u304c\u96e3\u3057\u3044\u74b0\u5883\u306e\u5834\u5408\u306f HTTP \u306e\u53e3\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3053\u3061\u3089\u306f\u5c11\u3005\u8907\u96d1\u3067\u3059\u3002<\/p>\n<pre>\n$ JENKINS_CRUMB=`curl \"$JENKINS_URL\/crumbIssuer\/api\/xml?xpath=concat(\/\/crumbRequestField,\\\":\\\",\/\/crumb)\"`\n$ curl -X POST -H $JENKINS_CRUMB -F \"jenkinsfile=<Jenkinsfile\" $JENKINS_URL\/pipeline-model-converter\/validate\n<\/pre>\n<p>\u79c1\u306f\u3088\u304f<a href=\"https:\/\/www.slideshare.net\/miyajan\/jenkinsfilelint\">\u3053\u3061\u3089\u306e npm \u30d1\u30c3\u30b1\u30fc\u30b8<\/a>\u3092\u4f7f\u308f\u305b\u3066\u3044\u305f\u3060\u3044\u3066\u304a\u308a\u307e\u3059\u3002\u30b3\u30de\u30f3\u30c9\u4e00\u767a\u3067 lint \u3092\u53e9\u3051\u307e\u3059\u3002\u88fd\u4f5c\u8005\u69d8\u306b\u611f\u8b1d\u3002<\/p>\n<pre>\n$ jflint -j http(s):\/\/$JENKINS_HOSTNAME Jenkinsfile\nJenkinsfile successfully validated.\n<\/pre>\n<p>\u4ed6\u306e\u65b9\u6cd5\u3068\u3057\u3066\u3001<a href=\"https:\/\/plugins.jenkins.io\/blueocean\">Blue Ocean \u30d7\u30e9\u30b0\u30a4\u30f3<\/a>  \u3092\u5c0e\u5165\u3057\u3066\u3044\u308b\u306e\u3067\u3042\u308c\u3070\u3001<a href=\"https:\/\/plugins.jenkins.io\/blueocean-pipeline-editor\">Blue Ocean Editor <\/a> \u3092\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u30022018\/07 \u73fe\u5728\u3001\u30a8\u30c7\u30a3\u30bf\u306e\u30d5\u30eb\u6a5f\u80fd\u306f Git \u30ec\u30dd\u30b8\u30c8\u30ea\u3092\u30bd\u30fc\u30b9\u306b\u3057\u305f\u30b8\u30e7\u30d6\u306b\u9650\u3089\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u304c\u3001<code>&lt;jenkins host&gt;\/blue\/organizations\/jenkins\/pipeline-editor\/<\/code> \u306b\u76f4\u63a5\u30a2\u30af\u30bb\u30b9 &amp; <code>Ctrl+s<\/code> \u3068\u3059\u308b\u3053\u3068\u3067\u3001Git \u30ec\u30dd\u30b8\u30c8\u30ea\u306b\u95a2\u4fc2\u306a\u304f\u30a8\u30c7\u30a3\u30bf\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u4e0a\u3067\u306f\u524d\u8ff0\u306e lint \u540c\u7b49\u306e\u30c1\u30a7\u30c3\u30af\u3092\u3057\u3066\u304f\u308c\u307e\u3059\u3002lint \u304c\u901a\u3063\u305f\u3082\u306e\u306b\u3064\u3044\u3066\u306f\u5404 stage \u3092\u8996\u899a\u5316\u3057\u3066\u8868\u793a\u3057\u307e\u3059\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_blue_editor-435x400.png\" alt=\"\" width=\"435\" height=\"400\" class=\"alignnone size-medium wp-image-17112\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_blue_editor-435x400.png 435w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_blue_editor-218x200.png 218w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_blue_editor-768x706.png 768w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_blue_editor.png 807w\" sizes=\"auto, (max-width: 435px) 100vw, 435px\" \/><br \/>\n\u305f\u3060\u3057\u3053\u306e\u4f7f\u3044\u65b9\u3067\u306f\u76f4\u63a5\u30b8\u30e7\u30d6\u3078\u4fdd\u5b58\u306f\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u624b\u5143\u306e\u30b3\u30fc\u30c9\u3092\u30b3\u30d4\u30da\u3067\u8cbc\u308a\u4ed8\u3051\u3066\u30c1\u30a7\u30c3\u30af\u3057\u305f\u308a\u3001\u5168\u4f53\u306e\u6d41\u308c\u3092\u78ba\u8a8d\u3059\u308b\u7a0b\u5ea6\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>lint \u5168\u822c\u306f Scripted Pipeline \u306b\u306f\u5bfe\u5fdc\u3057\u307e\u305b\u3093\u3002\u307e\u305f Declarative Pipeline \u4e2d\u306e <code>script {}<\/code> \u30d6\u30ed\u30c3\u30af\u4e2d\u3082\u691c\u51fa\u3067\u304d\u307e\u305b\u3093\u306e\u3067\u3001\u5404\u7a2e\u30a8\u30c7\u30a3\u30bf\u3084 IDE \u306b\u3088\u308b groovy \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30c1\u30a7\u30c3\u30af\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u306e\u304c\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>Replay<\/h3>\n<p>lint \u3067\u306f\u30ed\u30b8\u30c3\u30af\u306e\u30df\u30b9\u306f\u62fe\u3048\u307e\u305b\u3093\u306e\u3067\u3001\u3061\u3087\u3063\u3068\u3057\u305f\u624b\u76f4\u3057\u3092\u7e70\u308a\u8fd4\u3059\u3053\u3068\u3082\u591a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/jenkins.io\/doc\/book\/pipeline\/development\/#replay\">Replay<\/a> \u306f\u5b9f\u884c\u6e08\u307f\u306e Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u76f4\u63a5\u30d6\u30e9\u30a6\u30b6\u3067\u7de8\u96c6\u3057\u3066\u518d\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u5f37\u529b\u306a\u6a5f\u80fd\u3067\u3059\u3002\u5b9f\u884c\u6e08\u307f\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u4e00\u90e8\u5909\u66f4\u3092\u52a0\u3048\u3066\u52d5\u4f5c\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u7de8\u96c6\u3057\u305f\u5206\u306e\u4fdd\u5b58\u306f\u3055\u308c\u306a\u3044\u306e\u3067\u3001\u4fee\u6b63\u3092\u78ba\u8a8d\u3067\u304d\u305f\u3089\u5143\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u53cd\u6620\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>Jenkinsfile \u3092\u3061\u307e\u3061\u307e commit &amp; run \u3057\u3066\u306f\u5c65\u6b74\u3092\u6c5a\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u3001Replay \u3067\u3057\u3063\u304b\u308a\u76f4\u3057\u3066\u304b\u3089\u4e00\u767a\u3067\u4fee\u6b63\u53cd\u6620\u3067\u304d\u308b\u306e\u306f\u5b09\u3057\u3044\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<h2>\u4e8b\u4f8b\u96c6<\/h2>\n<p>\u3044\u304f\u3064\u304b\u5b9f\u969b\u306b\u4f7f\u3063\u3066\u3044\u308b\u30b5\u30f3\u30d7\u30eb\u3092\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3059\u3002<br \/>\n\u6319\u3052\u59cb\u3081\u308c\u3070\u304d\u308a\u304c\u3042\u308a\u307e\u305b\u3093\u304c\u3001Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u72ec\u7279\u306e\u3082\u306e\u3084\u3001\u79c1\u306e\u4e3b\u89b3\u3067\u7279\u306b\u4fbf\u5229\u3055\u3092\u611f\u3058\u305f\u3082\u306e\u3092\u6319\u3052\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>Declarative Pipeline \u306e\u767a\u8868\u304b\u30891\u5e74\u4ee5\u4e0a\u3082\u7d4c\u904e\u3057 Web \u4e0a\u306e\u60c5\u5831\u3082\u591a\u3044\u306e\u3067\u3044\u307e\u3055\u3089\u611f\u3082\u3042\u308a\u307e\u3059\u304c\u305d\u3053\u306f\u3054\u5bb9\u8d66\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>credentials \/ sshagent \/ withCredentials<\/h3>\n<p>\u7279\u306b\u696d\u52d9\u5229\u7528\u306b\u304a\u3044\u3066\u306f\u3001\u79d8\u5bc6\u9375\u3084\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3001\u30e6\u30fc\u30b6\/\u30d1\u30b9\u30ef\u30fc\u30c9\u30da\u30a2\u3068\u3044\u3063\u305f\u6a5f\u5bc6\u60c5\u5831\u3092\u6271\u3046\u30b8\u30e7\u30d6\u3092\u4f5c\u308b\u6a5f\u4f1a\u3082\u591a\u3044\u3067\u3057\u3087\u3046\u3002<br \/>\n\u3053\u3046\u3044\u3063\u305f\u6a5f\u5bc6\u60c5\u5831\u306f Jenkins \u672c\u4f53\u306e\u8a8d\u8a3c\u60c5\u5831 (Credentials)\u306b\u767b\u9332\u3057\u3001\u30b8\u30e7\u30d6\u8a2d\u5b9a\u304b\u3089\u306f\u767b\u9332\u6e08\u307f\u306e Credentials \u3092 ID \u3067\u5f15\u3044\u3066\u304d\u3066\u4f7f\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u5f93\u6765\u306e\u30b8\u30e7\u30d6\u3067\u306f GUI \u306e select \u304b\u3089\u9078\u629e\u306b\u306a\u308b\u306e\u3067\u751f\u306e ID \u3092\u6c17\u306b\u3059\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f ID \u304c\u76f4\u63a5\u30b3\u30fc\u30c9\u306b\u4e57\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u8a8d\u8a3c\u60c5\u5831\u3092\u767b\u9332\u3059\u308b\u3068\u304d\u306b\u306f\u3001ID \u3092\u7a7a\u6b04\u306b\u305b\u305a\u308f\u304b\u308a\u3084\u3059\u3044\u540d\u524d\u3092\u4ed8\u3051\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002\u7a7a\u6b04\u3067\u3082\u767b\u9332\u3067\u304d\u307e\u3059\u304c\u305d\u306e\u5834\u5408\u306e ID \u306f\u30e9\u30f3\u30c0\u30e0\u6587\u5b57\u5217\u306b\u306a\u308b\u305f\u3081\u3001\u3042\u3089\u304b\u3058\u3081\u540d\u524d\u3092\u6307\u5b9a\u3057\u305f\u307b\u3046\u304c\u30b9\u30af\u30ea\u30d7\u30c8\u5074\u306e\u53ef\u8aad\u6027\u304c\u9ad8\u307e\u308a\u307e\u3059\u3057\u3001\u3082\u3057\u3082 Jenkins \u5074\u3067\u60c5\u5831\u304c\u5439\u3063\u98db\u3093\u3060\u5834\u5408\u3084\u5225 Jenkins \u306b\u30b8\u30e7\u30d6\u3092\u79fb\u3059\u5834\u5408\u306b\u3082\u540c\u3058 ID \u3092\u3064\u3051\u308c\u3070\u30b9\u30af\u30ea\u30d7\u30c8\u305d\u306e\u307e\u307e\u3067\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_credentials-481x400.png\" alt=\"\" width=\"481\" height=\"400\" class=\"alignnone size-medium wp-image-17113\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_credentials-481x400.png 481w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_credentials-240x200.png 240w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_credentials.png 698w\" sizes=\"auto, (max-width: 481px) 100vw, 481px\" \/><\/p>\n<pre><code class=\"language-groovy\">      steps {\n        sshagent(['jenkins-ci-user-and-key']) {\n          sh 'git ... ~'\n          sh 'git push foo mytag'\n        }\n      }\n<\/code><\/pre>\n<h3>docker \u3092\u4f7f\u3044\u305f\u3044<\/h3>\n<p>docker \u3092\u4f7f\u3044\u305f\u3044\u3001\u3068\u8a00\u3046\u5834\u5408\u306f\u591a\u304f\u306e\u5834\u5408\u4e0b\u8a18\u306e\u3069\u3061\u3089\u304b\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u3069\u3061\u3089\u3082 Docker pipeline \u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30d3\u30eb\u30c9\u74b0\u5883\u3092 docker \u3067\u7528\u610f\u3057\u305f\u3044<\/li>\n<li>docker \u30a4\u30e1\u30fc\u30b8\u3092\u30d3\u30eb\u30c9\u3057\u305f\u3044<\/li>\n<\/ul>\n<p>Declarative Pipeline \u304c\u4f7f\u3048\u308b\u72b6\u6cc1\u3067\u3042\u308c\u3070 Docker pipeline \u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u4f9d\u5b58\u95a2\u4fc2\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u306e\u3067\u3001docker \u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u7528\u53ef\u80fd\u306a\u30ce\u30fc\u30c9\u3055\u3048\u7528\u610f\u3057\u3066\u304a\u3051\u3070\u7c21\u5358\u306b docker \u3092\u4f7f\u3063\u305f\u30b8\u30e7\u30d6\u3092\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u306b\u3088\u3063\u3066<a href=\"https:\/\/jenkins.io\/doc\/book\/pipeline\/docker\/\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a> \u304c\u975e\u5e38\u306b\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u4f8b\u3067\u306f docker \u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u3048\u308b\u30ce\u30fc\u30c9\u3092 <code>label 'docker-host'<\/code> \u3067\u53c2\u7167\u3067\u304d\u308b\u3082\u306e\u3068\u3057\u307e\u3059\u3002<\/p>\n<h4>\u30d3\u30eb\u30c9\u74b0\u5883\u306b docker \u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3046<\/h4>\n<p>\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30a4\u30e1\u30fc\u30b8\u3084\u3001\u81ea\u524d\u306e Dockerfile \u3067\u5b9a\u7fa9\u3057\u305f\u30a4\u30e1\u30fc\u30b8\u3092\u30b8\u30e7\u30d6\u5b9f\u884c\u74b0\u5883\u306b\u4f7f\u3046\u306b\u306f\u3001agent \u30d6\u30ed\u30c3\u30af\u3067 <code>docker {}<\/code> \u307e\u305f\u306f <code>dockerfile {}<\/code> \u3092\u6307\u5b9a\u3059\u308c\u3070OK\u3067\u3059\u3002<\/p>\n<p>\u81ea\u52d5\u7684\u306b WORKSPACE \u3092\u30b3\u30f3\u30c6\u30ca\u5185\u306b\u30de\u30a6\u30f3\u30c8\u3057\u3001\u74b0\u5883\u5909\u6570\u3092\u3088\u3044\u5177\u5408\u306b <code>docker run -e<\/code> \u306b\u6e21\u3057\u3066\u304f\u308c\u307e\u3059\u306e\u3067\u3001docker \u5185\u3067\u3042\u308b\u3053\u3068\u3092\u3042\u307e\u308a\u610f\u8b58\u305b\u305a\u306b steps \u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f Ubuntu \u306e2\u7a2e\u985e\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u4e26\u5217\u30d3\u30eb\u30c9\u3092\u884c\u3046\u4f8b\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-groovy\">pipeline {\n  agent none\n  stages {\n    stage('Build') {\n      parallel {\n        stage('BuildUbuntu1604') {\n          agent {\n            dockerfile {\n              filename '.\/Dockerfile.ubuntu16.04'\n              label 'docker-host'\n            }\n          }\n          steps {\n            sshagent(['some-user-and-accesskey']) {\n              sh '.\/some_git_ops'\n            }\n            sh '.\/do_build'\n          }\n        }\n        stage('BuildUbuntu1804') {\n          agent {\n            dockerfile {\n              filename '.\/Dockerfile.ubuntu18.04'\n              label 'docker-host'\n            }\n          }\n          steps {\n            sshagent(['some-user-and-accesskey']) {\n              sh '.\/some_git_ops'\n            }\n            sh '.\/do_build'\n          }\n        }\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<p>\u74b0\u5883\u5909\u6570\u306e\u5f15\u304d\u7d99\u304e\u306b\u3088\u308a\u5148\u306b\u6319\u3052\u305f <code>sshagent() {}<\/code> \u3082\u975e docker \u6642\u3068\u540c\u3058\u3088\u3046\u306b\u4f7f\u3048\u3066\u3044\u307e\u3059\u3002\u307e\u305f\u3001\u30d3\u30eb\u30c9\u3057\u305f\u6210\u679c\u7269\u3092\u4fdd\u5b58\u3057\u305f\u3044\u3088\u3046\u306a\u5834\u5408\u306f\u3001WORKSPACE \u4ee5\u4e0b\u306b\u51fa\u529b\u3059\u308c\u3070\u30db\u30b9\u30c8\u306b\u6b8b\u308b\u306e\u3067\u666e\u6bb5\u901a\u308a\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f Jenkins \u30e6\u30fc\u30b6\u306e UID \u3067 <code>docker run<\/code> \u304c\u5b9f\u884c\u3055\u308c\u308b\u306e\u3067\u3001\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u306e\u90fd\u5408\u304c\u3042\u308c\u3070\u5fc5\u8981\u306b\u5fdc\u3058\u3066 <code>args '-u 0:0'<\/code> \u306a\u3069\u3092\u8ffd\u52a0\u3059\u308b\u3068\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ed6\u306b\u306f\u6c38\u7d9a\u5316\u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u4f8b\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306f <code>bundle install<\/code> \u306e\u7d50\u679c\u3092 docker volume \u5185\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u30662\u56de\u76ee\u4ee5\u964d\u306e\u30d3\u30eb\u30c9\u3092\u9ad8\u901f\u5316\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-rb:Gemfile\">## Gemfile\nsource 'https:\/\/rubygems.org'\n\ngem 'nokogiri' # \u30b3\u30f3\u30d1\u30a4\u30eb\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u3069\ngem 'rspec'\n<\/code><\/pre>\n<pre><code class=\"language-groovy\">pipeline {\n  agent {\n    docker {\n      image 'ruby:2.5'\n      label 'docker-host'\n      args '-v bundle_cache:\/usr\/local\/bundle' \/\/ docker volume 'bundle_cache' \u3092\u30de\u30a6\u30f3\u30c8\u3057\u3066\u518d\u5229\u7528\n    }\n  }\n  stages {\n    stage('Test') {\n      steps {\n        sh 'bundle install'\n        sh 'bundle exec nokogiri -v'\n        sh 'bundle exec rspec'\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<p>\u3044\u305a\u308c\u3082\u8868\u73fe\u529b\u306e\u9ad8\u3044\u69cb\u6587\u3067\u8a18\u8ff0\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002 docker \u74b0\u5883\u3092\u6c17\u8efd\u306b\u4f7f\u3048\u308b\u3068\u30ce\u30fc\u30c9\u306e\u5b9f\u884c\u74b0\u5883\u6e96\u5099\u306b\u624b\u9593\u304c\u304b\u304b\u308a\u307e\u305b\u3093\u3057\u3001\u30c6\u30b9\u30c8\u3084\u30d3\u30eb\u30c9\u74b0\u5883\u3092 Jenkinsfile (+Dockerfile) \u306b\u8a18\u8ff0\u3067\u304d\u308b\u306e\u3067\u3001\u95a2\u5fc3\u304c\u5bfe\u8c61\u30ec\u30dd\u30b8\u30c8\u30ea\u306b(\u307b\u307c)\u9589\u3058\u308b\u3053\u3068\u306b\u3082\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ed6\u306b\u3082\u3001\u4f8b\u3048\u3070\u672c\u4f53\u306e\u30a2\u30d7\u30ea\u3068\u306f\u5225\u306e DB \u30b3\u30f3\u30c6\u30ca\u3092\u7acb\u3061\u4e0a\u3052\u305f\u3044\u5834\u5408\u306b\u306f\u3001<a href=\"https:\/\/jenkins.io\/doc\/book\/pipeline\/docker\/#running-sidecar-containers\">Running sidecar containers<\/a> \u306e\u30d1\u30bf\u30fc\u30f3\u3082\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3067\u3059\u304c\u3001\u500b\u4eba\u7684\u306b\u306f\u8907\u6570\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u6271\u3044\u305f\u304f\u306a\u3063\u305f\u3089\u305d\u308c\u7528\u306e docker-compose \u8a2d\u5b9a\u3092\u7528\u610f\u3059\u308b\u307b\u3046\u304c\u30b7\u30f3\u30d7\u30eb\u304b\u3068\u306f\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3>docker \u30a4\u30e1\u30fc\u30b8\u3092\u30d3\u30eb\u30c9\u3057\u3066 push \u3059\u308b<\/h3>\n<p>\u5f0a\u793e\u3067\u3082\u3088\u304f\u4f7f\u3063\u3066\u3044\u308b Amazon ECR \u3078 push \u3059\u308b\u4f8b\u3067\u3059\u3002<\/p>\n<p><code>docker<\/code> \u30e1\u30bd\u30c3\u30c9\u306f script \u30d6\u30ed\u30c3\u30af\u5185\u3067\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-groovy\">def repo = '123456789012.dkr.ecr.ap-northeast-1.amazonaws.com\/sample\/foo'\n\npipeline {\n  ...\n  stage('build') {\n    agent { label 'docker-host' }\n    steps {\n      \/\/ \u3042\u3089\u304b\u3058\u3081 `AWS_*` \u74b0\u5883\u5909\u6570\u3084 docker-host \u306e IAM \u7b49\u3067 awscli \u306e\u8a8d\u8a3c\u60c5\u5831\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f\n      ...\n      sh 'eval `aws ecr get-login --no-include-email --region ap-northeast-1`'\n      script {\n        def myImage = docker.build(\"${repo}:${env.BUILD_ID}\")\n        \/\/ .\/Dockerfile \u4ee5\u5916\u3092\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u6307\u5b9a\u53ef\u80fd\n        \/\/ def myImage = docker.build(\"${repo}:${env.BUILD_ID}\", \"-f Dockerfile.test\")\n\n        myImage.push()\n        myImage.push('latest') \/\/ \"${repo}:latest\" \u3068\u3057\u3066 push\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<p>\u3053\u3061\u3089\u3082\u7c21\u5358\u3067\u3059\u306d\uff01<\/p>\n<h3>GitHub Pull Request \u3092\u30d3\u30eb\u30c9\u3057\u305f\u3044<\/h3>\n<p>\u5f93\u6765\u306e\u30b8\u30e7\u30d6\u3067\u306f Github Pull Request Builder \u3092\u4f7f\u3063\u3066\u3044\u305f\u65b9\u3082\u591a\u3044\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002\u5b8c\u5168\u306b\u540c\u3058\u6a5f\u80fd\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u5411\u3051\u306b\u306f <a href=\"https:\/\/plugins.jenkins.io\/github-branch-source\">GitHub Branch Source \u30d7\u30e9\u30b0\u30a4\u30f3<\/a> \u304c\u4f7f\u3048\u307e\u3059\u3002organization \u3092\u6307\u5b9a\u3057\u3066\u304a\u3051\u3070\u30ec\u30dd\u30b8\u30c8\u30ea\u3054\u3068\u306b\u30b8\u30e7\u30d6\u3092\u4f5c\u308b\u5fc5\u8981\u306a\u304f\u3001\u81ea\u52d5\u7684\u306b Jenkinsfile \u304c\u7f6e\u3044\u3066\u3042\u308b\u30d6\u30e9\u30f3\u30c1\u3092\u30b9\u30ad\u30e3\u30f3\u3057\u3066\u30d3\u30eb\u30c9\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u65b0\u898f\u30b8\u30e7\u30d6\u306e\u4f5c\u6210\u6642\u306b GitHub Organization \u3092\u6307\u5b9a\u3057\u3001\u691c\u51fa\u6761\u4ef6\u3084 Credentials \u3092\u8a2d\u5b9a\u3059\u308b\u3060\u3051\u3067\u3059\u3002\u3082\u3061\u308d\u3093 GitHub Enterprise \u3067\u3082\u4f7f\u3048\u307e\u3059\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_githuborg-600x87.png\" alt=\"\" width=\"600\" height=\"87\" class=\"alignnone size-medium wp-image-17115\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_githuborg-600x87.png 600w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_githuborg-276x40.png 276w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_githuborg-768x111.png 768w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_githuborg-830x120.png 830w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2018\/07\/jenkins_githuborg.png 1530w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>\u8a73\u7d30\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u306f GtHub Branch Source \u3084\u65e7\u540d\u306e GitHub Organization Folder \u7b49\u3067\u691c\u7d22\u3044\u305f\u3060\u3051\u308c\u3070\u65e5\u672c\u8a9e\u8a18\u4e8b\u3092\u66f8\u304b\u308c\u3066\u3044\u308b\u65b9\u3082\u591a\u3044\u306e\u3067\u672c\u7a3f\u3067\u306f\u5272\u611b\u3044\u305f\u3057\u307e\u3059\u3002\u6587\u672b\u306e\u30ea\u30f3\u30af\u3082\u5408\u308f\u305b\u3066\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3053\u306e\u30b1\u30fc\u30b9\u3067\u306f Jenkinsfile \u5074\u306e Declarative Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u3067\u7279\u306b\u660e\u8a18\u3057\u306a\u304f\u3066\u3082\u3001\u30d3\u30eb\u30c9\u306e\u6210\u5426\u306b\u3088\u3063\u3066 Pull Request (commit) \u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u66f4\u65b0\u304c\u884c\u308f\u308c\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u30bd\u30fc\u30b9\u306e checkout \u3082\u81ea\u52d5\u7684\u306b\u884c\u308f\u308c\u307e\u3059\u3002<\/p>\n<p>\u307e\u3068\u3081\u308b\u3068\u3001Pull Request \u3092\u30d3\u30eb\u30c9\u3057\u3066\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u66f4\u65b0\u3059\u308b\u306b\u306f\u3001\u6700\u521d\u306b organization \u306b\u7d10\u3065\u304f\u30b8\u30e7\u30d6\u30921\u3064\u4f5c\u3063\u3066\u304a\u304d\u3001Jenkinsfile \u306e\u7f6e\u3044\u3066\u3042\u308b branch \u3067 Pull Request \u3059\u308c\u3070\u3088\u3044\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Jenkinsfile \u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u6700\u5c0f\u3067\u3053\u308c\u3060\u3051\u3067 OK \u3067\u3059\u3002<\/p>\n<pre><code class=\"language-groovy\">pipeline {\n  agent any\n  stages {\n    stage(\"Test\") {\n      steps {\n        sh '.\/do_test'\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<h3>\u4ed6\u306e\u30b8\u30e7\u30d6\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3057\u3066\u30d3\u30eb\u30c9\u3057\u305f\u3044<\/h3>\n<p>Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u30d3\u30eb\u30c9\u4e2d\u306b\u5f97\u3089\u308c\u305f\u5024\u3092\u7c21\u5358\u306b\u5225\u306e\u30b8\u30e7\u30d6\u306b\u6e21\u305b\u307e\u3059\u3002\u5f93\u6765\u306e\u30b8\u30e7\u30d6\u3067\u306f Parameterized Trigger \u30d7\u30e9\u30b0\u30a4\u30f3\u306a\u3069\u3092\u7528\u3044\u3066\u4e2d\u9593\u30d5\u30a1\u30a4\u30eb\u3092\u4ecb\u3059\u308b\u306a\u3069\u30ef\u30f3\u30b9\u30c6\u30c3\u30d7\u304c\u5fc5\u8981\u3067\u3057\u305f\u304c\u3001Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u4e2d\u3067\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3084\u74b0\u5883\u5909\u6570\u3092\u4f7f\u3063\u3066\u5024\u3092\u4f7f\u3044\u56de\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-groovy\">def var1 = ''\n\npipeline {\n  agent any\n  stages {\n    stage('GetVal') {\n      steps {\n        script {\n          var1 = 'string1'\n          env.VAR2 = 'string2'\n        }\n      }\n    }\n    stage('BuildOther') {\n      steps {\n        build job: 'otherjob', parameters: [\n          string(name: 'VAR1', value:  \"${var1}\"),\n          string(name: 'VAR2', value:  \"${env.VAR2}\")\n        ]\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<p>\u4ee3\u5165\u306b\u306f <code>script {}<\/code> \u304c\u5fc5\u8981\u306a\u306e\u3067\u3084\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u611f\u306f\u3067\u3066\u3057\u307e\u3046\u3082\u306e\u306e\u3001\u307e\u3042\u307e\u3042\u7c21\u5358\u3067\u3059\u3002<\/p>\n<h2>\u3055\u3044\u3054\u306b<\/h2>\n<p>\u6700\u8fd1\u306f CI\/CD as a Service \u306e\u9078\u629e\u80a2\u3082\u591a\u304f\u3001Jenkins \u3092\u7acb\u3066\u308b\u3088\u308a\u3082\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3046\u307b\u3046\u304c\u624b\u8efd\u306b\u76ee\u7684\u3092\u9054\u6210\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002Jenkins \u30b5\u30fc\u30d0\u306e\u904b\u7528\u306f\u6c7a\u3057\u3066\u697d\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u904b\u7528\u3057\u306a\u3044\u306a\u3089\u305d\u308c\u306b\u8d8a\u3057\u305f\u3053\u3068\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u8af8\u3005\u306e\u4e8b\u60c5\u306b\u3088\u308a\u4f7f\u3048\u306a\u3044\u30b1\u30fc\u30b9\u3082\u3042\u308a\u307e\u3059\u3057\u3001\u3068\u308a\u3042\u3048\u305a Jenkins \u3092\u5c0e\u5165\u3059\u308b\u969c\u58c1\u306f\u4f4e\u3044\u306e\u3067\u3001\u4eca\u3082 CI\/CD \u306e\u6709\u529b\u306a\u5019\u88dc\u3067\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b0\u30ea\u30fc\u3067\u3082 Jenkins \u306f\u591a\u304f\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u6d3b\u7528\u4e8b\u4f8b\u306f\u307e\u3060\u307e\u3060\u5c11\u306a\u3044\u3067\u3059\u3002<br \/>\n\u81ea\u5206\u3082\u307e\u3060\u4eba\u306b\u306a\u306b\u304b\u8a00\u3046\u307b\u3069 Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f7f\u3044\u3053\u3093\u3067\u306f\u3044\u307e\u305b\u3093\u304c\u3001\u4fbf\u5229\u3055\u306e\u5272\u306b\u60c5\u5831\u304c\u5c11\u306a\u3081\u304b\u306a\u3068\u611f\u3058\u307e\u3057\u305f\u306e\u3067\u3001\u3082\u3046\u3059\u3053\u3057\u5e83\u307e\u3063\u3066\u6d3b\u767a\u306b\u60c5\u5831\u304c\u6d41\u308c\u3066\u307b\u3057\u3044\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u53c2\u8003<\/h2>\n<ul>\n<li><a href=\"https:\/\/jenkins.io\/doc\/book\/pipeline\/syntax\/\">Pipeline Syntax<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/jenkinsci\/pipeline-examples\/tree\/master\/declarative-examples\">pipeline-examples\/declarative-examples at master \u00b7 jenkinsci\/pipeline-examples<\/a><\/li>\n<li><a href=\"https:\/\/jenkins.io\/doc\/book\/blueocean\/\">Blue Ocean<\/a><\/li>\n<li><a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/run\/\">docker run | Docker Documentation<\/a><\/li>\n<li><a href=\"http:\/\/www.kaizenprogrammer.com\/entry\/2017\/03\/20\/130721\">Jenkins 2.0 (4): GitHub Organization Folder - \u751f\u7523\u6027\u5411\u4e0a\u30d6\u30ed\u30b0<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u30a4\u30f3\u30d5\u30e9\u306e\u99d2\u5d0e\u3067\u3059\u3002Jenkins \u306e Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3064\u3044\u3066\u306e\u304a\u8a71\u3067\u3059\u3002 \u65e9\u901f\u3067\u3059\u304c Jenkins \u306e Pipeline \u30b9\u30af\u30ea\u30d7\u30c8\u3001\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3067\u3057\u3087\u3046\u304b\u3002 \u3082\u3057\u304b\u3057\u305f\u3089\u4ee5\u524d\u3061\u3087\u3063\u3068\u66f8\u3044\u3066\u3044\u305f\u3051\u3069\u3084 [&hellip;]<\/p>\n","protected":false},"author":158,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[42,106],"class_list":["post-17098","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-jenkins","tag-106"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/17098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/users\/158"}],"replies":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/comments?post=17098"}],"version-history":[{"count":3,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/17098\/revisions"}],"predecessor-version":[{"id":17153,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/17098\/revisions\/17153"}],"wp:attachment":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/media?parent=17098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/categories?post=17098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/tags?post=17098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}