diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 8fa7cce..fdb898c 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -1,159 +1,108 @@ -############################ -# SHARED - -email-cf: &email-cf - CF_API: https://api.fr.cloud.gov - CF_USERNAME: ((email-cf-username)) - CF_PASSWORD: ((email-cf-password)) - CF_ORG: gsa-18f-federalist - CF_SPACE: email - CF_APP_NAME: pages-mailer - CF_STACK: cflinuxfs4 +#! SHARED test: &test -- task: install-deps - image: node - file: src/ci/partials/install-deps.yml - -- in_parallel: - - task: test + - task: install-deps image: node - file: src/ci/partials/test.yml + file: src/ci/partials/install-deps.yml - - task: lint - image: node - file: src/ci/partials/lint.yml + - in_parallel: + - task: test + image: node + file: src/ci/partials/test.yml + - task: lint + image: node + file: src/ci/partials/lint.yml -############################ -# JOBS +#! JOBS jobs: + - name: test + plan: + - get: src + resource: pr + trigger: true + version: every + - put: #@ pr_hook("pending", "test") + + - get: node + - get: general-task + + - do: *test + + on_failure: #@ pr_hook("failure", "test") + on_success: #@ pr_hook("success", "test") -- name: test - plan: - - get: src - resource: pr - trigger: true - version: every - - - put: src - resource: pr - params: - path: src - status: pending - base_context: concourse - context: test - - - get: node - - get: general-task - - - do: *test - - on_failure: - put: src - resource: pr - params: - path: src - status: failure - base_context: concourse - context: test - - on_success: - put: src - resource: pr - params: - path: src - status: success - base_context: concourse - context: test - -- name: deploy - plan: - - get: src - resource: src - trigger: true - passed: [set-pipeline] - params: {depth: 1} - - - get: node - - get: general-task - - get: pipeline-tasks - - - do: *test - - - task: deploy - image: general-task - file: src/ci/partials/deploy.yml - params: - <<: *email-cf - - on_failure: - try: - task: cancel-deployment + - name: deploy + plan: + - get: src + resource: src + trigger: true + passed: [set-pipeline] + params: { depth: 1 } + + - get: node + - get: general-task + - get: pipeline-tasks + + - do: *test + + - task: deploy + image: general-task + file: src/ci/partials/deploy.yml + params: + _: #@ template.replace(data.values.env_cf_email) + CF_APP_NAME: pages-mailer + + on_failure: + try: + task: cancel-deployment + image: general-task + file: pipeline-tasks/tasks/cancel-deployment.yml + params: + _: #@ template.replace(data.values.env_cf_email) + CF_APP_NAME: pages-mailer + + on_failure: #@ slack_hook("failure", "deploy") + on_success: #@ slack_hook("success", "deploy") + + - name: restage + plan: + - get: src + resource: src + passed: [set-pipeline] + params: { depth: 1 } + - get: general-task + - get: pipeline-tasks + - get: nightly + trigger: true + + - task: restage image: general-task - file: pipeline-tasks/tasks/cancel-deployment.yml + file: pipeline-tasks/tasks/restage.yml params: - <<: *email-cf - - on_failure: - put: slack - params: - text: | - :x: FAILED: pages mailer deployment - <$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME|View build details> - channel: ((slack-channel)) - username: ((slack-username)) - icon_url: ((slack-icon-url)) - - on_success: - put: slack - params: - text: | - :white_check_mark: SUCCESS: Successfully deployed pages mailer - <$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME|View build details> - channel: ((slack-channel)) - username: ((slack-username)) - icon_url: ((slack-icon-url)) - -- name: restage - plan: - - get: src - resource: src - passed: [set-pipeline] - params: {depth: 1} - - get: general-task - - get: pipeline-tasks - - get: nightly - trigger: true - - - task: restage - image: general-task - file: pipeline-tasks/tasks/restage.yml - params: - <<: *email-cf - -- name: set-pipeline - serial: true - plan: - - get: src - params: {depth: 1} - trigger: true - - get: pipeline-tasks - - get: general-task - - task: init - image: general-task - file: pipeline-tasks/tasks/init.yml - params: - PIPELINE_YML: src/ci/pipeline.yml - - set_pipeline: mailer - file: compiled/set-pipeline.yml - -############################ -# RESOURCES + _: #@ template.replace(data.values.env_cf_email) + CF_APP_NAME: pages-mailer + + - name: set-pipeline + serial: true + plan: + - get: src + params: { depth: 1 } + trigger: true + - get: pipeline-tasks + - get: general-task + - task: init + image: general-task + file: pipeline-tasks/tasks/init.yml + params: + PIPELINE_YML: src/ci/pipeline.yml + - set_pipeline: mailer + file: compiled/set-pipeline.yml -resources: +#! RESOURCES +resources: - name: pr type: pull-request check_every: 1m @@ -172,12 +121,6 @@ resources: branch: main commit_verification_keys: ((cloud-gov-pages-gpg-keys)) - - name: pipeline-tasks - type: git - source: - uri: ((pipeline-tasks-git-url)) - branch: main - - name: nightly type: time source: @@ -185,12 +128,12 @@ resources: stop: 1:00 AM location: America/New_York + - name: pipeline-tasks - name: slack - name: node - name: general-task -############################ -# RESOURCE TYPES +#! RESOURCE TYPES resource_types: - name: git