diff --git a/README.md b/README.md index cd48550..92fd970 100644 --- a/README.md +++ b/README.md @@ -197,24 +197,19 @@ We use Concourse CI for our CI/CD system. To use Concourse, one must have approp 2. Update local credential files (see ci/vars/example.yml) #### CI deployments -This repository contains two distinct deployment pipelines in concourse: -- [__build-container__](./ci/pipeline.yml) -- [__build-container dev__](./ci/pipeline-dev.yml) +This repository contains three distinct deployment pipelines in concourse: +- [__build-container production__](./ci/pipeline-production.yml); starts on a new tag pushed to the `main` branch +- [__build-container staging__](./ci/pipeline-staging.yml); starts on a new commit pushed to the `main` branch. +- [__build-container dev__](./ci/pipeline-dev.yml); starts when a PR is created into the `main` branch. -__build-container__ creates the site build container image, pushes it to ECR, and then deploys the image for the build container app. +Each pipeline runs tests, creates the appropriate site build container image, pushes it to ECR, and then deploys the image for the build container app. -__*↓ NOTICE ↓*__ - -> __build-container dev__ deploys the Pages app/api, the admin app, and the queues app when a PR is created into the `staging` branch. This uses a unique pipeline file: [./ci/pipeline-dev.yml](./ci/pipeline-dev.yml) - -#### Deployment ##### Pipeline instance variables Three instances of the pipeline are set for the `pages dev`, `pages staging` and `pages production` environments. Instance variables are used to fill in Concourse pipeline parameter variables bearing the same name as the instance variable. See more on [Concourse vars](https://concourse-ci.org/vars.html). Each instance of the pipeline has three instance variables associated to it: `deploy-env`, `git-branch`. |Instance Variable|Pages Dev|Pages Staging|Pages Production| --- | --- | ---| ---| |**`deploy-env`**|`dev`|`staging`|`production`| -|**`git-branch`**|`staging`|`staging`|`main`| ## Public domain diff --git a/ci/pipeline-dev.yml b/ci/pipeline-dev.yml index 2163610..460fdf4 100644 --- a/ci/pipeline-dev.yml +++ b/ci/pipeline-dev.yml @@ -1,12 +1,7 @@ --- #@ load("funcs.lib.yml", "slack_hook") - -env-cf: &env-cf - CF_API: https://api.fr.cloud.gov - CF_USERNAME: ((((deploy-env))-cf-username)) - CF_PASSWORD: ((((deploy-env))-cf-password)) - CF_ORG: gsa-18f-federalist - CF_SPACE: ((deploy-env)) +#@ load("@ytt:data", "data") +#@ load("@ytt:template", "template") #! JOBS @@ -87,7 +82,7 @@ jobs: image: general-task file: src/ci/partials/deploy.yml params: - <<: *env-cf + _: #@ template.replace(data.values.env_cf) CF_APP_NAME: pages-build-container-((deploy-env)) CF_MANIFEST: .cloudgov/manifest.yml CF_VARS_FILE: .cloudgov/vars/pages-((deploy-env)).yml @@ -98,23 +93,6 @@ jobs: on_failure: #@ slack_hook("failure", "deployment") - - name: nightly-((deploy-env)) - plan: - - get: nightly - trigger: true - - get: src - resource: pr-((deploy-env)) - - get: general-task - - get: pipeline-tasks - - task: restage - image: general-task - file: pipeline-tasks/tasks/restage.yml - params: - <<: *env-cf - CF_APP_NAME: pages-build-container-((deploy-env)) - on_success: #@ slack_hook("success", "nightly restage") - on_failure: #@ slack_hook("failure", "nightly restage") - - name: audit-dependencies plan: - get: src @@ -170,13 +148,6 @@ resources: disable_forks: true ignore_drafts: false - - name: nightly - type: time - source: - start: 12:00 AM - stop: 1:00 AM - location: America/New_York - - name: image-repository type: registry-image source: @@ -198,5 +169,4 @@ resource_types: - name: git - name: slack-notification - name: pull-request - - name: time - name: registry-image diff --git a/ci/pipeline-production.yml b/ci/pipeline-production.yml index cd835a0..9a701ff 100644 --- a/ci/pipeline-production.yml +++ b/ci/pipeline-production.yml @@ -1,12 +1,7 @@ --- #@ load("funcs.lib.yml", "slack_hook") - -env-cf: &env-cf - CF_API: https://api.fr.cloud.gov - CF_USERNAME: ((((deploy-env))-cf-username)) - CF_PASSWORD: ((((deploy-env))-cf-password)) - CF_ORG: gsa-18f-federalist - CF_SPACE: ((deploy-env)) +#@ load("@ytt:data", "data") +#@ load("@ytt:template", "template") #! JOBS @@ -62,7 +57,7 @@ jobs: image: general-task file: src/ci/partials/deploy.yml params: - <<: *env-cf + _: #@ template.replace(data.values.env_cf) CF_APP_NAME: pages-build-container-((deploy-env)) CF_MANIFEST: .cloudgov/manifest.yml CF_VARS_FILE: .cloudgov/vars/pages-((deploy-env)).yml @@ -74,24 +69,6 @@ jobs: on_success: #@ slack_hook("success", "deployment") on_failure: #@ slack_hook("failure", "deployment") - - name: nightly-((deploy-env)) - plan: - - get: nightly - trigger: true - - get: src - resource: src-((deploy-env))-tagged - trigger: true - params: { depth: 1 } - - get: general-task - - task: restage - image: general-task - file: src/ci/partials/restage.yml - params: - <<: *env-cf - CF_APP_NAME: pages-build-container-((deploy-env)) - on_success: #@ slack_hook("success", "nightly restage") - on_failure: #@ slack_hook("failure", "nightly restage") - - name: audit-dependencies plan: - get: src @@ -120,13 +97,6 @@ resources: tag_filter: 0.*.* fetch_tags: true - - name: nightly - type: time - source: - start: 12:00 AM - stop: 1:00 AM - location: America/New_York - - name: image-repository type: registry-image source: @@ -148,5 +118,4 @@ resource_types: - name: git - name: slack-notification - name: pull-request - - name: time - name: registry-image diff --git a/ci/pipeline-staging.yml b/ci/pipeline-staging.yml index 13fe41f..919f683 100644 --- a/ci/pipeline-staging.yml +++ b/ci/pipeline-staging.yml @@ -1,12 +1,7 @@ --- #@ load("funcs.lib.yml", "slack_hook") - -env-cf: &env-cf - CF_API: https://api.fr.cloud.gov - CF_USERNAME: ((((deploy-env))-cf-username)) - CF_PASSWORD: ((((deploy-env))-cf-password)) - CF_ORG: gsa-18f-federalist - CF_SPACE: ((deploy-env)) +#@ load("@ytt:data", "data") +#@ load("@ytt:template", "template") #! JOBS @@ -62,7 +57,7 @@ jobs: image: general-task file: src/ci/partials/deploy.yml params: - <<: *env-cf + _: #@ template.replace(data.values.env_cf) CF_APP_NAME: pages-build-container-((deploy-env)) CF_MANIFEST: .cloudgov/manifest.yml CF_VARS_FILE: .cloudgov/vars/pages-((deploy-env)).yml @@ -74,24 +69,6 @@ jobs: on_success: #@ slack_hook("success", "deployment") on_failure: #@ slack_hook("failure", "deployment") - - name: nightly-((deploy-env)) - plan: - - get: nightly - trigger: true - - get: src - resource: src-((deploy-env)) - trigger: true - params: { depth: 1 } - - get: general-task - - task: restage - image: general-task - file: src/ci/partials/restage.yml - params: - <<: *env-cf - CF_APP_NAME: pages-build-container-((deploy-env)) - on_success: #@ slack_hook("success", "nightly restage") - on_failure: #@ slack_hook("failure", "nightly restage") - - name: audit-dependencies plan: - get: src @@ -118,13 +95,6 @@ resources: branch: main commit_verification_keys: ((cloud-gov-pages-gpg-keys)) - - name: nightly - type: time - source: - start: 12:00 AM - stop: 1:00 AM - location: America/New_York - - name: image-repository type: registry-image source: @@ -146,5 +116,4 @@ resource_types: - name: git - name: slack-notification - name: pull-request - - name: time - name: registry-image