Skip to content

Commit 234f10f

Browse files
authored
Fix: [AEA-0000] - create typescript function cdk construct (#288)
## Summary - Routine Change ### Details - create typescript function cdk construct - create weekly release workflows and modify ci pipeline to not tag a release - update check_ecr_image_scan_results to use inspector2 api - move to common workflows for - - pr title format check - - dependabot auto approve and merge
1 parent 555837e commit 234f10f

22 files changed

+9952
-7100
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: merge to main workflow
1+
name: release workflow
22

33
on:
44
push:
@@ -55,29 +55,29 @@ jobs:
5555
needs: [quality_checks, get_commit_id, get_asdf_version]
5656
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@361957c147279f5f0f68b64fde9927833363d5f7
5757
with:
58-
dry_run: false
58+
dry_run: true
5959
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
6060
branch_name: main
61-
publish_package: false
61+
publish_package: true
6262
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
6363
secrets: inherit
6464

6565
package_code:
6666
needs: [tag_release, quality_checks, get_commit_id]
6767
uses: ./.github/workflows/docker_image_build.yml
6868
with:
69-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
69+
VERSION_NUMBER: pre-release-${{ needs.get_commit_id.outputs.sha_short }}
7070
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
7171

7272
release_dev:
7373
needs: [tag_release, package_code, get_commit_id]
7474
uses: ./.github/workflows/docker_image_upload.yml
7575
with:
7676
AWS_ENVIRONMENT: dev
77-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
77+
VERSION_NUMBER: pre-release-${{ needs.get_commit_id.outputs.sha_short }}
7878
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
79-
TAG_LATEST: true
80-
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
79+
TAG_LATEST: false
80+
DOCKER_IMAGE_TAG: pre-release-${{ needs.get_commit_id.outputs.sha_short }}
8181
secrets:
8282
CDK_PUSH_IMAGE_ROLE: ${{ secrets.DEV_CDK_PUSH_IMAGE_ROLE }}
8383

@@ -86,10 +86,10 @@ jobs:
8686
uses: ./.github/workflows/docker_image_upload.yml
8787
with:
8888
AWS_ENVIRONMENT: qa
89-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
89+
VERSION_NUMBER: pre-release-${{ needs.get_commit_id.outputs.sha_short }}
9090
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
91-
TAG_LATEST: true
92-
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
91+
TAG_LATEST: false
92+
DOCKER_IMAGE_TAG: pre-release-${{ needs.get_commit_id.outputs.sha_short }}
9393
secrets:
9494
CDK_PUSH_IMAGE_ROLE: ${{ secrets.QA_CDK_PUSH_IMAGE_ROLE }}
9595

@@ -98,33 +98,13 @@ jobs:
9898
uses: ./.github/workflows/docker_image_upload.yml
9999
with:
100100
AWS_ENVIRONMENT: ref
101-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
101+
VERSION_NUMBER: pre-release-${{ needs.get_commit_id.outputs.sha_short }}
102102
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
103-
TAG_LATEST: true
104-
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
103+
TAG_LATEST: false
104+
DOCKER_IMAGE_TAG: pre-release-${{ needs.get_commit_id.outputs.sha_short }}
105105
secrets:
106106
CDK_PUSH_IMAGE_ROLE: ${{ secrets.REF_CDK_PUSH_IMAGE_ROLE }}
107107

108-
release_int:
109-
needs: [tag_release, release_qa, package_code, get_commit_id]
110-
uses: ./.github/workflows/docker_image_upload.yml
111-
with:
112-
AWS_ENVIRONMENT: int
113-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
114-
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
115-
TAG_LATEST: true
116-
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
117-
secrets:
118-
CDK_PUSH_IMAGE_ROLE: ${{ secrets.INT_CDK_PUSH_IMAGE_ROLE }}
119-
120-
release_prod:
121-
needs: [tag_release, release_int, package_code, get_commit_id]
122-
uses: ./.github/workflows/docker_image_upload.yml
123-
with:
124-
AWS_ENVIRONMENT: prod
125-
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
126-
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
127-
TAG_LATEST: true
128-
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
129-
secrets:
130-
CDK_PUSH_IMAGE_ROLE: ${{ secrets.PROD_CDK_PUSH_IMAGE_ROLE }}
108+
package_npm_code:
109+
needs: [quality_checks, get_commit_id]
110+
uses: ./.github/workflows/package_npm_code.yml

.github/workflows/dependabot_auto_approve_and_merge.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: docker image build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
get_asdf_version:
8+
runs-on: ubuntu-22.04
9+
outputs:
10+
asdf_version: ${{ steps.asdf-version.outputs.version }}
11+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v5
15+
16+
- name: Get asdf version
17+
id: asdf-version
18+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
19+
- name: Load config value
20+
id: load-config
21+
run: |
22+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
23+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
24+
package_npm_code:
25+
runs-on: ubuntu-22.04
26+
needs: [get_asdf_version]
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v5
30+
with:
31+
ref: ${{ env.BRANCH_NAME }}
32+
33+
# using git commit sha for version of action to ensure we have stable version
34+
- name: Install asdf
35+
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
36+
with:
37+
asdf_version: ${{ needs.get_asdf_version.outputs.asdf_version }}
38+
39+
- name: Cache asdf
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
~/.asdf
44+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
45+
restore-keys: |
46+
${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
47+
48+
- name: Install asdf dependencies in .tool-versions
49+
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
50+
with:
51+
asdf_version: ${{ needs.get_asdf_version.outputs.asdf_version }}
52+
env:
53+
PYTHON_CONFIGURE_OPTS: --enable-shared
54+
55+
- name: Install dependencies
56+
run: |
57+
make install
58+
59+
- name: Package code
60+
run: |
61+
make package
62+
63+
- uses: actions/upload-artifact@v4
64+
name: Upload packaged code
65+
with:
66+
name: nhsdigital-eps-cdk-constructs-1.0.0.tgz
67+
path: |
68+
lib/nhsdigital-eps-cdk-constructs-1.0.0.tgz

.github/workflows/pull_request.yml

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

1010
jobs:
11+
dependabot-auto-approve-and-merge:
12+
needs: quality_checks
13+
uses: NHSDigital/eps-workflow-dependabot/.github/workflows/dependabot-auto-approve-and-merge.yml@5b176f0bba32ef623dee7d134391160c0058402d
14+
secrets:
15+
AUTOMERGE_APP_ID: ${{ secrets.AUTOMERGE_APP_ID }}
16+
AUTOMERGE_PEM: ${{ secrets.AUTOMERGE_PEM }}
1117
get_asdf_version:
1218
runs-on: ubuntu-22.04
1319
outputs:
@@ -78,15 +84,19 @@ jobs:
7884
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
7985
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
8086
81-
package_code:
87+
package_docker_image:
8288
needs: [get_issue_number, quality_checks, get_commit_id]
8389
uses: ./.github/workflows/docker_image_build.yml
8490
with:
8591
VERSION_NUMBER: PR-${{ needs.get_issue_number.outputs.issue_number }}
8692
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
8793

88-
release_code:
89-
needs: [get_issue_number, package_code, get_commit_id]
94+
package_npm_code:
95+
needs: [quality_checks, get_commit_id]
96+
uses: ./.github/workflows/package_npm_code.yml
97+
98+
release_docker_image:
99+
needs: [get_issue_number, package_docker_image, get_commit_id]
90100
uses: ./.github/workflows/docker_image_upload.yml
91101
with:
92102
AWS_ENVIRONMENT: dev
@@ -96,3 +106,14 @@ jobs:
96106
DOCKER_IMAGE_TAG: PR-${{ needs.get_issue_number.outputs.issue_number }}-${{ needs.get_commit_id.outputs.sha_short }}
97107
secrets:
98108
CDK_PUSH_IMAGE_ROLE: ${{ secrets.DEV_CDK_PUSH_IMAGE_ROLE }}
109+
110+
tag_release:
111+
needs: [get_commit_id, get_asdf_version]
112+
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@7c0d0e06afc120ec47372b479aa147ff9b453bca
113+
with:
114+
dry_run: true
115+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
116+
branch_name: ${{ github.event.pull_request.head.ref }}
117+
publish_package: true
118+
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
119+
secrets: inherit

.github/workflows/release.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: release workflow
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 8 * * 3"
7+
8+
env:
9+
BRANCH_NAME: ${{ github.ref_name }}
10+
11+
jobs:
12+
get_commit_id:
13+
runs-on: ubuntu-22.04
14+
outputs:
15+
commit_id: ${{ steps.commit_id.outputs.commit_id }}
16+
sha_short: ${{ steps.commit_id.outputs.sha_short }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v5
21+
with:
22+
ref: ${{ env.BRANCH_NAME }}
23+
24+
- name: Get Commit ID
25+
id: commit_id
26+
run: |
27+
# echo "commit_id=${{ github.sha }}" >> "$GITHUB_ENV"
28+
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
29+
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
30+
get_asdf_version:
31+
runs-on: ubuntu-22.04
32+
outputs:
33+
asdf_version: ${{ steps.asdf-version.outputs.version }}
34+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v5
38+
39+
- name: Get asdf version
40+
id: asdf-version
41+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
42+
- name: Load config value
43+
id: load-config
44+
run: |
45+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
46+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
47+
quality_checks:
48+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/quality-checks.yml@4a6d03ad51516eddc448daf454805f85fe2025b9
49+
needs: [get_asdf_version, get_commit_id]
50+
with:
51+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
52+
secrets:
53+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
54+
55+
tag_release:
56+
needs: [quality_checks, get_commit_id, get_asdf_version]
57+
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@7c0d0e06afc120ec47372b479aa147ff9b453bca
58+
with:
59+
dry_run: false
60+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
61+
branch_name: main
62+
publish_package: true
63+
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
64+
secrets: inherit
65+
66+
package_code:
67+
needs: [tag_release, quality_checks, get_commit_id]
68+
uses: ./.github/workflows/docker_image_build.yml
69+
with:
70+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
71+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
72+
73+
release_dev:
74+
needs: [tag_release, package_code, get_commit_id]
75+
uses: ./.github/workflows/docker_image_upload.yml
76+
with:
77+
AWS_ENVIRONMENT: dev
78+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
79+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
80+
TAG_LATEST: true
81+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
82+
secrets:
83+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.DEV_CDK_PUSH_IMAGE_ROLE }}
84+
85+
release_qa:
86+
needs: [tag_release, release_dev, package_code, get_commit_id]
87+
uses: ./.github/workflows/docker_image_upload.yml
88+
with:
89+
AWS_ENVIRONMENT: qa
90+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
91+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
92+
TAG_LATEST: true
93+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
94+
secrets:
95+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.QA_CDK_PUSH_IMAGE_ROLE }}
96+
97+
release_ref:
98+
needs: [tag_release, release_dev, package_code, get_commit_id]
99+
uses: ./.github/workflows/docker_image_upload.yml
100+
with:
101+
AWS_ENVIRONMENT: ref
102+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
103+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
104+
TAG_LATEST: true
105+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
106+
secrets:
107+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.REF_CDK_PUSH_IMAGE_ROLE }}
108+
109+
release_int:
110+
needs: [tag_release, release_qa, package_code, get_commit_id]
111+
uses: ./.github/workflows/docker_image_upload.yml
112+
with:
113+
AWS_ENVIRONMENT: int
114+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
115+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
116+
TAG_LATEST: true
117+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
118+
secrets:
119+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.INT_CDK_PUSH_IMAGE_ROLE }}
120+
121+
release_prod:
122+
needs: [tag_release, release_int, package_code, get_commit_id]
123+
uses: ./.github/workflows/docker_image_upload.yml
124+
with:
125+
AWS_ENVIRONMENT: prod
126+
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
127+
COMMIT_ID: ${{ needs.get_commit_id.outputs.commit_id }}
128+
TAG_LATEST: true
129+
DOCKER_IMAGE_TAG: ${{needs.tag_release.outputs.version_tag}}
130+
secrets:
131+
CDK_PUSH_IMAGE_ROLE: ${{ secrets.PROD_CDK_PUSH_IMAGE_ROLE }}

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
2+
@nhsdigital:registry=https://npm.pkg.github.com

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,14 @@ repos:
4141
types_or: [sh, shell]
4242
pass_filenames: false
4343

44+
- id: lint-cdkConstructs
45+
name: Lint cdkConstructs
46+
entry: npm
47+
args: ["run", "--prefix=packages/cdkConstructs", "lint"]
48+
language: system
49+
files: ^packages\/cdkConstructs
50+
types_or: [ts, tsx, javascript, jsx, json]
51+
pass_filenames: false
52+
4453
fail_fast: true
4554
default_stages: [pre-commit]

0 commit comments

Comments
 (0)