@@ -117,11 +117,20 @@ jobs:
117117 name : build-artifacts
118118 path : dist
119119
120+ - name : Install zip
121+ run : sudo apt-get install zip
122+
123+ - name : Setup Python environment
124+ run : |
125+ poetry install --no-root
126+ source $(poetry env info --path)/bin/activate
127+
120128 - name : Terraform Init
121129 run : |
130+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }})
122131 terraform -chdir=terraform/infrastructure init
123- terraform -chdir=terraform/infrastructure workspace new ${{ inputs.environment } } || \
124- terraform -chdir=terraform/infrastructure workspace select ${{ inputs.environment } }
132+ terraform -chdir=terraform/infrastructure workspace new ${inactive_stack } || \
133+ terraform -chdir=terraform/infrastructure workspace select ${inactive_stack }
125134
126135 - name : Terraform Plan
127136 run : |
@@ -180,11 +189,152 @@ jobs:
180189 account=$(echo '${{ inputs.environment }}' | cut -d '-' -f1)
181190 make truststore-pull-server ENV=${account}
182191
192+ - name : Install zip
193+ run : sudo apt-get install zip
194+
195+ - name : Setup Python environment
196+ run : |
197+ poetry install --no-root
198+ source $(poetry env info --path)/bin/activate
199+
183200 - name : Terraform Init
184201 run : |
202+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }})
185203 terraform -chdir=terraform/infrastructure init
186- terraform -chdir=terraform/infrastructure workspace new ${{ inputs.environment } } || \
187- terraform -chdir=terraform/infrastructure workspace select ${{ inputs.environment } }
204+ terraform -chdir=terraform/infrastructure workspace new ${inactive_stack } || \
205+ terraform -chdir=terraform/infrastructure workspace select ${inactive_stack }
188206
189207 - name : Terraform Apply
190208 run : terraform -chdir=terraform/infrastructure apply tfplan
209+
210+ - name : Smoke Test
211+ run : make ENV=${{ inputs.environment }} test-smoke-internal
212+
213+ activate-stack :
214+ name : Activate - ${{ inputs.environment }}
215+ needs : [terraform-apply]
216+ runs-on : [self-hosted, ci]
217+ environment : ${{ inputs.environment }}
218+
219+ steps :
220+ - name : Git clone - ${{ inputs.branch_name }}
221+ uses : actions/checkout@v4
222+ with :
223+ ref : ${{ inputs.branch_name }}
224+
225+ - name : Setup asdf cache
226+ uses : actions/cache@v4
227+ with :
228+ path : ~/.asdf
229+ key : ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
230+ restore-keys : |
231+ ${{ runner.os }}-asdf-
232+
233+ - name : Install asdf
234+ uses :
asdf-vm/actions/[email protected] 235+
236+ - name : Configure Management Credentials
237+ uses : aws-actions/configure-aws-credentials@v4
238+ with :
239+ aws-region : eu-west-2
240+ role-to-assume : ${{ secrets.MGMT_ROLE_ARN }}
241+ role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
242+
243+ - name : Install zip
244+ run : sudo apt-get install zip
245+
246+ - name : Setup Python environment
247+ run : |
248+ poetry install --no-root
249+ source $(poetry env info --path)/bin/activate
250+
251+ - name : Activate Stack
252+ run : |
253+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }})
254+ poetry run python ./scripts/activate_stack.py ${inactive_stack} ${{ inputs.environment }}
255+
256+ post-release-verify :
257+ name : Verify - ${{ inputs.environment }}
258+ needs : [activate-stack]
259+ runs-on : [self-hosted, ci]
260+ environment : ${{ inputs.environment }}
261+
262+ steps :
263+ - name : Git clone - ${{ inputs.branch_name }}
264+ uses : actions/checkout@v4
265+ with :
266+ ref : ${{ inputs.branch_name }}
267+
268+ - name : Setup asdf cache
269+ uses : actions/cache@v4
270+ with :
271+ path : ~/.asdf
272+ key : ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
273+ restore-keys : |
274+ ${{ runner.os }}-asdf-
275+
276+ - name : Install asdf
277+ uses :
asdf-vm/actions/[email protected] 278+
279+ - name : Configure Management Credentials
280+ uses : aws-actions/configure-aws-credentials@v4
281+ with :
282+ aws-region : eu-west-2
283+ role-to-assume : ${{ secrets.MGMT_ROLE_ARN }}
284+ role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
285+
286+ - name : Install zip
287+ run : sudo apt-get install zip
288+
289+ - name : Setup Python environment
290+ run : |
291+ poetry install --no-root
292+ source $(poetry env info --path)/bin/activate
293+
294+ - name : " Smoke Test"
295+ run : |
296+ make ENV=${{ inputs.environment }} test-smoke-external
297+
298+ rollback-stack :
299+ name : Rollback - ${{ inputs.environment }}
300+ needs : [post-release-verify]
301+ if : ${{ needs.post-release-verify.result == 'failure' }}
302+ runs-on : [self-hosted, ci]
303+ environment : ${{ inputs.environment }}
304+
305+ steps :
306+ - name : Git clone - ${{ inputs.branch_name }}
307+ uses : actions/checkout@v4
308+ with :
309+ ref : ${{ inputs.branch_name }}
310+
311+ - name : Setup asdf cache
312+ uses : actions/cache@v4
313+ with :
314+ path : ~/.asdf
315+ key : ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
316+ restore-keys : |
317+ ${{ runner.os }}-asdf-
318+
319+ - name : Install asdf
320+ uses :
asdf-vm/actions/[email protected] 321+
322+ - name : Configure Management Credentials
323+ uses : aws-actions/configure-aws-credentials@v4
324+ with :
325+ aws-region : eu-west-2
326+ role-to-assume : ${{ secrets.MGMT_ROLE_ARN }}
327+ role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
328+
329+ - name : Install zip
330+ run : sudo apt-get install zip
331+
332+ - name : Setup Python environment
333+ run : |
334+ poetry install --no-root
335+ source $(poetry env info --path)/bin/activate
336+
337+ - name : Deactivate Stack
338+ run : |
339+ inactive_stack_name=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }})
340+ poetry run python ./scripts/activate-stack.py ${inactive_stack_name}
0 commit comments