-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (90 loc) · 3.51 KB
/
workflow_path_to_live.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
name: "[Workflow] Path to Live"
concurrency:
group: ${{ github.workflow }}
on:
push:
branches:
- main
defaults:
run:
shell: bash
jobs:
branch_name:
name: "Generate a safe branch name"
uses: ministryofjustice/opg-github-workflows/.github/workflows/data-parse-branch-name.yml@main
set_variables:
name: output workflow variables
runs-on: ubuntu-latest
outputs:
environment_terraform_version: ${{ steps.terraform_version_environment.outputs.version }}
semver_tag: ${{ steps.semver_tag.outputs.created_tag }}
steps:
- name: Set terraform version - environment
id: terraform_version_environment
uses: ministryofjustice/opg-github-actions/.github/actions/[email protected]
with:
terraform_directory: "./terraform/environment"
- name: "Semver tag"
id: semver_tag
uses: ministryofjustice/opg-github-actions/.github/actions/[email protected]
with:
prerelease: true
with_v: true
github_token: ${{ secrets.GITHUB_TOKEN }}
docker_build_scan_push:
name: Build, Scan and Push
needs:
- set_variables
- branch_name
uses: ./.github/workflows/_docker_build_scan_push.yml
with:
branch_name: ${{ needs.branch_name.outputs.safe }}
semver_tag: ${{ needs.set_variables.outputs.semver_tag }}
secrets: inherit # pragma: allowlist secret
terraform_preprod_environment_apply:
name: Terraform - Preproduction - Environment - Apply
needs:
- set_variables
- docker_build_scan_push
uses: ministryofjustice/opg-github-workflows/.github/workflows/[email protected]
with:
terraform_version: ${{ needs.set_variables.outputs.environment_terraform_version }}
terraform_directory: "./terraform/environment"
terraform_workspace: preproduction
is_ephemeral: false
terraform_apply: true
terraform_variables: "-var=lambda_image_uri=${{ needs.docker_build_scan_push.outputs.ecr_image_uri }}"
secrets:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID_ACTIONS: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
AWS_SECRET_ACCESS_KEY_ACTIONS: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
PAGERDUTY_TOKEN: ""
smoke_test_preprod:
name: Smoke test
uses: ./.github/workflows/_integration_tests.yml
needs: terraform_preprod_environment_apply
with:
data_lpa_api_url: "https://pre.lpa.api.opg.service.justice.gov.uk/v1"
working_directory: "./integration_tests"
tests_directory: "./integration_tests/v1"
specific_tests: "./v1/test_healthcheck.py"
secrets: inherit
terraform_prod_environment_apply:
name: Terraform - Production - Environment - Apply
needs:
- set_variables
- docker_build_scan_push
- smoke_test_preprod
uses: ministryofjustice/opg-github-workflows/.github/workflows/[email protected]
with:
terraform_version: ${{ needs.set_variables.outputs.environment_terraform_version }}
terraform_directory: "./terraform/environment"
terraform_workspace: production
is_ephemeral: false
terraform_apply: true
terraform_variables: "-var=lambda_image_uri=${{ needs.docker_build_scan_push.outputs.ecr_image_uri }}"
secrets:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID_ACTIONS: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
AWS_SECRET_ACCESS_KEY_ACTIONS: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
PAGERDUTY_TOKEN: ""