{"id":839,"date":"2019-03-06T16:56:32","date_gmt":"2019-03-06T13:56:32","guid":{"rendered":"https:\/\/artem.services\/?p=839"},"modified":"2019-03-06T16:57:20","modified_gmt":"2019-03-06T13:57:20","slug":"jenkins-dsl-pipeline-build","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=839","title":{"rendered":"Jenkins &#8212; DSL Pipeline \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Seed Job&#8217;\u043e\u043c"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-819 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo.png\" alt=\"\" width=\"1280\" height=\"412\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo.png 1280w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-300x97.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-768x247.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-1024x330.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-954x307.png 954w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<p>\u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0443\u0449\u0438\u0435 <strong>groovy<\/strong> \u0444\u0430\u0439\u043b\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c &quot;<strong>utilities<\/strong>&quot; \u0438 \u0432 \u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b &quot;<strong>GithubPipeline.groovy<\/strong>&quot; \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre class=\"brush: groovy; title: ; notranslate\" title=\"\">\r\npackage utilities\r\n\r\nimport javaposse.jobdsl.dsl.DslFactory\r\n\r\nclass GithubPipeline {\r\n\r\n    String name\r\n    String description\r\n    String displayName\r\n    String branchesName\r\n    String urlRepo\r\n    String credentialsId\r\n\r\n\r\n\tvoid build(DslFactory dslFactory) {\r\n\t    def job = dslFactory.pipelineJob(name) {\r\n\t        description(description)\r\n\t        displayName(displayName)\r\n\t\t\tdefinition {\r\n\t\t        cpsScm {\r\n\t\t            scm {\r\n\t\t                git {\r\n\t\t                    branches(branchesName)\r\n\t\t                    remote {\r\n\t\t                        url(urlRepo)\r\n                        \t\tcredentials(credentialsId)\r\n\t\t                    }\r\n\t\t                }\r\n\t\t                scriptPath('Jenkinsfile')\r\n\t\t                lightweight(true)\r\n\t\t            }\r\n\t\t        }\r\n\t\t    }\r\n\t\t    parameters {\r\n\t\t        choiceParam ('Environment', ['staging', 'production', 'staging-without-cache'], 'Please choice env to build')\r\n\t\t    }\r\n\t\t    triggers {\r\n\t\t        bitbucketPush()\r\n\t\t    }\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <strong>Item<\/strong>&#39;\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u043a\u043e\u0440\u043d\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0444\u0430\u0439\u043b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c <strong>groovy<\/strong>, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 <strong>Seed Job<\/strong> \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043b.<\/p>\n<p><!--more--><\/p>\n<h4>pipeline-dsl.groovy<\/h4>\n<pre class=\"brush: groovy; title: ; notranslate\" title=\"\">\r\nimport utilities.GithubPipeline\r\n\r\ndef pipeline = new GithubPipeline(\r\n    description: 'Pipeline DSL',\r\n    name: 'pipeline-dsl',\r\n    displayName: 'Pipeline DSL',\r\n    branchesName: '*\/pipeline-dsl',\r\n    urlRepo: 'git@github.com:artem\/devops.git',\r\n    credentialsId: 'artem-github'\r\n).build(this)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0443\u0449\u0438\u0435 groovy \u0444\u0430\u0439\u043b\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c &quot;utilities&quot; \u0438 \u0432 \u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b &quot;GithubPipeline.groovy&quot; \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c: \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Item&#39;\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u043a\u043e\u0440\u043d\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0444\u0430\u0439\u043b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c groovy, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 Seed Job \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043b.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37],"tags":[575,39,573,125,581,583],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/839"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=839"}],"version-history":[{"count":3,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions"}],"predecessor-version":[{"id":876,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions\/876"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}