-
Notifications
You must be signed in to change notification settings - Fork 24
/
pipeline.yml
164 lines (144 loc) · 3.73 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
#@ load("funcs.lib.yml", "slack_hook", "pr_hook")
#@ load("@ytt:data", "data")
#@ load("@ytt:template", "template")
#@ env = data.values.env
#! SHARED
test-redirects: &test-redirects
- task: install-dependencies
image: node
file: pipeline-tasks/tasks/run-command.yml
params:
COMMAND: npm install
- task: build
image: node
file: pipeline-tasks/tasks/run-command.yml
params:
COMMAND: npm run build
- task: test-redirects
image: dind
privileged: true
file: src/ci/partials/test-redirects.yml
#! JOBS
jobs:
- name: set-pipeline
plan:
- get: src
params:
#@ if/end env != 'test':
params: { depth: 1 }
#@ if/end env == 'test':
integration_tool: checkout
trigger: true
- get: pipeline-tasks
- get: general-task
- task: boot
image: general-task
file: pipeline-tasks/tasks/boot.yml
params:
ENV_OVERRIDE: ((deploy-env))
- set_pipeline: self
file: compiled/set-pipeline.yml
instance_vars:
deploy-env: ((deploy-env))
#@ if/end env == 'test':
- name: test-redirects
plan:
- get: src
passed: [set-pipeline]
trigger: true
version: every
- #@ pr_hook("pending", "run-tests")
- get: pipeline-tasks
- get: node
- get: dind
- do: *test-redirects
on_failure:
in_parallel:
- #@ pr_hook("failure", "run-tests")
- #@ slack_hook("failure", "tests")
on_success:
in_parallel:
- #@ pr_hook("success", "run-tests")
- #@ slack_hook("success", "tests")
#@ if env == 'deploy':
- name: test-and-deploy-redirects
plan:
- get: src
passed: [set-pipeline]
trigger: true
- get: pipeline-tasks
- get: general-task
- get: node
- get: dind
- do: *test-redirects
- task: deploy
image: general-task
file: src/ci/partials/deploy.yml
params:
_: #@ template.replace(data.values.env_cf_redirects)
CF_MANIFEST: src/out/manifest-prod.yml
CF_PATH: src/out
on_failure:
try:
task: cancel-api-deployment
image: general-task
file: pipeline-tasks/tasks/cancel-deployment.yml
params:
_: #@ template.replace(data.values.env_cf_redirects)
on_failure: #@ slack_hook("failure", "deployment")
on_success: #@ slack_hook("success", "deployment")
- name: nightly-restage
plan:
- get: src
passed: [set-pipeline]
- get: nightly
trigger: true
- get: general-task
- get: pipeline-tasks
- task: restage
image: general-task
file: pipeline-tasks/tasks/restage.yml
params:
_: #@ template.replace(data.values.env_cf_redirects)
CF_APP_NAME: pages-redirects
#@ end
#! RESOURCES
resources:
#@ if/end env == 'test':
- name: src
type: pull-request
check_every: 1m
source:
repository: cloud-gov/pages-redirects
access_token: ((gh-access-token))
base_branch: main
disable_forks: true
ignore_drafts: false
#@ if env == 'deploy':
- name: src
type: git
icon: github
source:
uri: https://github.com/cloud-gov/pages-redirects
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
#@ end
- name: slack
- name: node
- name: general-task
- name: dind
- name: pipeline-tasks
#! RESOURCE TYPES
resource_types:
- name: git
- name: slack-notification
- name: pull-request
- name: time
- name: registry-image