Skip to content

Commit 771bb7a

Browse files
Merge branch 'main' into dependabot/github_actions/actions/download-artifact-5
2 parents 1a4c745 + 54b0fc2 commit 771bb7a

File tree

296 files changed

+18274
-23486
lines changed

Some content is hidden

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

296 files changed

+18274
-23486
lines changed

.devcontainer/devcontainer.json

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"build": {
3+
"dockerfile": "../scripts/devcontainer/Dockerfile"
4+
},
25
"customizations": {
36
"codespaces": {
47
"openFiles": [
@@ -9,11 +12,7 @@
912
},
1013
"vscode": {
1114
"extensions": [
12-
"ms-dotnettools.csdevkit",
1315
"42crunch.vscode-openapi",
14-
"alefragnani.bookmarks",
15-
"AmazonWebServices.aws-toolkit-vscode",
16-
"chdsbd.github-code-owners",
1716
"davidanson.vscode-markdownlint",
1817
"dbaeumer.vscode-eslint",
1918
"donjayamanne.githistory",
@@ -26,7 +25,6 @@
2625
"github.vscode-github-actions",
2726
"github.vscode-pull-request-github",
2827
"hediet.vscode-drawio",
29-
"johnpapa.vscode-peacock",
3028
"joshx.workspace-terminals",
3129
"maattdd.gitless",
3230
"mhutchie.git-graph",
@@ -40,15 +38,10 @@
4038
"streetsidesoftware.code-spell-checker-british-english",
4139
"takumii.markdowntable",
4240
"tamasfe.even-better-toml",
43-
"tomoki1207.pdf",
44-
"vscjava.vscode-java-pack",
45-
"vscode-icons-team.vscode-icons",
46-
"vstirbu.vscode-mermaid-preview",
4741
"wayou.vscode-todo-highlight",
4842
"yzane.markdown-pdf",
4943
"yzhang.dictionary-completion",
50-
"yzhang.markdown-all-in-one",
51-
"zoma.vscode-auto-open-workspace"
44+
"yzhang.markdown-all-in-one"
5245
],
5346
"settings": {
5447
"[makefile]": {
@@ -70,37 +63,25 @@
7063
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions.git https://github.com/zsh-users/zsh-syntax-highlighting.git",
7164
"plugins": "zsh-autosuggestions zsh-syntax-highlighting"
7265
},
66+
"ghcr.io/devcontainers/features/aws-cli:1": {},
7367
"ghcr.io/devcontainers/features/common-utils": {
7468
"configureZshAsDefaultShell": true,
7569
"installOhMyZsh": true,
7670
"installOhMyZshConfig": true,
7771
"installZsh": true
7872
},
7973
"ghcr.io/devcontainers/features/docker-in-docker:2": {
80-
"azureDnsAutoDetection": true,
8174
"dockerDashComposeVersion": "v2",
8275
"installDockerBuildx": true,
8376
"installDockerComposeSwitch": true,
8477
"moby": true,
8578
"version": "latest"
86-
},
87-
"ghcr.io/devcontainers/features/dotnet:2": {
88-
"aspNetCoreRuntimeVersions": "8.0",
89-
"dotnetRuntimeVersions": "8.0",
90-
"version": "8.0"
91-
},
92-
"ghcr.io/devcontainers/features/go:1": {},
93-
"ghcr.io/devcontainers/features/java:1": {
94-
"version": "17"
95-
},
96-
"ghcr.io/devcontainers/features/node:1": {},
97-
"ghcr.io/devcontainers/features/python:1": {},
98-
"ghcr.io/devcontainers/features/ruby:1": {}
79+
}
9980
},
100-
"image": "mcr.microsoft.com/devcontainers/base:noble",
10181
"mounts": [
102-
"source=${localEnv:HOME}/.gnupg,target=/home/vscode/.gnupg,type=bind,consistency=cached"
82+
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
83+
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached"
10384
],
104-
"name": "Ubuntu",
85+
"name": "Devcontainer",
10586
"postCreateCommand": "scripts/devcontainer/postcreatecommand.sh"
10687
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313
with:
1414
node-version: 18
1515
- name: Npm cli install
16-
working-directory: ./docs
16+
working-directory: .
1717
run: npm ci
1818
shell: bash
1919
- name: Setup Ruby
Lines changed: 69 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
name: "Build Proxies"
22
description: "Build Proxies"
3+
34
inputs:
45
version:
56
description: "Version number"
7+
required: false
8+
releaseVersion:
9+
description: "Release, tag, branch, or commit ID to be used for deployment"
10+
required: true
11+
environment:
12+
description: "Deployment environment"
13+
required: true
14+
apimEnv:
15+
description: "APIM environment"
16+
required: true
17+
runId:
18+
description: "GitHub Actions run ID to fetch the OAS artifact from"
619
required: true
20+
buildSandbox:
21+
description: "Whether to build the sandbox OAS spec"
22+
required: false
23+
default: false
24+
targetComponent:
25+
description: "Name of the Component to deploy"
26+
required: true
27+
default: 'api'
28+
729
runs:
830
using: composite
931

@@ -19,76 +41,76 @@ runs:
1941
run: npm ci
2042
shell: bash
2143

22-
2344
- name: Setup Proxy Name and target
2445
shell: bash
2546
run: |
2647
48+
ENV="${{ inputs.apimEnv }}"
49+
if [[ "$ENV" == "internal-dev" || "$ENV" == *pr ]]; then
50+
echo "TARGET_DOMAIN=suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
51+
elif [[ "$ENV" == "int" ]]; then
52+
echo "TARGET_DOMAIN=suppliers.nonprod.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
53+
elif [[ "$ENV" == "prod" ]]; then
54+
echo "TARGET_DOMAIN=suppliers.prod.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
55+
else
56+
echo "TARGET_DOMAIN=suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
57+
fi
58+
2759
if [ -z $PR_NUMBER ]
2860
then
2961
echo "INSTANCE=$PROXYGEN_API_NAME" >> $GITHUB_ENV
30-
echo "TARGET=https://main.suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
62+
echo "TARGET=https://main.$TARGET_DOMAIN" >> $GITHUB_ENV
3163
echo "SANDBOX_TAG=latest" >> $GITHUB_ENV
3264
echo "MTLS_NAME=notify-supplier-mtls" >> $GITHUB_ENV
3365
else
34-
echo "TARGET=https://pr$PR_NUMBER.suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
66+
echo "TARGET=https://pr$PR_NUMBER.$TARGET_DOMAIN" >> $GITHUB_ENV
3567
echo "INSTANCE=$PROXYGEN_API_NAME-PR-$PR_NUMBER" >> $GITHUB_ENV
3668
echo "SANDBOX_TAG=pr$PR_NUMBER" >> $GITHUB_ENV
3769
echo "MTLS_NAME=notify-supplier-mtls-pr$PR_NUMBER" >> $GITHUB_ENV
38-
3970
fi
4071
41-
42-
- name: Install Proxygen client
43-
shell: bash
44-
run: |
45-
# Install proxygen cli
46-
pip install pipx
47-
pipx install proxygen-cli
48-
49-
# Setup proxygen auth and settings
50-
mkdir -p ${HOME}/.proxygen
51-
echo -n $PROXYGEN_PRIVATE_KEY | base64 --decode > ${HOME}/.proxygen/key
52-
envsubst < ./.github/proxygen-credentials-template.yaml > ${HOME}/.proxygen/credentials.yaml
53-
envsubst < ./.github/proxygen-credentials-template.yaml | cat
54-
envsubst < ./.github/proxygen-settings.yaml > ${HOME}/.proxygen/settings.yaml
55-
envsubst < ./.github/proxygen-settings.yaml | cat
56-
57-
58-
- name: Build internal dev oas
72+
- name: Build ${{ inputs.apimEnv }} oas
5973
working-directory: .
74+
env:
75+
APIM_ENV: ${{ inputs.apimEnv }}
6076
shell: bash
6177
run: |
62-
if [ -z $PR_NUMBER ]
78+
if [ ${{ env.APIM_ENV }} == "internal-dev-sandbox" ] && [ ${{ inputs.buildSandbox }} == true ]
6379
then
64-
make build-json-oas-spec APIM_ENV=internal-dev
80+
echo "Building sandbox OAS spec"
81+
make build-json-oas-spec APIM_ENV=sandbox
6582
else
66-
make build-json-oas-spec APIM_ENV=internal-dev-pr
83+
echo "Building env specific OAS spec"
84+
make build-json-oas-spec APIM_ENV=${{ env.APIM_ENV }}
6785
fi
6886
69-
- name: Set target and cert
70-
shell: bash
71-
run: |
72-
jq --arg newurl "$TARGET" '.["x-nhsd-apim"].target.url = $newurl' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json
73-
jq --arg newmtls "$MTLS_NAME" '.["x-nhsd-apim"].target.security.secret = $newmtls' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json
74-
75-
- name: Deploy to Internal Dev
76-
shell: bash
77-
run: |
78-
proxygen instance deploy internal-dev $INSTANCE build/notify-supplier.json --no-confirm
79-
80-
- name: Build sandbox oas
81-
working-directory: .
82-
shell: bash
83-
run: |
84-
make build-json-oas-spec APIM_ENV=sandbox
87+
if [[ $APIM_ENV == *-pr ]]; then
88+
echo "Removing pr suffix from APIM_ENV after building OAS and calling proxygen"
89+
APIM_ENV=$(echo "$APIM_ENV" | sed 's/-pr$//')
90+
fi
91+
echo "APIM_ENV=$APIM_ENV" >> $GITHUB_ENV
8592
86-
- name: Set docker tag
87-
shell: bash
88-
run: |
89-
jq --arg newtag "$SANDBOX_TAG" '.["x-nhsd-apim"].target.containers[0].image.tag = $newtag' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json
93+
- name: Upload OAS Spec
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: ${{ env.APIM_ENV }}-build-output
97+
path: ./build
9098

91-
- name: Deploy to Internal Dev Sandbox
99+
- name: Trigger deploy proxy
100+
env:
101+
APP_CLIENT_ID: ${{ env.APP_CLIENT_ID }}
102+
APP_PEM_FILE: ${{ env.APP_PEM_FILE }}
92103
shell: bash
93104
run: |
94-
proxygen instance deploy internal-dev-sandbox $INSTANCE build/notify-supplier.json --no-confirm
105+
.github/scripts/dispatch_internal_repo_workflow.sh \
106+
--infraRepoName "nhs-notify-supplier-api" \
107+
--releaseVersion "${{ inputs.releaseVersion }}" \
108+
--targetComponent "${{ inputs.targetComponent }}" \
109+
--targetWorkflow "proxy-deploy.yaml" \
110+
--targetEnvironment "${{ inputs.environment }}" \
111+
--runId "${{ inputs.runId }}" \
112+
--buildSandbox ${{ inputs.buildSandbox }} \
113+
--apimEnvironment "${{ env.APIM_ENV }}" \
114+
--boundedContext "notify-supplier" \
115+
--targetDomain "$TARGET_DOMAIN" \
116+
--version "${{ inputs.version }}"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ runs:
5353
- name: Upload API OAS specification artifact
5454
uses: actions/upload-artifact@v4
5555
with:
56-
path: "specification/api"
56+
path: "build"
5757
name: api-oas-specification-${{ inputs.version }}
5858

5959
- name: Upload html artifact

.github/copilot-instructions.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copilot Instructions for NHS Notify Supplier API
2+
3+
## Project Overview
4+
5+
- This repository provides the NHS Notify Supplier API for print suppliers to integrate with NHS Notify message queueing.
6+
- Major components: OpenAPI specification (`specification/api/notify-supplier.yml`), SDKs (`sdk/`), server implementations (`server/`, `src/server/host`), and Lambda handlers (`lambdas/`).
7+
- Data flows: API requests are modeled via OAS, processed by server/Lambda code, and may interact with AWS services (e.g., S3, database).
8+
9+
## Developer Workflows
10+
11+
- **Build SDKs and Docs:**
12+
- Run `make clean && make build` to generate Python/TypeScript SDKs and HTML docs from the OAS spec.
13+
- Serve docs locally with `make serve` [default](http://localhost:3050).
14+
- **CI/CD:**
15+
- PRs trigger CI via GitHub Actions (`.github/workflows/cicd-1-pull-request.yaml`).
16+
- Merging to `main` creates a pre-release; deployments use `.github/workflows/cicd-3-deploy.yaml`.
17+
- **Dev Environment:**
18+
- Use the provided devcontainer for setup and configuration. Avoid manual SDK changes; always rebuild.
19+
20+
## Project-Specific Conventions
21+
22+
- **SDKs:**
23+
- Never manually edit files in `sdk/`; always regenerate from the OAS spec.
24+
- SDK folder is excluded from git and built/released via CI.
25+
- **Servers:**
26+
- Server code is generated at build time from OAS specs. See `server/` and `src/server/host` for custom logic.
27+
- **Test Data:**
28+
- Use `scripts/test-data` to generate and upload test letters to S3. Example command:
29+
30+
```bash
31+
npm run cli -- create-letter --supplier-id ... --environment ... --awsAccountId ... --letter-id ... --group-id ... --specification-id ... --status PENDING
32+
```
33+
34+
## Integration Points
35+
36+
- **External Services:**
37+
- AWS S3 and database for test data and letter storage.
38+
- OpenAPI Generator CLI for SDK/server generation.
39+
- **Documentation:**
40+
- Latest [docs](https://nhsdigital.github.io/nhs-notify-supplier-api/)
41+
- Local docs: `make serve`
42+
43+
## Key Files & Directories
44+
45+
- `specification/api/notify-supplier.yml`: Main API spec
46+
- `sdk/`: Generated SDKs (Python, TypeScript, CSharp)
47+
- `server/`, `src/server/host`: Server implementations
48+
- `lambdas/`: Lambda handlers
49+
- `scripts/test-data/`: Test data generation scripts
50+
- `docs/`: Documentation source
51+
52+
## Patterns & Examples
53+
54+
- Always regenerate SDKs/servers after spec changes.
55+
- Use Makefile targets for all build/test workflows.
56+
- Reference the README for up-to-date workflow and integration details.
57+
58+
---
59+
For unclear or missing conventions, consult `/README.md` or ask maintainers for guidance.

0 commit comments

Comments
 (0)