# Check `docs/pipeline.md` to get info about this file resource_types: <% unless @slack.nil? or @slack.empty? -%> - name: slack-notification type: docker-image source: repository: cfcommunity/slack-notification-resource tag: latest <% end -%> - name: pull-request type: docker-image source: repository: jtarchie/pr resources: - name: <%= @name %>-repository type: git source: uri: <%= @git %> branch: master private_key: ((git_private_key)) - name: pull-requests type: pull-request source: access_token: ((github_token)) base: master private_key: ((git_private_key)) repo: <%= @git.gsub(/(.*:|.git)/, '').split('/').last(2).join('/') %> uri: <%= @git %> - name: <%= @name %>-image type: docker-image source: repository: <%= @image %> username: _json_key password: ((gcr_password)) <% unless @slack.nil? or @slack.empty? -%> - name: slack-alert type: slack-notification source: url: https://hooks.slack.com/services/((slack_webhook)) <% end -%> jobs: - name: pr-build plan: - get: pull-requests trigger: true - task: tag file: pull-requests/<%= @output %>/pipelines/tasks/create-pull-requests-tag.yml - put: <%= @name %>-image params: build: pull-requests tag: tag/name - name: pr-unit serial: true plan: - get: pull-requests passed: [pr-build] trigger: true - get: <%= @name %>-image passed: [pr-build] trigger: true - put: pull-requests params: path: pull-requests status: pending - task: run-tests file: pull-requests/<%= @output %>/pipelines/tasks/run-pr-tests.yml on_success: do: - put: pull-requests params: path: pull-requests status: success <% unless @slack.nil? or @slack.empty? -%> - put: slack-alert params: channel: '#<%= @slack %>' text: | <%= @name %> PR tests have passed! :thumbsup_all: Check it out at: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME or at: $ATC_EXTERNAL_URL/builds/$BUILD_ID see on github: `cat pull-requests/.git/url` <% end -%> on_failure: do: - put: pull-requests params: path: pull-requests status: failure <% unless @slack.nil? or @slack.empty? -%> - put: slack-alert params: channel: '#<%= @slack %>' text: | <%= @name %> PR tests have failed! :thumbsdown_all: Check it out at: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME or at: $ATC_EXTERNAL_URL/builds/$BUILD_ID see on github: `cat pull-requests/.git/url` <% end -%> - name: master-build serial: true plan: - get: <%= @name %>-repository trigger: true - task: tag file: <%= @name %>-repository/<%= @output %>/pipelines/tasks/create-repository-tag.yml - put: <%= @name %>-image params: build: <%= @name %>-repository tag: tag/name <% unless @slack.nil? or @slack.empty? -%> - put: slack-alert params: channel: '#<%= @slack %>' text: | <%= @name %> master branch was built and pushed! Check it out at: $ATC_EXTERNAL_URL/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME or at: $ATC_EXTERNAL_URL/builds/$BUILD_ID <% end -%> - name: master-unit serial: true plan: - get: <%= @name %>-repository passed: [master-build] trigger: true - get: <%= @name %>-image passed: [master-build] trigger: true - task: run-tests file: <%= @name %>-repository/<%= @output %>/pipelines/tasks/run-master-tests.yml <% unless @slack.nil? or @slack.empty? -%> on_success: put: slack-alert params: channel: '#<%= @slack %>' text: | <%= @name %> master tests have passed! :thumbsup_all: Check it out at: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME or at: $ATC_EXTERNAL_URL/builds/$BUILD_ID on_failure: put: slack-alert params: channel: '#<%= @slack %>' text: | <%= @name %> master tests have failed! :thumbsdown_all: Check it out at: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME or at: $ATC_EXTERNAL_URL/builds/$BUILD_ID <% end -%> - name: helm-deploy serial: true plan: - get: <%= @name %>-repository - task: helm-deploy file: <%= @name %>-repository/<%= @output %>/pipelines/tasks/helm-deploy.yml params: GOOGLE_APPLICATION_JSON: ((gcr_password)) KUBECONFIG_FILE: ((kubeconfig)) <% unless @slack.nil? or @slack.empty? -%> on_success: put: slack-alert params: channel: '#<%= @slack %>' text: | <%= @name %> deployment has succeeded! :thumbsup_all: Check it out at: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME or at: $ATC_EXTERNAL_URL/builds/$BUILD_ID <% end -%>