-
Notifications
You must be signed in to change notification settings - Fork 5
241 lines (230 loc) · 8.71 KB
/
Copy pathstage-3-build.yaml
File metadata and controls
241 lines (230 loc) · 8.71 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: "Build stage"
on:
workflow_call:
inputs:
build_datetime:
description: "Build datetime, set by the CI/CD pipeline workflow"
required: true
type: string
build_timestamp:
description: "Build timestamp, set by the CI/CD pipeline workflow"
required: true
type: string
build_epoch:
description: "Build epoch, set by the CI/CD pipeline workflow"
required: true
type: string
nodejs_version:
description: "Node.js version, set by the CI/CD pipeline workflow"
required: true
type: string
python_version:
description: "Python version, set by the CI/CD pipeline workflow"
required: true
type: string
terraform_version:
description: "Terraform version, set by the CI/CD pipeline workflow"
required: true
type: string
version:
description: "Version of the software, set by the CI/CD pipeline workflow"
required: true
type: string
pr_number:
description: "PR Number if it exists"
required: false
type: string
deploy_proxy:
description: "True if the APIM proxy should be deployed"
required: true
type: string
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
packages: read # This is required for downloading from GitHub Package Registry
jobs:
artefact-jekyll-docs:
name: "Build Docs"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "Build docs"
uses: ./.github/actions/build-docs
with:
version: "${{ inputs.version }}"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
artefact-oas-spec-main:
name: "Build OAS spec for main"
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
needs: [artefact-jekyll-docs]
timeout-minutes: 10
strategy:
matrix:
apimEnv: [internal-dev-pr, internal-dev, int, ref, prod]
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "Build OAS spec"
uses: ./.github/actions/build-oas-spec
with:
version: "${{ inputs.version }}"
apimEnv: "${{ matrix.apimEnv }}"
buildSandbox: false
nodejs_version: ${{ inputs.nodejs_version }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
artefact-oas-spec-pr:
name: "Build OAS spec for PR"
if: (inputs.pr_number != '')
runs-on: ubuntu-latest
needs: [artefact-jekyll-docs]
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "Build OAS spec"
uses: ./.github/actions/build-oas-spec
with:
version: "${{ inputs.version }}"
apimEnv: internal-dev-pr
buildSandbox: false
nodejs_version: ${{ inputs.nodejs_version }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
artefact-oas-spec-sandbox:
name: "Build OAS spec for sandbox"
runs-on: ubuntu-latest
needs: [artefact-jekyll-docs]
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "Build proxies"
uses: ./.github/actions/build-oas-spec
with:
version: "${{ inputs.version }}"
apimEnv: "internal-dev-sandbox"
buildSandbox: true
nodejs_version: ${{ inputs.nodejs_version }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
artefact-oas-spec:
name: "OAS spec ready"
runs-on: ubuntu-latest
needs: [artefact-oas-spec-pr, artefact-oas-spec-main]
if: always() && !failure()
steps:
- run: echo "OAS spec build complete"
artefact-sdks:
name: "Build SDKs"
runs-on: ubuntu-latest
if: always() && !failure()
needs: [artefact-oas-spec]
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "Build sdks"
uses: ./.github/actions/build-sdk
with:
version: "${{ inputs.version }}"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Take out for now - might add again in the future
# artefact-servers:
# name: "Build servers"
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - name: "Build servers"
# uses: ./.github/actions/build-server
# with:
# version: "${{ inputs.version }}"
# artefact-libs:
# name: "Build libs"
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - name: "Build servers"
# uses: ./.github/actions/build-libraries
# with:
# version: "${{ inputs.version }}"
pr-create-dynamic-environment:
name: Create Dynamic Environment
runs-on: ubuntu-latest
outputs:
environment_name: ${{ steps.set-environment.outputs.environment_name }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set environment name
id: set-environment
run: echo "environment_name=${{ inputs.pr_number != '' && format('pr{0}', inputs.pr_number) || 'main' }}" >> $GITHUB_OUTPUT
- name: Trigger dynamic environment creation
env:
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
PR_NUMBER: ${{ inputs.pr_number }}
shell: bash
run: |
.github/scripts/dispatch_internal_repo_workflow.sh \
--infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \
--releaseVersion ${{ github.head_ref || github.ref_name }} \
--targetWorkflow "dispatch-deploy-dynamic-env.yaml" \
--targetEnvironment "${{ steps.set-environment.outputs.environment_name }}" \
--targetComponent "api" \
--targetAccountGroup "nhs-notify-supplier-api-dev" \
--terraformAction "apply" \
--overrideProjectName "nhs" \
--overrideRoleName "nhs-main-acct-supplier-api-github-deploy"
populate-config:
name: "Populate Supplier Config"
runs-on: ubuntu-latest
needs: [pr-create-dynamic-environment]
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set Environment Name
id: set-environment
run: echo "environment_name=${{ inputs.pr_number != '' && format('pr{0}', inputs.pr_number) || 'main' }}" >> $GITHUB_OUTPUT
- name: "Trigger populate config workflow in internal repo"
env:
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
PR_NUMBER: ${{ inputs.pr_number }}
shell: bash
run: |
.github/scripts/dispatch_internal_repo_workflow.sh \
--infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \
--releaseVersion ${{ github.head_ref || github.ref_name }} \
--targetWorkflow "publish-supplier-config-to-ddb.yaml" \
--targetEnvironment "${{ steps.set-environment.outputs.environment_name }}" \
--targetComponent "config" \
--targetAccountGroup "nhs-notify-suppliers-dev" \
--tableName "supplier-config" \
--force "true"
artefact-proxies:
name: "Build proxies"
runs-on: ubuntu-latest
if: always() && !failure() && inputs.deploy_proxy == 'true'
needs: [artefact-oas-spec, pr-create-dynamic-environment]
timeout-minutes: 10
env:
PROXYGEN_API_NAME: nhs-notify-supplier
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "Build proxies"
uses: ./.github/actions/build-proxies
with:
version: "${{ inputs.version }}"
environment: ${{ needs.pr-create-dynamic-environment.outputs.environment_name }}
apimEnv: "${{ inputs.pr_number == '' && 'internal-dev' || 'internal-dev-pr' }}"
runId: "${{ github.run_id }}"
buildSandbox: true
releaseVersion: ${{ github.head_ref || github.ref_name }}