Skip to content

Commit d919005

Browse files
Merge remote-tracking branch 'origin/feature/GPCAPIM-396-sds-int' into feature/GPCAPIM-396-sds-int
2 parents 5bc53ce + f9d30a1 commit d919005

11 files changed

Lines changed: 30 additions & 83 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
22
"name": "gateway-api-build-container",
33
"build": {
4-
"dockerfile": "../infrastructure/images/build-container/Dockerfile",
5-
"args": {
6-
"INCLUDE_DEV_CERTS": "true"
7-
}
4+
"dockerfile": "../infrastructure/images/build-container/Dockerfile"
85
},
96
"customizations": {
107
"vscode": {

.github/workflows/stage-2-test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: make test-unit
5050
- name: "Upload unit test results"
5151
if: always()
52-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
52+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5353
with:
5454
name: unit-test-results
5555
path: gateway-api/test-artefacts/
@@ -79,7 +79,7 @@ jobs:
7979
run: make test-contract
8080
- name: "Upload contract test results"
8181
if: always()
82-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
82+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
8383
with:
8484
name: contract-test-results
8585
path: gateway-api/test-artefacts/
@@ -109,7 +109,7 @@ jobs:
109109
run: make test-schema
110110
- name: "Upload schema test results"
111111
if: always()
112-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
112+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
113113
with:
114114
name: schema-test-results
115115
path: gateway-api/test-artefacts/
@@ -139,7 +139,7 @@ jobs:
139139
run: make test-integration
140140
- name: "Upload integration test results"
141141
if: always()
142-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
142+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
143143
with:
144144
name: integration-test-results
145145
path: gateway-api/test-artefacts/
@@ -170,7 +170,7 @@ jobs:
170170
run: make test-acceptance
171171
- name: "Upload acceptance test results"
172172
if: always()
173-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
173+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
174174
with:
175175
name: acceptance-test-results
176176
path: gateway-api/test-artefacts/
@@ -214,7 +214,7 @@ jobs:
214214
mv coverage-merged.xml ${{ needs.create-coverage-name.outputs.coverage-name }}.xml
215215
- name: "Upload combined coverage report"
216216
if: always()
217-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
217+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
218218
with:
219219
name: ${{ needs.create-coverage-name.outputs.coverage-name }}
220220
path: gateway-api/test-artefacts

.github/workflows/test-bruno-collection.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: "Upload HTML results"
4343
if: always()
44-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
44+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
4545
with:
4646
name: bruno-results
4747
path: bruno/gateway-api/collections/Steel_Thread/results.html

Makefile

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ endif
2020
IMAGE_NAME := ${IMAGE_REPOSITORY}:${IMAGE_TAG}
2121
COMMIT_VERSION := $(shell git rev-parse --short HEAD)
2222
BUILD_DATE := $(shell date -u +"%Y%m%d")
23-
INCLUDE_DEV_CERTS ?= ${DEV_CERTS_INCLUDED}
2423
# ==============================================================================
2524

2625
# Example CI/CD targets are: dependencies, build, publish, deploy, clean, etc.
@@ -42,25 +41,13 @@ build-gateway-api: dependencies
4241
@rm -rf ../infrastructure/images/gateway-api/resources/build/
4342
@mkdir ../infrastructure/images/gateway-api/resources/build/
4443
@cp -r ./target/gateway-api ../infrastructure/images/gateway-api/resources/build/
45-
# If dev certificates are present inside the dev container, copy them into
46-
# the gateway-api image build context so they can be installed there too.
47-
@if [ -d "/resources/dev-certificates" ]; then \
48-
rm -rf ../infrastructure/images/gateway-api/resources/dev-certificates; \
49-
mkdir -p ../infrastructure/images/gateway-api/resources/dev-certificates; \
50-
cp -r /resources/dev-certificates/* ../infrastructure/images/gateway-api/resources/dev-certificates/; \
51-
fi
5244
# Remove temporary build artefacts once build has completed
5345
@rm -rf target && rm -rf dist
5446

5547
.PHONY: build
5648
build: build-gateway-api # Build the project artefact @Pipeline
5749
@echo "Building Docker x86 image using Docker. Utilising python version: ${PYTHON_VERSION} ..."
58-
@if [[ -n "$${IN_BUILD_CONTAINER}" ]]; then \
59-
echo "building with dev certs ..." ; \
60-
$(docker) buildx build --platform linux/amd64 --load --provenance=false --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg COMMIT_VERSION=${COMMIT_VERSION} --build-arg BUILD_DATE=${BUILD_DATE} --build-arg INCLUDE_DEV_CERTS=${INCLUDE_DEV_CERTS} -t ${IMAGE_NAME} infrastructure/images/gateway-api
61-
else \
62-
$(docker) buildx build --platform linux/amd64 --load --provenance=false --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg COMMIT_VERSION=${COMMIT_VERSION} --build-arg BUILD_DATE=${BUILD_DATE} -t ${IMAGE_NAME} infrastructure/images/gateway-api
63-
fi
50+
$(docker) buildx build --platform linux/amd64 --load --provenance=false --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg COMMIT_VERSION=${COMMIT_VERSION} --build-arg BUILD_DATE=${BUILD_DATE} -t ${IMAGE_NAME} infrastructure/images/gateway-api
6451
@echo "Docker image '${IMAGE_NAME}' built successfully!"
6552

6653
publish: # Publish the project artefact @Pipeline
@@ -102,11 +89,6 @@ stop:
10289
@$(docker) stop gateway-api || echo "No Gateway API container currently running."
10390

10491
config:: # Configure development environment (main) @Configuration
105-
# Configure poetry to trust dev certificate if specified
106-
@if [[ -n "$${DEV_CERTS_INCLUDED}" ]]; then \
107-
echo "Configuring poetry to trust the dev certificate..." ; \
108-
poetry config certificates.PyPI.cert /etc/ssl/cert.pem ; \
109-
fi
11092
make _install-dependencies
11193

11294
# ==============================================================================

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ The project is configured to run inside a [Dev Container](https://containers.dev
110110
The dev container sits on the same network, `gateway-local`, as [the `gateway-api` container](infrastructure/README.md#docker-images), if deployed. Docker DNS will resolve <http://gateway-api> to the deployed Gateway API.
111111

112112
> [!NOTE]
113-
> **Certificates:** If additional certificates are needed, add them to `infrastructure/images/build-container/resources/dev-certificates` and set the `INCLUDE_DEV_CERTS` Docker build argument to `true`.
114-
>
115113
> **WSL users:** Configure the Dev Containers extension with `{"dev.containers.executeInWSL": true}`, clone the repository into the WSL filesystem, connect VS Code to WSL first, then open the repository folder and build the container.
116114
117115
### Prerequisites

gateway-api/poetry.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gateway-api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ build-backend = "poetry.core.masonry.api"
4848
[dependency-groups]
4949
dev = [
5050
"mypy (>=1.18.2,<2.0.0)",
51-
"pytest>=8.0.0",
51+
"pytest>=9.0.3",
5252
"pytest-bdd (>=8.1.0,<9.0.0)",
5353
"pytest-cov (>=7.0.0,<8.0.0)",
5454
"pytest-html (>=4.1.1,<5.0.0)",

infrastructure/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The `preview/` environment creates an isolated, per-branch deployment of the Gat
3333
Key input variables:
3434

3535
| Variable | Description | Default |
36-
|---|---|---|
36+
| --- | --- | --- |
3737
| `branch_name` | Git branch name — used to derive the hostname and resource names | *(required)* |
3838
| `image_tag` | Docker image tag to deploy; defaults to `branch_name` if empty | `""` |
3939
| `base_domain` | Base domain for the preview URL | `dev.endpoints.clinical-data-gateway.national.nhs.uk` |
@@ -70,7 +70,6 @@ A dev container image used by CI/CD pipelines, based on the VS Code Alpine base
7070
- Python (via asdf)
7171
- Docker CLI and Buildx
7272
- Linters and checkers: vale, hadolint (via npm/markdownlint), ShellCheck
73-
- Development certificate support for machines behind corporate proxies
7473

7574
## Terraform Operations
7675

infrastructure/images/build-container/Dockerfile

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
1-
FROM mcr.microsoft.com/vscode/devcontainers/base:alpine3.23 AS gateway-build-container
1+
FROM mcr.microsoft.com/devcontainers/base:alpine3.23 AS gateway-build-container
22

33
ENV PYTHON_VERSION="3.14"
44

55
ENV ASDF_DOWNLOAD_URL="https://github.com/asdf-vm/asdf/releases/download/v0.18.1"
66
ENV EDITORCONFIG_DOWNLOAD_URL="https://github.com/editorconfig-checker/editorconfig-checker/releases/download/v3.6.1"
77

8-
ARG INCLUDE_DEV_CERTS
9-
ARG DEV_CERT_FILENAME
10-
11-
# Add development certificates to node if provided.
12-
ENV NODE_EXTRA_CA_CERTS=${INCLUDE_DEV_CERTS:+/etc/ssl/certs/ca-certificates.crt}
13-
ENV DEV_CERTS_INCLUDED=$INCLUDE_DEV_CERTS
14-
158
ENV IN_BUILD_CONTAINER=true
169

1710
COPY resources/ /resources
1811

19-
# Install required certificates for dev machines.
20-
RUN if [ "$INCLUDE_DEV_CERTS" = "true" ] ; then \
21-
cp -r /resources/dev-certificates/* /usr/local/share/ca-certificates/; \
22-
update-ca-certificates; \
23-
24-
cp -r /resources/dev-certificates/* /etc/ssl/certs/; \
25-
else \
26-
rm -r /resources/dev-certificates; \
27-
fi
28-
2912
RUN apk update && \
3013
apk add --no-cache --update bash \
3114
# Required to manage user permissions.
@@ -52,14 +35,13 @@ RUN apk update && \
5235
readline-dev \
5336
sqlite-dev \
5437
tk-dev \
55-
zstd-dev
56-
57-
# Configure doas to allow members of the wheel group to run commands as root.
58-
RUN echo "permit :wheel" >> /etc/doas.conf \
59-
&& echo "permit nopass :wheel as root cmd apk" >> /etc/doas.conf \
60-
&& echo "permit nopass :wheel as root cmd docker" >> /etc/doas.conf \
38+
zstd-dev && \
39+
# Configure doas to allow members of the wheel group to run commands as root.
40+
echo "permit :wheel" >> /etc/doas.conf && \
41+
echo "permit nopass :wheel as root cmd apk" >> /etc/doas.conf && \
42+
echo "permit nopass :wheel as root cmd docker" >> /etc/doas.conf && \
6143
# Change default shell to bash for root user.
62-
&& chsh -s /bin/bash root
44+
chsh -s /bin/bash root
6345

6446
# Ensure pyenv is on the PATH
6547
ENV PYENV_ROOT="/.pyenv"

infrastructure/images/gateway-api/Dockerfile

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,9 @@
22
ARG PYTHON_VERSION=invalid
33
FROM python:${PYTHON_VERSION}-alpine3.23 AS gateway-api
44

5-
# Controls whether dev certificates (if present) are installed into this image.
6-
ARG INCLUDE_DEV_CERTS=false
7-
85
COPY resources/ /resources
96

10-
# Install required certificates for dev machines.
11-
RUN if [ "$INCLUDE_DEV_CERTS" = "true" ] && [ -d /resources/dev-certificates ]; then \
12-
cp -r /resources/dev-certificates/* /usr/local/share/ca-certificates/; \
13-
update-ca-certificates; \
14-
cp -r /resources/dev-certificates/* /etc/ssl/certs/; \
15-
else \
16-
rm -rf /resources/dev-certificates || true; \
17-
fi && \
18-
apk upgrade --no-cache && \
7+
RUN apk upgrade --no-cache && \
198
pip install --no-cache-dir --upgrade pip && \
209
addgroup -S nonroot && \
2110
adduser -S gateway_api_user -G nonroot

0 commit comments

Comments
 (0)