Skip to content

Commit 6f040f2

Browse files
Merge branch 'main' into AEA-5899
2 parents 3aaad86 + 10a4cd3 commit 6f040f2

19 files changed

+529
-410
lines changed

.devcontainer/Dockerfile

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,39 @@
11
FROM mcr.microsoft.com/devcontainers/base:ubuntu
22

3+
# provide DOCKER_GID via build args if you need to force group id to match host
4+
ARG DOCKER_GID
5+
ARG TARGETARCH
6+
ENV TARGETARCH=${TARGETARCH}
7+
8+
ARG ASDF_VERSION
9+
COPY .tool-versions.asdf /tmp/.tool-versions.asdf
10+
11+
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then dpkg --add-architecture arm64; fi
12+
13+
# Anticipate and resolve potential permission issues with apt
14+
RUN mkdir -p /tmp && chmod 1777 /tmp
15+
16+
# Install system dependencies
317
RUN apt-get update \
418
&& export DEBIAN_FRONTEND=noninteractive \
519
&& apt-get -y dist-upgrade \
620
&& apt-get -y install --no-install-recommends htop vim curl git build-essential \
721
libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev libbz2-dev \
822
zlib1g-dev unixodbc unixodbc-dev libsecret-1-0 libsecret-1-dev libsqlite3-dev \
923
openjdk-8-jdk jq apt-transport-https ca-certificates gnupg-agent \
10-
software-properties-common bash-completion python3-pip make libbz2-dev \
24+
software-properties-common bash-completion python3-pip make \
1125
libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
12-
xz-utils tk-dev liblzma-dev netcat-traditional
26+
xz-utils tk-dev liblzma-dev netcat-traditional libyaml-dev
1327

14-
# Install ASDF
15-
RUN wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v0.16.4/asdf-v0.16.4-linux-amd64.tar.gz; \
16-
tar -xvzf /tmp/asdf.tar.gz; \
17-
mv asdf /usr/bin
28+
# specify DOCKER_GID to force container docker group id to match host
29+
RUN if [ -n "${DOCKER_GID}" ]; then \
30+
if ! getent group docker; then \
31+
groupadd -g ${DOCKER_GID} docker; \
32+
else \
33+
groupmod -g ${DOCKER_GID} docker; \
34+
fi && \
35+
usermod -aG docker vscode; \
36+
fi
1837

1938
USER vscode
2039

@@ -23,19 +42,23 @@ RUN \
2342
echo 'PATH="/home/vscode/.asdf/shims/:$PATH"' >> ~/.bashrc; \
2443
echo '. <(asdf completion bash)' >> ~/.bashrc;
2544

26-
# Install ASDF plugins
27-
RUN asdf plugin add python; \
28-
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
29-
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
30-
asdf plugin add nodejs; \
31-
asdf plugin add actionlint; \
45+
ENV PATH="$PATH:/workspaces/electronic-prescription-service-api-regression-tests/node_modules/.bin"
46+
47+
# Install ASDF plugins for regression testing tools
48+
RUN asdf plugin add python && \
49+
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \
50+
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
51+
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git && \
52+
asdf plugin add actionlint && \
3253
asdf plugin add allure
3354

3455
WORKDIR /workspaces/electronic-prescription-service-api-regression-tests
3556
ADD .tool-versions /workspaces/electronic-prescription-service-api-regression-tests/.tool-versions
3657
ADD .tool-versions /home/vscode/.tool-versions
3758

38-
RUN asdf install; \
39-
asdf reshim python; \
40-
asdf reshim poetry; \
41-
asdf reshim nodejs;
59+
# install python before poetry to ensure correct python version is used
60+
RUN asdf install python && \
61+
asdf install && \
62+
asdf reshim python && \
63+
asdf reshim poetry && \
64+
asdf reshim nodejs

