Skip to content

Commit

Permalink
chore: use pipeline tasks, use pr/main/tag release
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbo committed Jun 20, 2024
1 parent d9dadd9 commit c4688e1
Show file tree
Hide file tree
Showing 6 changed files with 342 additions and 479 deletions.
5 changes: 0 additions & 5 deletions ci/partials/restage.yml

This file was deleted.

181 changes: 40 additions & 141 deletions ci/pipeline-dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
############################
# SHARED
#@ load("funcs.lib.yml", "slack_hook")

env-cf: &env-cf
CF_API: https://api.fr.cloud.gov
Expand All @@ -9,32 +8,35 @@ env-cf: &env-cf
CF_ORG: gsa-18f-federalist
CF_SPACE: ((deploy-env))

############################
# JOBS
#! JOBS

jobs:

- name: set-pipeline
serial: true
plan:
- get: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
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-dev.yml
- set_pipeline: build-container
file: src/ci/pipeline-dev.yml
file: compiled/set-pipeline.yml
instance_vars:
deploy-env: ((deploy-env))
git-branch: ((git-branch))

- name: test-((deploy-env))
plan:
- get: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
trigger: true
passed: [set-pipeline]

- put: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
params:
path: src
status: pending
Expand All @@ -47,7 +49,7 @@ jobs:

on_success:
put: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
params:
path: src
status: success
Expand All @@ -57,28 +59,21 @@ jobs:
on_failure:
in_parallel:
- put: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
params:
path: src
status: failure
base_context: concourse
context: test-pages-build-container-((deploy-env))
- put: slack
params:
text: |
:x: FAILED: pages build container tests on ((deploy-env))
<$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))
- #@ slack_hook("failure", "tests")

- name: deploy-((deploy-env))
plan:
- get: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
trigger: true
passed: [test-((deploy-env))]
- get: cf-image
- get: general-task
- get: oci-build-task
- task: build
privileged: true
Expand All @@ -89,7 +84,7 @@ jobs:
params:
image: image/image.tar
- task: deploy
image: cf-image
image: general-task
file: src/ci/partials/deploy.yml
params:
<<: *env-cf
Expand All @@ -101,57 +96,34 @@ jobs:
CF_DOCKER_USERNAME: ((ecr-aws-key))
CF_DOCKER_PASSWORD: ((ecr-aws-secret))

on_failure:
put: slack
params:
text: |
:x: FAILED: pages build container deployment on ((deploy-env))
<$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_failure: #@ slack_hook("failure", "deployment")

- name: nightly-((deploy-env))
plan:
- get: nightly
trigger: true
- get: src
resource: pr-((git-branch))
- get: cf-image
resource: pr-((deploy-env))
- get: general-task
- get: pipeline-tasks
- task: restage
image: cf-image
file: src/ci/partials/restage.yml
image: general-task
file: pipeline-tasks/tasks/restage.yml
params:
<<: *env-cf
CF_APP_NAME: pages-build-container-((deploy-env))
on_success:
put: slack
params:
text: |
:white_check_mark: SUCCESS: pages build container nightly restage on ((deploy-env))
<$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_failure:
put: slack
params:
text: |
:x: FAILED: pages build container nightly restage on ((deploy-env))
<$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: #@ slack_hook("success", "nightly restage")
on_failure: #@ slack_hook("failure", "nightly restage")

- name: audit-dependencies
plan:
- get: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
trigger: true
passed: [set-pipeline]

- put: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
params:
path: src
status: pending
Expand All @@ -166,44 +138,29 @@ jobs:
on_failure:
in_parallel:
- put: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
params:
path: src
status: failure
base_context: concourse
context: audit-dependencies
- put: slack
params:
text: |
:x: FAILED: pages build container dependency audit on ((git-branch))
<$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME?vars.deploy-env="((deploy-env))"&vars.git-branch="((git-branch))"|View build details>
channel: ((slack-channel))
username: ((slack-username))
icon_url: ((slack-icon-url))
- #@ slack_hook("failure", "dependency audit")

on_success:
in_parallel:
- put: src
resource: pr-((git-branch))
resource: pr-((deploy-env))
params:
path: src
status: success
base_context: concourse
context: audit-dependencies
- put: slack
params:
text: |
:white_check_mark: SUCCESS: Successfully passed pages build container dependency audit on ((git-branch))
channel: ((slack-channel))
username: ((slack-username))
icon_url: ((slack-icon-url))
- #@ slack_hook("success", "dependency audit")

############################
# RESOURCES
#! RESOURCES

resources:

- name: pr-((git-branch))
- name: pr-((deploy-env))
type: pull-request
check_every: 1m
source:
Expand All @@ -220,11 +177,6 @@ resources:
stop: 1:00 AM
location: America/New_York

- name: slack
type: slack-notification
source:
url: ((slack-webhook-url))

- name: image-repository
type: registry-image
source:
Expand All @@ -234,70 +186,17 @@ resources:
aws_region: us-gov-west-1
tag: pages-((deploy-env))

- name: slack
- name: pipeline-tasks
- name: python
type: registry-image
source:
aws_access_key_id: ((ecr-aws-key))
aws_secret_access_key: ((ecr-aws-secret))
repository: pages-python-v3.11
aws_region: us-gov-west-1
tag: latest

- name: cf-image
type: registry-image
source:
aws_access_key_id: ((ecr-aws-key))
aws_secret_access_key: ((ecr-aws-secret))
repository: general-task
aws_region: us-gov-west-1
tag: latest

- name: general-task
- name: oci-build-task
type: registry-image
source:
aws_access_key_id: ((ecr-aws-key))
aws_secret_access_key: ((ecr-aws-secret))
repository: oci-build-task
aws_region: us-gov-west-1
tag: latest

############################
# RESOURCE TYPES
#! RESOURCE TYPES

resource_types:

- name: git
- name: slack-notification
type: registry-image
source:
aws_access_key_id: ((ecr_aws_key))
aws_secret_access_key: ((ecr_aws_secret))
repository: slack-notification-resource
aws_region: us-gov-west-1
tag: latest

- name: pull-request
type: registry-image
source:
aws_access_key_id: ((ecr_aws_key))
aws_secret_access_key: ((ecr_aws_secret))
repository: github-pr-resource
aws_region: us-gov-west-1
tag: latest

- name: time
type: registry-image
source:
aws_access_key_id: ((ecr_aws_key))
aws_secret_access_key: ((ecr_aws_secret))
repository: time-resource
aws_region: us-gov-west-1
tag: latest

- name: registry-image
type: registry-image
source:
aws_access_key_id: ((ecr_aws_key))
aws_secret_access_key: ((ecr_aws_secret))
repository: registry-image-resource
aws_region: us-gov-west-1
tag: latest
Loading

0 comments on commit c4688e1

Please sign in to comment.