Skip to content

Commit 2719d14

Browse files
Update: [AEA-5753] - path to live pipeline (#130)
## Summary Routine Change 🤖 Operational or Infrastructure Change ### Details https://nhsd-jira.digital.nhs.uk/browse/AEA-5753 This pull request implements a release pipeline for eps-assist-me that aligns with our existing release process **Pipeline Flow:** - PR merge to main → automatic DEV deployment - Manual approval gates for QA, INT, and PROD environments - INT and PROD deploy in parallel with identical code **Key changes:** - Added `deploy-dev-auto.yml` for automatic DEV deployments - Added `release.yml` for manual promotions with approval gates - Fixed poetry export validation to prevent Dependabot-induced deployment failures - Updated shellcheck version for pre-commit compatibility
1 parent d38fd1b commit 2719d14

File tree

10 files changed

+648
-530
lines changed

10 files changed

+648
-530
lines changed

.github/config/settings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TAG_FORMAT: "v${version}"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
cat <<EOF > payload.json
4+
{
5+
"currentTag": "$CURRENT_DEPLOYED_TAG",
6+
"targetTag": "$RELEASE_TAG",
7+
"repoName": "eps-assist-me",
8+
"targetEnvironment": "INT",
9+
"productName": "EPS Assist Me",
10+
"releaseNotesPageId": "$PAGE_ID",
11+
"releaseNotesPageTitle": "EPS-Assist-Me-$RELEASE_TAG - Deployed to [INT] on $(date +'%d-%m-%y')",
12+
"createReleaseCandidate": "true",
13+
"releasePrefix": "EPS-Assist-Me-"
14+
}
15+
EOF
16+
cat payload.json
17+
18+
function_arn=$(aws cloudformation list-exports --query "Exports[?Name=='release-notes:CreateReleaseNotesLambdaArn'].Value" --output text)
19+
aws lambda invoke --function-name "${function_arn}" --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt
20+
cat out.txt

.github/workflows/cdk_package_code.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,30 @@ jobs:
2626
with:
2727
ref: ${{ env.BRANCH_NAME }}
2828

29+
# using git commit sha for version of action to ensure we have stable version
30+
- name: Get asdf version
31+
id: asdf-version
32+
run: echo "version=0.18.0" >> "$GITHUB_OUTPUT"
33+
2934
# using git commit sha for version of action to ensure we have stable version
3035
- name: Install asdf
3136
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
3237
with:
33-
asdf_branch: v0.14.1
34-
38+
asdf_version: ${{ steps.asdf-version.outputs.version }}
39+
3540
- name: Cache asdf
3641
uses: actions/cache@v4
3742
with:
3843
path: |
3944
~/.asdf
40-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
45+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ steps.asdf-version.outputs.version }}
4146
restore-keys: |
42-
${{ runner.os }}-asdf-
47+
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}-${{ steps.asdf-version.outputs.version }}
4348
4449
- name: Install asdf dependencies in .tool-versions
4550
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
4651
with:
47-
asdf_branch: v0.14.1
52+
asdf_version: ${{ steps.asdf-version.outputs.version }}
4853
env:
4954
PYTHON_CONFIGURE_OPTS: --enable-shared
5055

@@ -58,15 +63,24 @@ jobs:
5863
- name: make install
5964
run: |
6065
make install
66+
make compile-node
6167
6268
- name: Build Python Lambda Functions
6369
run: |
6470
poetry export --without-hashes --format=requirements.txt --with slackBotFunction > requirements_slackBotFunction
6571
poetry export --without-hashes --format=requirements.txt --with syncKnowledgeBaseFunction > requirements_syncKnowledgeBaseFunction
72+
if [ ! -s requirements_slackBotFunction ]; then \
73+
echo "Error: requirements_slackBotFunction is empty or missing"; \
74+
exit 1; \
75+
fi
76+
if [ ! -s requirements_syncKnowledgeBaseFunction ]; then \
77+
echo "Error: requirements_syncKnowledgeBaseFunction is empty or missing"; \
78+
exit 1; \
79+
fi
6680
pip3 install -r requirements_slackBotFunction -t .dependencies/slackBotFunction/python
6781
pip3 install -r requirements_syncKnowledgeBaseFunction -t .dependencies/syncKnowledgeBaseFunction/python
6882
69-
- name: 'Tar files'
83+
- name: "Tar files"
7084
run: |
7185
tar -rf artifact.tar \
7286
.tool-versions \
@@ -75,10 +89,11 @@ jobs:
7589
package.json \
7690
package-lock.json \
7791
tsconfig.defaults.json \
92+
Makefile \
7893
cdk.json \
7994
.dependencies
8095
81-
- uses: actions/upload-artifact@v4
96+
- uses: actions/upload-artifact@v5
8297
name: upload build artifact
8398
with:
8499
name: build_artifact

