Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/actions/acceptance-tests-components/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,51 @@ runs:
run: |
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT

- name: Start sandbox container if needed
if: ${{ inputs.testType == 'sandbox' }}
shell: bash
run: |
SANDBOX_CONTAINER_NAME="supplier-api-sandbox"
SANDBOX_IMAGE_TAG="latest"
if [[ "${{ inputs.targetEnvironment }}" =~ ^pr[0-9]+$ ]]; then
SANDBOX_IMAGE_TAG="${{ inputs.targetEnvironment }}"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
SANDBOX_IMAGE_TAG="pr${{ github.event.pull_request.number }}"
fi

SANDBOX_IMAGE="nhs-notify-supplier:${SANDBOX_IMAGE_TAG}"

if docker image inspect "$SANDBOX_IMAGE" >/dev/null 2>&1; then
echo "Using sandbox image: $SANDBOX_IMAGE"
elif docker image inspect "supplier-api-sandbox" >/dev/null 2>&1; then
SANDBOX_IMAGE="supplier-api-sandbox"
echo "Using fallback sandbox image: $SANDBOX_IMAGE"
else
echo "Sandbox image not found. Tried: nhs-notify-supplier:${SANDBOX_IMAGE_TAG}, supplier-api-sandbox"
echo "Available images:"
docker images --format '{{.Repository}}:{{.Tag}}' | grep -E 'nhs-notify-supplier|supplier-api-sandbox' || true
exit 1
fi

docker rm -f "$SANDBOX_CONTAINER_NAME" 2>/dev/null || true
docker run -d --name "$SANDBOX_CONTAINER_NAME" -p 9000:9000 "$SANDBOX_IMAGE"

for _ in {1..30}; do
if curl --silent --fail http://127.0.0.1:9000/_status >/dev/null; then
exit 0
fi
sleep 1
done

echo "Sandbox container did not become healthy in time"
docker logs "$SANDBOX_CONTAINER_NAME" || true
exit 1

- name: Run test - ${{ inputs.testType }}
shell: bash
env:
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
TARGET_ACCOUNT_GROUP: ${{ inputs.targetAccountGroup }}
SUPPLIER_API_URL_SANDBOX: ${{ inputs.testType == 'sandbox' && 'http://127.0.0.1:9000' || github.event_name == 'pull_request' && format('https://internal-dev-sandbox.api.service.nhs.uk/nhs-notify-supplier-PR-{0}', github.event.pull_request.number) || 'https://internal-dev-sandbox.api.service.nhs.uk/nhs-notify-supplier' }}
run: |
make test-${{ inputs.testType }}
2 changes: 1 addition & 1 deletion .github/actions/acceptance-tests-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ runs:
else
echo "pr_number=$env" >> $GITHUB_OUTPUT
fi

# mimic this for the sandbox test. I only want to run them when proxy is deployed
- name: Determine if proxy has been deployed
id: check_proxy_deployed
env:
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/build-proxies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,5 @@ runs:
--apimEnvironment "${{ env.APIM_ENV }}" \
--boundedContext "notify-supplier" \
--targetDomain "$TARGET_DOMAIN" \
--version "${{ inputs.version }}"
--version "${{ inputs.version }}" \
--internalRef "fix/CCM-22538_deploy_sandbox_server"
3 changes: 2 additions & 1 deletion .github/actions/test-types.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"component",
"e2e"
"e2e",
"sandbox"
]
3 changes: 2 additions & 1 deletion .github/workflows/stage-4-acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ jobs:
--targetEnvironment "$ENVIRONMENT" \
--targetAccountGroup "nhs-notify-supplier-api-dev" \
--targetComponent "api" \
--extraSecretNames '["/dev/e2e/keys/apim/main","/dev/e2e/keys/apim/pr","/dev/e2e/keys/apim/pr/secondary","/dev/e2e/keys/apim/status","/dev/e2e/keys/private"]'
--extraSecretNames '["/dev/e2e/keys/apim/main","/dev/e2e/keys/apim/pr","/dev/e2e/keys/apim/pr/secondary","/dev/e2e/keys/apim/status","/dev/e2e/keys/private"]' \
--internalRef "fix/CCM-22538_deploy_sandbox_server"
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.22.0
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- vale off -->

# NHS Notify Supplier API

[![1. CI/CD pull request](https://github.com/NHSDigital/nhs-notify-supplier-api/actions/workflows/cicd-1-pull-request.yaml/badge.svg)](https://github.com/NHSDigital/nhs-notify-supplier-api/actions/workflows/cicd-1-pull-request.yaml)
Expand Down Expand Up @@ -29,6 +30,7 @@ This repository documents the Supplier API specification and provides an SDK wit
- [Prerequisites and Configuration](#prerequisites-and-configuration)
- [SDKs](#sdks)
- [Build](#build)
- [Unit Testing](#unit-testing)
- [Documentation](#documentation-1)
- [GitHub Actions CI/CD](#github-actions-cicd)
- [CI (Automatic)](#ci-automatic)
Expand Down Expand Up @@ -99,14 +101,14 @@ New developers of the NHS Notify Supplier API should understand the below.
- In the project's root directory create an `.env` file based on the `.env.template` file and fill variables as needed.
- Create the file `~/.npmrc` with the contents:

```dsconfig
# Authenticate to GitHub Packages for github.com
//npm.pkg.github.com/:_authToken=<Insert your Github PAT (Personal Access Token)>
```dsconfig
# Authenticate to GitHub Packages for github.com
//npm.pkg.github.com/:_authToken=<Insert your Github PAT (Personal Access Token)>


# Package is scoped under @org, set registry for that scope
@nhsdigital:registry=https://npm.pkg.github.com
```
# Package is scoped under @org, set registry for that scope
@nhsdigital:registry=https://npm.pkg.github.com
```

- Install `node` (to run `npm install` and build the project)
- Install `aws cli` to be able to connect to AWS (needed for some tests)
Expand Down
Loading
Loading