Skip to content

Commit f7c72eb

Browse files
updates.
1 parent 05e5233 commit f7c72eb

65 files changed

Lines changed: 16042 additions & 2979 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coverage

-52 KB
Binary file not shown.

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"containerEnv": {
33
"GITHUBMONITOR": "false",
44
"MAKECONFIG": "true",
5-
"SHOWWELCOME": "true",
5+
"SHOWWELCOME": "false",
66
"UPDATEFROMTEMPLATE": "false"
77
},
8-
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-loaded-codespaces:main",
9-
"name": "Codespaces Online Development"
8+
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-loaded-codespaces:1.0.19",
9+
"name": "Codespaces"
1010
}

.devcontainer/nhs-notify-devcontainer-loaded/devcontainer.json renamed to .devcontainer/local-dev/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"containerEnv": {
33
"GITHUBMONITOR": "false",
44
"MAKECONFIG": "true",
5-
"SHOWWELCOME": "true",
5+
"SHOWWELCOME": "false",
66
"UPDATEFROMTEMPLATE": "false"
77
},
8-
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-loaded:1.0.17",
9-
"name": "Notify Loaded 1.0.17",
8+
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-loaded:1.0.19",
9+
"name": "Local Development",
1010
"postStartCommand": "mkdir -p ~/.gnupg && echo '## 1-day timeout' > ~/.gnupg/gpg-agent.conf && echo 'default-cache-ttl 86400' >> ~/.gnupg/gpg-agent.conf && echo 'max-cache-ttl 86400' >> ~/.gnupg/gpg-agent.conf && gpg-connect-agent reloadagent /bye 2>/dev/null || true"
1111
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
3+
"name": "Ubuntu 24"
4+
}

.github/actions/build-docs/action.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,39 @@ runs:
99
steps:
1010
- name: Checkout
1111
uses: actions/checkout@v5
12-
- uses: actions/setup-node@v6
13-
with:
14-
node-version: 24
15-
- name: Npm cli install
16-
working-directory: ./docs
17-
run: npm ci
18-
shell: bash
19-
- name: Setup Ruby
20-
uses: ruby/setup-ruby@v1.267.0
21-
with:
22-
ruby-version: "3.4.7" # Not needed with a .ruby-version file
23-
bundler-cache: false # runs 'bundle install' and caches installed gems automatically
24-
#cache-version: 0 # Increment this number if you need to re-download cached gems
25-
working-directory: "./docs"
12+
13+
- name: "Setup dependencies and asdf with cache"
14+
uses: ./.github/actions/setup-dependencies-asdf-with-cache
15+
16+
# - uses: actions/setup-node@v6
17+
# with:
18+
# node-version: 24
19+
# - name: Npm cli install
20+
# working-directory: ./docs
21+
# run: npm ci
22+
# shell: bash
23+
# - name: Setup Ruby
24+
# uses: ruby/setup-ruby@v1.267.0
25+
# with:
26+
# ruby-version: "3.4.7" # Not needed with a .ruby-version file
27+
# bundler-cache: false # runs 'bundle install' and caches installed gems automatically
28+
# #cache-version: 0 # Increment this number if you need to re-download cached gems
29+
# working-directory: "./docs"
30+
2631
- name: Setup Pages
2732
id: pages
2833
uses: actions/configure-pages@v5
2934
- name: Build with Jekyll
3035
working-directory: ./docs
3136
# Outputs to the './_site' directory by default
3237
shell: bash
33-
run: make build-ci BASE_URL=${{ steps.pages.outputs.base_path }} VERSION=${{ inputs.version }}
38+
#run: make build-ci BASE_URL=${{ steps.pages.outputs.base_path }} VERSION=${{ inputs.version }}
39+
run: make build BASE_URL="${BASE_URL}" VERSION="${VERSION}"
3440
#run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
3541
env:
3642
JEKYLL_ENV: production
43+
BASE_URL: ${{ steps.pages.outputs.base_path }}
44+
VERSION: ${{ inputs.version }}
3745
- name: Upload artifact
3846
# Automatically uploads an artifact from the './_site' directory by default
3947
uses: actions/upload-pages-artifact@v3