.github/workflows/ci.yml

Lines changed: 64 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ env:
88
BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }}
99

1010
jobs:
11+
get_asdf_version:
12+
runs-on: ubuntu-22.04
13+
outputs:
14+
asdf_version: ${{ steps.asdf-version.outputs.version }}
15+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v5
19+
20+
- name: Get asdf version
21+
id: asdf-version
22+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
23+
24+
- name: Load config value
25+
id: load-config
26+
run: |
27+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
28+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
29+
1130
quality_checks:
1231
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
1332
secrets:
@@ -24,75 +43,15 @@ jobs:
2443
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
2544
2645
tag_release:
27-
needs: quality_checks
28-
runs-on: ubuntu-22.04
29-
outputs:
30-
version_tag: ${{ steps.output_version_tag.outputs.VERSION_TAG }}
31-
steps:
32-
- name: Checkout code
33-
uses: actions/checkout@v5
34-
with:
35-
ref: ${{ env.BRANCH_NAME }}
36-
fetch-depth: 0
37-
38-
# using git commit sha for version of action to ensure we have stable version
39-
- name: Install asdf
40-
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
41-
with:
42-
asdf_branch: v0.14.1
43-
44-
- name: Cache asdf
45-
uses: actions/cache@v4
46-
with:
47-
path: |
48-
~/.asdf
49-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
50-
restore-keys: |
51-
${{ runner.os }}-asdf-
52-
53-
- name: Install asdf dependencies in .tool-versions
54-
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
55-
with:
56-
asdf_branch: v0.14.1
57-
env:
58-
PYTHON_CONFIGURE_OPTS: --enable-shared
59-
60-
- name: Setting up .npmrc
61-
env:
62-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
run: |
64-
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
65-
echo "@nhsdigital:registry=https://npm.pkg.github.com" >> ~/.npmrc
66-
67-
- name: Install Dependencies
68-
run: make install
69-
70-
- name: Set VERSION_TAG env var to be short git SHA and get next tag varsion
71-
id: output_version_tag
72-
run: |
73-
VERSION_TAG=$(git rev-parse --short HEAD)
74-
npx semantic-release --dry-run > semantic-release-output.log
75-
NEXT_VERSION=$(grep -i 'The next release version is' semantic-release-output.log | sed -E 's/.* ([[:digit:].]+)$/\1/')
76-
if [ -z "${NEXT_VERSION}" ]
77-
then
78-
echo "Could not get next tag. Here is the log from semantic-release"
79-
cat semantic-release-output.log
80-
exit 1
81-
fi
82-
tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
83-
if [ "${tagFormat}" = "null" ]
84-
then
85-
tagFormat="v\${version}"
86-
fi
87-
# disabling shellcheck as replace does not work
88-
# shellcheck disable=SC2001
89-
NEW_VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
90-
echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
91-
echo "## NEXT TAG WILL BE : ${NEW_VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
92-
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
93-
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
94-
env:
95-
GITHUB_TOKEN: ${{ github.token }}
46+
needs: [quality_checks, get_commit_id, get_asdf_version]
47+
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@361957c147279f5f0f68b64fde9927833363d5f7
48+
with:
49+
dry_run: true
50+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
51+
branch_name: main
52+
publish_package: false
53+
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
54+
secrets: inherit
9655

9756
package_code:
9857
needs: [get_commit_id, tag_release]
@@ -104,7 +63,7 @@ jobs:
10463