.devcontainer/devcontainer.json

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
33
{
44
"name": "Ubuntu",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
65
"build": {
76
"dockerfile": "Dockerfile",
87
"context": "..",
9-
"args": {}
8+
"args": {
9+
"DOCKER_GID": "${env:DOCKER_GID:}"
10+
}
1011
},
11-
"runArgs": [
12-
"--network=host"
13-
],
1412
"mounts": [
13+
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",
1514
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
16-
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind"
15+
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind",
16+
"source=${env:HOME}${env:USERPROFILE}/.gitconfig,target=/home/vscode/.gitconfig,type=bind"
1717
],
18-
// Features to add to the dev container. More info: https://containers.dev/features.
1918
"features": {
2019
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
2120
"version": "latest",
@@ -24,64 +23,61 @@
2423
},
2524
"ghcr.io/devcontainers/features/github-cli:1": {}
2625
},
26+
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}/" },
2727
"customizations": {
2828
"vscode": {
2929
"extensions": [
30+
"AmazonWebServices.aws-toolkit-vscode",
3031
"redhat.vscode-yaml",
3132
"ms-python.python",
33+
"ms-python.black-formatter",
34+
"ms-python.flake8",
35+
"ms-python.pylint",
3236
"eamodio.gitlens",
3337
"github.vscode-pull-request-github",
34-
"orta.vscode-jest",
3538
"42crunch.vscode-openapi",
3639
"mermade.openapi-lint",
37-
"rvest.vs-code-prettier-eslint",
38-
"dbaeumer.vscode-eslint",
3940
"lfm.vscode-makefile-term",
4041
"GrapeCity.gc-excelviewer",
4142
"redhat.vscode-xml",
4243
"streetsidesoftware.code-spell-checker",
4344
"timonwong.shellcheck",
4445
"github.vscode-github-actions",
45-
"ms-python.pylint",
46-
"ms-python.black-formatter",
4746
"jimasp.behave-vsc",
4847
"Gruntfuggly.todo-tree"
4948
],
5049
"settings": {
51-
"python.defaultInterpreterPath": "/workspaces/electronic-prescription-service-api-regression-tests/.venv/bin/python",
50+
"python.defaultInterpreterPath": "/home/vscode/.asdf/shims/python",
5251
"python.analysis.autoSearchPaths": true,
5352
"python.analysis.extraPaths": [],
5453
"python.testing.unittestEnabled": false,
55-
"python.testing.pytestEnabled": false,
56-
"python.linting.enabled": true, // required to format on save
57-
"python.experiments.optOutFrom": [
58-
"pythonTestAdapter"
59-
],
60-
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
61-
"editor.formatOnPaste": false, // required
62-
"editor.formatOnType": false, // required
63-
"editor.formatOnSave": true, // optional
54+
"python.testing.pytestEnabled": true,
55+
"python.linting.pylintEnabled": true,
56+
"python.linting.flake8Enabled": true,
57+
"python.linting.enabled": true,
58+
"python.formatting.provider": "black",
59+
"black-formatter.args": ["--line-length=120"],
60+
"[python]": {
61+
"editor.defaultFormatter": "ms-python.black-formatter"
62+
},
63+
"editor.formatOnPaste": false,
64+
"editor.formatOnType": false,
65+
"editor.formatOnSave": true,
6466
"editor.formatOnSaveMode": "file",
6567
"cSpell.words": [
6668
"fhir",
6769
"Formik",
6870
"pino",
69-
"serialisation"
70-
]
71+
"serialisation",
72+
"behave",
73+
"gherkin",
74+
"epsam",
75+
"bedrock",
76+
"allure"
77+
],
78+
"python.experiments.optOutFrom": ["pythonTestAdapter"]
7179
}
7280
}
7381
},
74-
"remoteEnv": {
75-
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
76-
},
77-
"postCreateCommand": "rm -f ~/.docker/config.json; git config --global --add safe.directory /workspaces/electronic-prescription-service-api-regression-tests; make install; docker build -f https://raw.githubusercontent.com/NHSDigital/eps-workflow-quality-checks/refs/heads/main/dockerfiles/nhsd-git-secrets.dockerfile -t git-secrets . && poetry run pre-commit install --install-hooks -f"
78-
// "features": {},
79-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
80-
// "forwardPorts": [],
81-
// Use 'postCreateCommand' to run commands after the container is created.
82-
// "postCreateCommand": ""
83-
// Configure tool-specific properties.
84-
// "customizations": {},
85-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
86-
// "remoteUser": "root"
82+
"postCreateCommand": "rm -f ~/.docker/config.json; git config --global --add safe.directory /workspaces/electronic-prescription-service-api-regression-tests; source ~/.bashrc; export PATH=\"/home/vscode/.asdf/shims:$PATH\"; make install"
8783
}

.github/config/settings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TAG_FORMAT: "v${version}"

.github/workflows/auto-merge-dependabot.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/pr-link.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/pull_request.yml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,41 @@ env:
88
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
99

1010
jobs:
11+
dependabot-auto-approve-and-merge:
12+
needs: quality_checks
13+
uses: NHSDigital/eps-common-workflows/.github/workflows/dependabot-auto-approve-and-merge.yml@41e3450a9869f278be0e431a4b47b5c77bd55559
14+
secrets:
15+
AUTOMERGE_APP_ID: ${{ secrets.AUTOMERGE_APP_ID }}
16+
AUTOMERGE_PEM: ${{ secrets.AUTOMERGE_PEM }}
17+
get_asdf_version:
18+
runs-on: ubuntu-22.04
19+
outputs:
20+
asdf_version: ${{ steps.asdf-version.outputs.version }}
21+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
25+
26+
- name: Get asdf version
27+
id: asdf-version
28+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
29+
- name: Load config value
30+
id: load-config
31+
run: |
32+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
33+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
34+
1135
quality_checks:
12-
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
36+
uses: NHSDigital/eps-common-workflows/.github/workflows/quality-checks.yml@41e3450a9869f278be0e431a4b47b5c77bd55559
37+
needs: [get_asdf_version]
38+
with:
39+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
40+
reinstall_poetry: true
1341
secrets:
1442
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1543

1644
pr_title_format_check:
17-
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/pr_title_check.yml@f3d071da30cd01dc0e4472ac0e2d7452db78d1c7
45+
uses: NHSDigital/eps-common-workflows/.github/workflows/pr_title_check.yml@41e3450a9869f278be0e431a4b47b5c77bd55559
1846

1947
run_basic_regression_test:
2048
uses: ./.github/workflows/regression_tests.yml
@@ -23,3 +51,13 @@ jobs:
2351
environment: INTERNAL-DEV
2452
product: EPS-FHIR
2553
id: "Pull Request Basic Regression Tests"
54+
tag_release:
55+
needs: [get_asdf_version]
56+
uses: NHSDigital/eps-common-workflows/.github/workflows/tag-release.yml@41e3450a9869f278be0e431a4b47b5c77bd55559
57+
with:
58+
dry_run: true
59+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
60+
branch_name: ${{ github.event.pull_request.head.ref }}
61+
publish_package: false
62+
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
63+
secrets: inherit

0 commit comments

Comments
 (0)