Skip to content

Commit 6e85bac

Browse files
committed
CCM-17346: Move To Shared Modules Model
2 parents ddb3c84 + 16ecc85 commit 6e85bac

14 files changed

Lines changed: 413 additions & 548 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 27 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,33 @@
11
{
2-
"customizations": {
3-
"codespaces": {
4-
"openFiles": [
5-
"README.md",
6-
".github/SECURITY.md",
7-
"docs/index.md"
8-
]
2+
"name": "Ubuntu",
3+
"image": "mcr.microsoft.com/devcontainers/base:noble",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
6+
"moby": true,
7+
"azureDnsAutoDetection": true,
8+
"installDockerBuildx": true,
9+
"installDockerComposeSwitch": true,
10+
"version": "latest",
11+
"dockerDashComposeVersion": "v2"
912
},
10-
"vscode": {
11-
"extensions": [
12-
"alefragnani.bookmarks",
13-
"AmazonWebServices.aws-toolkit-vscode",
14-
"chdsbd.github-code-owners",
15-
"davidanson.vscode-markdownlint",
16-
"dbaeumer.vscode-eslint",
17-
"donjayamanne.githistory",
18-
"editorconfig.editorconfig",
19-
"esbenp.prettier-vscode",
20-
"fvclaus.sort-json-array",
21-
"github.codespaces",
22-
"github.github-vscode-theme",
23-
"github.remotehub",
24-
"github.vscode-github-actions",
25-
"github.vscode-pull-request-github",
26-
"hediet.vscode-drawio",
27-
"johnpapa.vscode-peacock",
28-
"joshx.workspace-terminals",
29-
"maattdd.gitless",
30-
"mhutchie.git-graph",
31-
"ms-azuretools.vscode-docker",
32-
"ms-vscode-remote.remote-containers",
33-
"ms-vscode-remote.remote-wsl",
34-
"ms-vscode.hexeditor",
35-
"ms-vscode.live-server",
36-
"ms-vsliveshare.vsliveshare",
37-
"redhat.vscode-xml",
38-
"streetsidesoftware.code-spell-checker-british-english",
39-
"takumii.markdowntable",
40-
"tamasfe.even-better-toml",
41-
"tomoki1207.pdf",
42-
"vscode-icons-team.vscode-icons",
43-
"vstirbu.vscode-mermaid-preview",
44-
"wayou.vscode-todo-highlight",
45-
"yzane.markdown-pdf",
46-
"yzhang.dictionary-completion",
47-
"yzhang.markdown-all-in-one",
48-
"zoma.vscode-auto-open-workspace"
49-
],
50-
"settings": {
51-
"[makefile]": {
52-
"editor.detectIndentation": false,
53-
"editor.insertSpaces": false
54-
},
55-
"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
56-
"editor.formatOnSave": true,
57-
"extensions.ignoreRecommendations": true,
58-
"files.insertFinalNewline": true
59-
}
13+
"ghcr.io/devcontainers/features/go:1": {},
14+
"ghcr.io/azutake/devcontainer-features/go-packages-install:0": {
15+
"PACKAGES": "github.com/asdf-vm/asdf/cmd/asdf@v0.18.0"
16+
},
17+
"ghcr.io/devcontainers/features/python:1": {},
18+
"ghcr.io/devcontainers/features/common-utils": {
19+
"installZsh": true,
20+
"installOhMyZsh": true,
21+
"installOhMyZshConfig": true,
22+
"configureZshAsDefaultShell": true
23+
},
24+
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
25+
"plugins": "zsh-autosuggestions zsh-syntax-highlighting",
26+
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions.git https://github.com/zsh-users/zsh-syntax-highlighting.git"
6027
}
6128
},
62-
"forwardPorts": [
63-
4000
64-
],
65-
"image": "ghcr.io/nhsdigital/nhs-notify-template-repository:latest",
66-
"name": "Jekyll",
67-
"runArgs": [
68-
"--platform=linux/amd64"
29+
"postCreateCommand": "pipx install pre-commit && make config && echo 'export GPG_TTY=$TTY' | cat - ~/.zshrc > temp && mv temp ~/.zshrc",
30+
"mounts": [
31+
"source=${localEnv:HOME}/.gnupg,target=/home/vscode/.gnupg,type=bind,consistency=cached"
6932
]
7033
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: "CI/CD publish"
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
jobs:
10+
metadata:
11+
name: "Set CI/CD metadata"
12+
runs-on: ubuntu-latest
13+
if: github.event.pull_request.merged == true
14+
timeout-minutes: 1
15+
outputs:
16+
build_datetime: ${{ steps.variables.outputs.build_datetime }}
17+
build_timestamp: ${{ steps.variables.outputs.build_timestamp }}
18+
build_epoch: ${{ steps.variables.outputs.build_epoch }}
19+
nodejs_version: ${{ steps.variables.outputs.nodejs_version }}
20+
python_version: ${{ steps.variables.outputs.python_version }}
21+
terraform_version: ${{ steps.variables.outputs.terraform_version }}
22+
version: ${{ steps.variables.outputs.version }}
23+
steps:
24+
- name: "Checkout code"
25+
uses: actions/checkout@v4
26+
- name: "Set CI/CD variables"
27+
id: variables
28+
run: |
29+
datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
30+
echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
31+
echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
32+
echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
33+
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
34+
echo "python_version=$(grep "^python\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
35+
echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
36+
# TODO: Get the version, but it may not be the .version file as this should come from the CI/CD Pull Request Workflow
37+
echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
38+
- name: "List variables"
39+
run: |
40+
export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
41+
export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
42+
export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
43+
export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
44+
export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
45+
export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
46+
export VERSION="${{ steps.variables.outputs.version }}"
47+
make list-variables
48+
publish:
49+
name: "Publish packages"
50+
runs-on: ubuntu-latest
51+
needs: [metadata]
52+
if: github.event.pull_request.merged == true
53+
timeout-minutes: 3
54+
steps:
55+
- name: "Checkout code"
56+
uses: actions/checkout@v4
57+
- name: "Get the artefacts"
58+
run: |
59+
echo "Getting the artefacts created by the build stage ..."
60+
# TODO: Use either action/cache or action/upload-artifact
61+
- name: "Create release"
62+
id: create_release
63+
uses: actions/create-release@v1
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
with:
67+
tag_name: ${{ needs.metadata.outputs.version }}
68+
release_name: Release ${{ needs.metadata.outputs.version }}
69+
body: |
70+
Release of ${{ needs.metadata.outputs.version }}
71+
draft: false
72+
prerelease: false
73+
# - name: "Upload release asset"
74+
# uses: actions/upload-release-asset@v1
75+
# env:
76+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
# with:
78+
# upload_url: "${{ steps.create_release.outputs.upload_url }}"
79+
# asset_path: ./*
80+
# asset_name: repository-template-${{ needs.metadata.outputs.version }}.tar.gz
81+
# asset_content_type: "application/gzip"
82+
success:
83+
name: "Success notification"
84+
runs-on: ubuntu-latest
85+
needs: [publish]
86+
steps:
87+
- name: "Check prerequisites for notification"
88+
id: check
89+
run: echo "secret_exist=${{ secrets.TEAMS_NOTIFICATION_WEBHOOK_URL != '' }}" >> $GITHUB_OUTPUT
90+
- name: "Notify on publishing packages"
91+
if: steps.check.outputs.secret_exist == 'true'
92+
uses: nhs-england-tools/notify-msteams-action@v1.0.0
93+
with:
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
teams-webhook-url: ${{ secrets.TEAMS_NOTIFICATION_WEBHOOK_URL }}
96+
message-title: "Notification title"
97+
message-text: "This is a notification body"
98+
link: ${{ github.event.pull_request.html_url }}

.tool-versions

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
act 0.2.64
2-
gitleaks 8.24.0
3-
jq 1.6
4-
nodejs 24.14.1
5-
pnpm 10.33.0
1+
# This file is for you! Please, updated to the versions agreed by your team.
2+
3+
terraform 1.7.0
64
pre-commit 3.6.0
7-
terraform 1.14.3
8-
terraform-docs 0.21.0
95
vale 3.6.0
10-
python 3.13.2
11-
# trivy 0.69.3 - TODO - Re-visit Trivy usage https://nhsd-jira.digital.nhs.uk/browse/CCM-15549
6+
gitleaks 8.18.4
127

138
# ==============================================================================
149
# The section below is reserved for Docker image versions.
1510

1611
# TODO: Move this section - consider using a different file for the repository template dependencies.
17-
# docker/ghcr.io/anchore/grype v0.104.3@sha256:d340f4f8b3b7e6e72a6c9c0152f25402ed8a2d7375dba1dfce4e53115242feb6 # SEE: https://github.com/anchore/grype/pkgs/container/grype
18-
# docker/ghcr.io/anchore/syft v1.39.0@sha256:6f13bb010923c33fb197047c8f88888e77071bd32596b3f605d62a133e493ce4 # SEE: https://github.com/anchore/syft/pkgs/container/syft
19-
# docker/ghcr.io/gitleaks/gitleaks:v8.24.0@sha256:b8e9bf46893c2f20e10bfb4b2e783adaef519dea981b01ca6221ac325e836040 # SEE: https://github.com/gitleaks/gitleaks/pkgs/container/gitleaks
12+
# docker/ghcr.io/anchore/grype v0.92.2@sha256:651e558f9ba84f2a790b3449c8a57cbbf4f34e004f7d3f14ae8f8cbeede4cd33 # SEE: https://github.com/anchore/grype/pkgs/container/grype
13+
# docker/ghcr.io/anchore/syft v0.92.0@sha256:63c60f0a21efb13e80aa1359ab243e49213b6cc2d7e0f8179da38e6913b997e0 # SEE: https://github.com/anchore/syft/pkgs/container/syft
14+
# docker/ghcr.io/gitleaks/gitleaks v8.18.0@sha256:fd2b5cab12b563d2cc538b14631764a1c25577780e3b7dba71657d58da45d9d9 # SEE: https://github.com/gitleaks/gitleaks/pkgs/container/gitleaks
2015
# docker/ghcr.io/igorshubovych/markdownlint-cli v0.37.0@sha256:fb3e79946fce78e1cde84d6798c6c2a55f2de11fc16606a40d49411e281d950d # SEE: https://github.com/igorshubovych/markdownlint-cli/pkgs/container/markdownlint-cli
2116
# docker/ghcr.io/make-ops-tools/gocloc latest@sha256:6888e62e9ae693c4ebcfed9f1d86c70fd083868acb8815fe44b561b9a73b5032 # SEE: https://github.com/make-ops-tools/gocloc/pkgs/container/gocloc
2217
# docker/ghcr.io/nhs-england-tools/github-runner-image 20230909-321fd1e-rt@sha256:ce4fd6035dc450a50d3cbafb4986d60e77cb49a71ab60a053bb1b9518139a646 # SEE: https://github.com/nhs-england-tools/github-runner-image/pkgs/container/github-runner-image
2318
# docker/hadolint/hadolint 2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 # SEE: https://hub.docker.com/r/hadolint/hadolint/tags
24-
# docker/hashicorp/terraform 1.5.6@sha256:180a7efa983386a27b43657ed610e9deed9e6c3848d54f9ea9b6cb8a5c8c25f5 # SEE: https://hub.docker.com/r/hashicorp/terraform/tags
19+
# docker/hashicorp/terraform 1.12.2@sha256:b3d13c9037d2bd858fe10060999aa7ca56d30daafe067d7715b29b3d4f5b162f # SEE: https://hub.docker.com/r/hashicorp/terraform/tags
2520
# docker/jdkato/vale v3.6.0@sha256:0ef22c8d537f079633cfff69fc46f69a2196072f69cab1ab232e8a79a388e425 # SEE: https://hub.docker.com/r/jdkato/vale/tags
2621
# docker/koalaman/shellcheck latest@sha256:e40388688bae0fcffdddb7e4dea49b900c18933b452add0930654b2dea3e7d5c # SEE: https://hub.docker.com/r/koalaman/shellcheck/tags
2722
# docker/mstruebing/editorconfig-checker 2.7.1@sha256:dd3ca9ea50ef4518efe9be018d669ef9cf937f6bb5cfe2ef84ff2a620b5ddc24 # SEE: https://hub.docker.com/r/mstruebing/editorconfig-checker/tags
28-
# docker/sonarsource/sonar-scanner-cli 11.3@sha256:7462f132388135e32b948f8f18ff0db9ae28a87c6777f1df5b2207e04a6d7c5c # SEE: https://hub.docker.com/r/sonarsource/sonar-scanner-cli/tags
23+
# docker/sonarsource/sonar-scanner-cli 10.0@sha256:0bc49076468d2955948867620b2d98d67f0d59c0fd4a5ef1f0afc55cf86f2079 # SEE: https://hub.docker.com/r/sonarsource/sonar-scanner-cli/tags
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module github-app-get-tokent
2+
3+
go 1.21.0
4+
5+
require (
6+
github.com/go-resty/resty/v2 v2.7.0
7+
github.com/golang-jwt/jwt v3.2.2+incompatible
8+
)
9+
10+
require golang.org/x/net v0.23.0 // indirect
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
2+
github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=
3+
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
4+
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
5+
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
6+
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
7+
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
8+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9+
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
11+
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
12+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PyJWT==2.8.0
2+
requests==2.32.4

0 commit comments

Comments
 (0)