10564
release_dev:
10665
needs: [get_commit_id, tag_release, package_code]
107-
uses: ./.github/workflows/cdk_release_code.yml
66+
uses: ./.github/workflows/release_all_stacks.yml
10867
with:
10968
STACK_NAME: epsam
11069
TARGET_ENVIRONMENT: dev
@@ -113,13 +72,47 @@ jobs:
11372
CDK_APP_NAME: EpsAssistMeApp
11473
DEPLOY_CODE: true
11574
LOG_RETENTION_IN_DAYS: 30
116-
LOG_LEVEL: DEBUG
75+
LOG_LEVEL: "DEBUG"
76+
CREATE_INT_RELEASE_NOTES: false
77+
CREATE_PROD_RELEASE_NOTES: false
11778
MARK_JIRA_RELEASED: false
79+
CREATE_INT_RC_RELEASE_NOTES: false
80+
IS_PULL_REQUEST: false
11881
secrets:
11982
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
12083
CDK_PULL_IMAGE_ROLE: ${{ secrets.DEV_CDK_PULL_IMAGE_ROLE }}
84+
DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
85+
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
86+
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
87+
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
12188
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
89+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
90+
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
91+
92+
release_qa:
93+
needs: [get_commit_id, tag_release, package_code, release_dev]
94+
uses: ./.github/workflows/release_all_stacks.yml
95+
with:
96+
STACK_NAME: epsam
97+
TARGET_ENVIRONMENT: qa
98+
VERSION_NUMBER: ${{ needs.tag_release.outputs.version_tag }}
99+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
100+
CDK_APP_NAME: EpsAssistMeApp
101+
DEPLOY_CODE: true
102+
LOG_RETENTION_IN_DAYS: 30
103+
LOG_LEVEL: "DEBUG"
104+
CREATE_INT_RELEASE_NOTES: true
105+
CREATE_PROD_RELEASE_NOTES: true
106+
MARK_JIRA_RELEASED: false
107+
CREATE_INT_RC_RELEASE_NOTES: false
108+
IS_PULL_REQUEST: false
109+
secrets:
110+
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}
111+
CDK_PULL_IMAGE_ROLE: ${{ secrets.QA_CDK_PULL_IMAGE_ROLE }}
122112
DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
113+
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
114+
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
123115
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
116+
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
124117
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
125118
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}

.github/workflows/pull_request.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ env:
88
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
99

1010
jobs:
11+
get_asdf_version:
12+
runs-on: ubuntu-22.04
13+
outputs:
14+
asdf_version: ${{ steps.asdf-version.outputs.version }}
15+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v5
19+
20+
- name: Get asdf version
21+
id: asdf-version
22+
run: echo "version=0.18.0" >> "$GITHUB_OUTPUT"
23+
24+
- name: Load config value
25+
id: load-config
26+
run: |
27+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
28+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
29+
1130
quality_checks:
1231
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
1332
secrets:
@@ -62,7 +81,7 @@ jobs:
6281

6382
release_code:
6483
needs: [get_issue_number, package_code, get_commit_id]
65-
uses: ./.github/workflows/cdk_release_code.yml
84+
uses: ./.github/workflows/release_all_stacks.yml
6685
with:
6786
STACK_NAME: epsam-pr-${{needs.get_issue_number.outputs.issue_number}}
6887
TARGET_ENVIRONMENT: dev-pr
@@ -71,9 +90,19 @@ jobs:
7190
CDK_APP_NAME: EpsAssistMeApp
7291
DEPLOY_CODE: true
7392
LOG_RETENTION_IN_DAYS: 30
74-
LOG_LEVEL: DEBUG
93+
LOG_LEVEL: "DEBUG"
94+
CREATE_INT_RELEASE_NOTES: false
95+
CREATE_PROD_RELEASE_NOTES: false
96+
MARK_JIRA_RELEASED: false
97+
CREATE_INT_RC_RELEASE_NOTES: false
98+
IS_PULL_REQUEST: true
7599
secrets:
76100
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
77101
CDK_PULL_IMAGE_ROLE: ${{ secrets.DEV_CDK_PULL_IMAGE_ROLE }}
102+
DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
103+
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
104+
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
105+
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
106+
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
78107
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
79108
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}

0 commit comments

Comments
 (0)