.github/actions/perform-static-analysis/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ inputs:
1010
sonar_token:
1111
description: "Sonar token, the API key"
1212
required: false
13+
fail_on_quality_gate_failure:
14+
description: "Whether to fail the build if the quality gate fails"
15+
required: false
16+
default: "true"
1317
runs:
1418
using: "composite"
1519
steps:
@@ -20,6 +24,7 @@ runs:
2024
- name: "Perform static analysis"
2125
shell: bash
2226
if: steps.check.outputs.secret_exist == 'true'
27+
continue-on-error: ${{ inputs.fail_on_quality_gate_failure != 'true' }}
2328
run: |
2429
export BRANCH_NAME=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')}
2530
export SONAR_ORGANISATION_KEY=${{ inputs.sonar_organisation_key }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: 'Setup depenasdf with cache'
2+
description: 'Restores asdf cache, installs dependencies, and saves cache'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: "Restore asdf cache"
7+
id: cache-asdf
8+
uses: actions/cache/restore@v4
9+
with:
10+
path: |
11+
~/.asdf
12+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
13+
restore-keys: |
14+
${{ runner.os }}-asdf-
15+
16+
- name: "Check cache status"
17+
shell: bash
18+
run: |
19+
if [ "${{ steps.cache-asdf.outputs.cache-hit }}" == "true" ]; then
20+
echo "✅ Cache hit! asdf and tools restored from cache. 🚀🚀🚀"
21+
else
22+
echo "❌ Cache miss. asdf and tools will be installed from scratch. 🔨🔨🔨"
23+
fi
24+
25+
- name: "Install dependencies"
26+
shell: bash -l {0}
27+
run: |
28+
make dependencies
29+
30+
- name: "Save asdf cache"
31+
id: save-asdf-cache
32+
if: steps.cache-asdf.outputs.cache-hit != 'true'
33+
uses: actions/cache/save@v4
34+
with:
35+
path: |
36+
~/.asdf
37+
key: ${{ steps.cache-asdf.outputs.cache-primary-key }}
38+
39+
- name: "Check cache save status"
40+
shell: bash
41+
run: |
42+
if [ "${{ steps.cache-asdf.outputs.cache-hit }}" == "true" ]; then
43+
echo "ℹ️ Cache was restored from previous run - no save needed"
44+
elif [ "${{ steps.save-asdf-cache.outcome }}" == "success" ]; then
45+
echo "✅ Cache saved successfully for future runs! 💾"
46+
else
47+
echo "⚠️ Cache save was skipped or failed"
48+
fi

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ jobs:
162162
secrets:
163163
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
164164
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
165+
165166
publish-stage: # Recommended maximum execution time is 10 minutes
166167
name: "Publish stage"
167-
needs: [metadata, acceptance-stage] #PUT THIS BACK WHEN ACCEPTANCE STAGE IS ENABLED
168-
#needs: [metadata, build-stage] BYPASSING ACCEPTANCE STAGE
168+
needs: [metadata, acceptance-stage]
169+
#needs: [metadata, build-stage] #For forks where there is no dynamic environment stage
169170
uses: ./.github/workflows/stage-5-publish.yaml
170171
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
171172
with:
@@ -177,4 +178,3 @@ jobs:
177178
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
178179
version: "${{ needs.metadata.outputs.version }}"
179180
is_version_prerelease: "${{ needs.metadata.outputs.is_version_prerelease }}"
180-
# secrets: inherit
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: "2. CI/CD publish"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
7+
jobs:
8+
metadata:
9+
name: "Set CI/CD metadata"
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 1
12+
outputs:
13+
build_datetime_london: ${{ steps.variables.outputs.build_datetime_london }}
14+
build_datetime: ${{ steps.variables.outputs.build_datetime }}
15+
build_timestamp: ${{ steps.variables.outputs.build_timestamp }}
16+
build_epoch: ${{ steps.variables.outputs.build_epoch }}
17+
nodejs_version: ${{ steps.variables.outputs.nodejs_version }}
18+
python_version: ${{ steps.variables.outputs.python_version }}
19+
terraform_version: ${{ steps.variables.outputs.terraform_version }}
20+
version: ${{ steps.variables.outputs.version }}
21+
is_version_prerelease: ${{ steps.variables.outputs.is_version_prerelease }}
22+
does_pull_request_exist: ${{ steps.pr_exists.outputs.does_pull_request_exist }}
23+
pr_number: ${{ steps.pr_exists.outputs.pr_number }}
24+
steps:
25+
- name: "Checkout code"
26+
uses: actions/checkout@v5
27+
- name: "Set CI/CD variables"
28+
id: variables
29+
run: |
30+
datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
31+
BUILD_DATETIME=$datetime make version-create-effective-file dir=.
32+
version=$(head -n 1 .version 2> /dev/null || echo unknown)
33+
echo "build_datetime_london=$(TZ=Europe/London date --date=$datetime +'%Y-%m-%dT%H:%M:%S%z')" >> $GITHUB_OUTPUT
34+
echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
35+
echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
36+
echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
37+
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
38+
echo "python_version=$(grep "^python\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
39+
echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
40+
echo "version=$(echo $version)" >> $GITHUB_OUTPUT
41+
echo "is_version_prerelease=$(if [[ $version == *-* ]]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT
42+
43+
- name: "Check if pull request exists for this branch"
44+
id: pr_exists
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')}
49+
echo "Current branch is '$branch_name'"
50+
51+
pr_json=$(gh pr list --head "$branch_name" --state open --json number --limit 1)
52+
pr_number=$(echo "$pr_json" | jq -r '.[0].number // empty')
53+
54+
if [[ -n "$pr_number" ]]; then
55+
echo "Pull request exists: #$pr_number"
56+
echo "does_pull_request_exist=true" >> $GITHUB_OUTPUT
57+
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
58+
else
59+
echo "Pull request doesn't exist"
60+
echo "does_pull_request_exist=false" >> $GITHUB_OUTPUT
61+
echo "pr_number=" >> $GITHUB_OUTPUT
62+
fi
63+
64+
- name: "List variables"
65+
run: |
66+
export BUILD_DATETIME_LONDON="${{ steps.variables.outputs.build_datetime_london }}"
67+
export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
68+
export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
69+
export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
70+
export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
71+
export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
72+
export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
73+
export VERSION="${{ steps.variables.outputs.version }}"
74+
export DOES_PULL_REQUEST_EXIST="${{ steps.pr_exists.outputs.does_pull_request_exist }}"
75+
export IS_VERSION_PRERELEASE="${{ steps.variables.outputs.is_version_prerelease }}"
76+
make list-variables
77+
78+
publish:
79+
name: "Publish packages"
80+
runs-on: ubuntu-latest
81+
timeout-minutes: 10
82+
needs: [metadata]
83+
env:
84+
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
85+
build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}"
86+
build_epoch: "${{ needs.metadata.outputs.build_epoch }}"
87+
nodejs_version: "${{ needs.metadata.outputs.nodejs_version }}"
88+
python_version: "${{ needs.metadata.outputs.python_version }}"
89+
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
90+
version: "${{ needs.metadata.outputs.version }}"
91+
is_version_prerelease: "${{ needs.metadata.outputs.is_version_prerelease }}"
92+
93+
steps:
94+
- name: "Checkout code"
95+
uses: actions/checkout@v5
96+
97+
- name: "Get artifacts: jekyll docs"
98+
uses: actions/download-artifact@v5
99+
with:
100+
path: ./artifacts/jekyll-docs-${{ env.version }}
101+
name: jekyll-docs-${{ env.version }}
102+
103+
- name: "Get artifacts: schema"
104+
uses: actions/download-artifact@v5
105+
with:
106+
path: ./artifacts/schemas-${{ env.version }}
107+
name: schemas-${{ env.version }}
108+
109+
110+
- name: Draft Release
111+
env:
112+
GH_TOKEN: ${{ github.token }}
113+
GH_REPO: ${{ github.repository }}
114+
VERSION: ${{ env.version }}
115+
IS_PRERELEASE: ${{ env.is_version_prerelease }}
116+
run: |
117+
PRERELEASE_FLAG=""
118+
if [ "$IS_PRERELEASE" = "true" ]; then
119+
PRERELEASE_FLAG="--prerelease"
120+
fi
121+
gh release create \
122+
"$VERSION" \
123+
--draft \
124+
--latest \
125+
--title "$VERSION" \
126+
--notes "Release of $VERSION" \
127+
$PRERELEASE_FLAG
128+
129+
- name: "Upload jeykll docs release asset"
130+
env:
131+
GH_TOKEN: ${{ github.token }}
132+
GH_REPO: ${{ github.repository }}
133+
VERSION: ${{ env.version }}
134+
run: |
135+
cp ./artifacts/jekyll-docs-$VERSION/artifact.tar $RUNNER_TEMP/jekyll-docs-$VERSION.tar
136+
gh release upload \
137+
"$VERSION" \
138+
$RUNNER_TEMP/jekyll-docs-$VERSION.tar#jekyll-docs-$VERSION
139+
140+
- name: "Upload schema release asset"
141+
env:
142+
GH_TOKEN: ${{ github.token }}
143+
GH_REPO: ${{ github.repository }}
144+
VERSION: ${{ env.version }}
145+
run: |
146+
cp ./artifacts/schemas-$VERSION/artifact.tar $RUNNER_TEMP/schemas-$VERSION.tar
147+
gh release upload \
148+
"$VERSION" \
149+
$RUNNER_TEMP/schemas-$VERSION.tar#schemas-$VERSION
150+
151+
152+
- name: Publish Release
153+
env:
154+
GH_TOKEN: ${{ github.token }}
155+
GH_REPO: ${{ github.repository }}
156+
VERSION: ${{ env.version }}
157+
run: gh release edit "$VERSION" --draft=false

.github/workflows/cicd-3-deploy.yaml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
name: "2. Deploy docs to GitHub Pages"
1+
name: "3. CI/CD deploy"
22

33
on:
4-
workflow_run:
5-
workflows: ["1. CI/CD pull request"]
6-
types:
7-
- completed
8-
branches: [main]
94
workflow_dispatch:
105
inputs:
116
include_prereleases:
@@ -65,17 +60,17 @@ jobs:
6560
echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
6661
echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
6762
# echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
68-
- name: "List variables"
69-
run: |
70-
export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
71-
export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
72-
export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
73-
export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
74-
export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
75-
export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
76-
export VERSION="${{ steps.variables.outputs.version }}"
77-
# export TAG="${{ steps.variables.outputs.tag }}"
78-
make list-variables
63+
# - name: "List variables"
64+
# run: |
65+
# export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
66+
# export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
67+
# export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
68+
# export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
69+
# export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
70+
# export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
71+
# export VERSION="${{ steps.variables.outputs.version }}"
72+
# # export TAG="${{ steps.variables.outputs.tag }}"
73+
# make list-variables
7974

8075
deploy-jekyll:
8176
environment:

0 commit comments

Comments
 (0)