Skip to content

Commit 454e186

Browse files
committed
Merge remote-tracking branch 'origin/main' into old_hapi
2 parents 8f5b75a + 0ae0e2a commit 454e186

31 files changed

+1005
-7953
lines changed

.devcontainer/Dockerfile

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
FROM mcr.microsoft.com/devcontainers/base:ubuntu
22

3+
ARG TARGETARCH
4+
ENV TARGETARCH=${TARGETARCH}
5+
6+
ARG ASDF_VERSION
7+
COPY .tool-versions.asdf /tmp/.tool-versions.asdf
8+
9+
# Add amd64 architecture if on arm64
10+
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then dpkg --add-architecture amd64; fi
11+
312
RUN apt-get update \
413
&& export DEBIAN_FRONTEND=noninteractive \
514
&& apt-get -y dist-upgrade \
@@ -9,50 +18,63 @@ RUN apt-get update \
918
jq apt-transport-https ca-certificates gnupg-agent \
1019
software-properties-common bash-completion python3-pip make libbz2-dev \
1120
libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
12-
xz-utils tk-dev liblzma-dev netcat ruby-full build-essential zlib1g-dev \
21+
xz-utils tk-dev liblzma-dev netcat-traditional ruby-full build-essential zlib1g-dev \
1322
&& apt remove -y openjdk-8-jdk-headless openjdk-8-jre-headless openjdk-8-jre
1423

15-
# install aws stuff
16-
RUN wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \
24+
# Download correct AWS CLI for arch
25+
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
26+
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"; \
27+
else \
28+
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"; \
29+
fi && \
1730
unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
1831
/tmp/aws-cli/aws/install && \
19-
rm tmp/awscliv2.zip && \
20-
rm -rf /tmp/aws-cli
21-
22-
RUN wget -O /tmp/aws-sam-cli.zip https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip && \
32+
rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli
33+
34+
# Download correct SAM CLI for arch
35+
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
36+
wget -O /tmp/aws-sam-cli.zip "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-arm64.zip"; \
37+
else \
38+
wget -O /tmp/aws-sam-cli.zip "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip"; \
39+
fi && \
2340
unzip /tmp/aws-sam-cli.zip -d /tmp/aws-sam-cli && \
2441
/tmp/aws-sam-cli/install && \
25-
rm /tmp/aws-sam-cli.zip && \
26-
rm -rf /tmp/aws-sam-cli
27-
28-
USER vscode
42+
rm /tmp/aws-sam-cli.zip && rm -rf /tmp/aws-sam-cli
2943

3044
# Install ASDF
31-
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \
32-
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
33-
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc; \
45+
RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf) && \
46+
if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
47+
wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-arm64.tar.gz; \
48+
else \
49+
wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-amd64.tar.gz; \
50+
fi && \
51+
tar -xvzf /tmp/asdf.tar.gz && \
52+
mv asdf /usr/bin
53+
54+
55+
USER vscode
56+
57+
ENV PATH="/home/vscode/.asdf/shims/:$PATH"
58+
RUN \
59+
echo 'PATH="/home/vscode/.asdf/shims/:$PATH"' >> ~/.bashrc; \
60+
echo '. <(asdf completion bash)' >> ~/.bashrc; \
3461
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc; \
3562
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc; \
3663
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc;
3764

38-
ENV PATH="$PATH:/home/vscode/.asdf/bin/"
39-
40-
4165
# Install ASDF plugins
42-
RUN asdf plugin add python; \
43-
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
44-
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
45-
asdf plugin-add java; \
46-
asdf plugin-add maven; \
47-
asdf plugin add direnv; \
48-
asdf plugin add actionlint; \
66+
RUN asdf plugin add python && \
67+
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \
68+
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git && \
69+
asdf plugin add java && \
70+
asdf plugin add maven && \
71+
asdf plugin add direnv && \
72+
asdf plugin add actionlint && \
4973
asdf plugin add nodejs;
5074

5175
WORKDIR /workspaces/validation-service-fhir-r4
5276
ADD .tool-versions /workspaces/validation-service-fhir-r4/.tool-versions
5377
ADD .tool-versions /home/vscode/.tool-versions
5478

55-
RUN asdf install; \
56-
asdf reshim python; \
57-
asdf reshim poetry; \
58-
asdf reshim java;
79+
RUN asdf install python && \
80+
asdf install

.devcontainer/devcontainer.json

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@
1313
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
1414
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind"
1515
],
16-
// Features to add to the dev container. More info: https://containers.dev/features.
17-
"features": {
18-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
19-
"version": "latest",
20-
"moby": "true",
21-
"installDockerBuildx": "true"
22-
}
23-
},
2416
"customizations": {
2517
"vscode": {
2618
"extensions": [
@@ -61,16 +53,15 @@
6153
}
6254
}
6355
},
64-
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" },
65-
"postCreateCommand": "rm -f ~/.docker/config.json; git config --global --add safe.directory /workspaces/eps-FHIR-validator-lambda; make install"
66-
// "features": {},
67-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
68-
// "forwardPorts": [],
69-
// Use 'postCreateCommand' to run commands after the container is created.
70-
// "postCreateCommand": ""
71-
// Configure tool-specific properties.
72-
// "customizations": {},
73-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
74-
// "remoteUser": "root"
56+
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" },
57+
"postAttachCommand": "docker build -f https://raw.githubusercontent.com/NHSDigital/eps-workflow-quality-checks/refs/tags/v4.0.4/dockerfiles/nhsd-git-secrets.dockerfile -t git-secrets . && poetry run pre-commit install --install-hooks -f",
58+
"features": {
59+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
60+
"version": "latest",
61+
"moby": "true",
62+
"installDockerBuildx": "true"
63+
},
64+
"ghcr.io/devcontainers/features/github-cli:1": {}
65+
}
7566
}
7667

.gitallowed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ CidrIp: 0\.0\.0\.0/0
3333
.*nhsd-rules-deny.txt.*
3434
.*\.venv.*
3535
.*node_modules.*
36+
pom\.xml
37+
poetry\.lock

.github/actions/mark_jira_released/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ runs:
1212
using: "composite"
1313
steps:
1414
- name: connect to dev account
15-
uses: aws-actions/configure-aws-credentials@v4
15+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8
1616
with:
1717
aws-region: eu-west-2
1818
role-to-assume: ${{ inputs.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}

.github/actions/update_confluence_jira/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ runs:
2828
using: "composite"
2929
steps:
3030
- name: connect to target account
31-
uses: aws-actions/configure-aws-credentials@v4
31+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8
3232
with:
3333
aws-region: eu-west-2
3434
role-to-assume: ${{ inputs.TARGET_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
@@ -42,7 +42,7 @@ runs:
4242
run: ./get_target_deployed_tag.sh
4343

4444
- name: connect to dev account
45-
uses: aws-actions/configure-aws-credentials@v4
45+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8
4646
with:
4747
aws-region: eu-west-2
4848
role-to-assume: ${{ inputs.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
@@ -54,7 +54,7 @@ runs:
5454
run: ./get_current_dev_tag.sh
5555

5656
- name: connect to dev account to run release notes lambda
57-
uses: aws-actions/configure-aws-credentials@v4
57+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8
5858
with:
5959
aws-region: eu-west-2
6060
role-to-assume: ${{ inputs.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}

.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/dependabot.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,54 @@ updates:
1919
# default location of `.github/workflows`
2020
directory: "/"
2121
schedule:
22-
interval: "daily"
22+
interval: "weekly"
23+
day: "friday"
24+
time: "18:00" # UTC
25+
open-pull-requests-limit: 20
2326
commit-message:
2427
prefix: "Upgrade: [dependabot] - "
2528

29+
2630
###################################
2731
# Java workspace ##################
2832
###################################
2933
- package-ecosystem: "maven"
3034
directory: "/"
3135
rebase-strategy: "disabled"
3236
schedule:
33-
interval: "daily"
37+
interval: "weekly"
38+
day: "friday"
39+
time: "18:00" # UTC
3440
open-pull-requests-limit: 20
3541
commit-message:
3642
prefix: "Upgrade: [dependabot] - "
3743

44+
3845
###################################
3946
# Poetry #########################
4047
###################################
4148
- package-ecosystem: "pip"
4249
directory: "/"
4350
schedule:
44-
interval: "daily"
45-
versioning-strategy: increase
51+
interval: "weekly"
52+
day: "friday"
53+
time: "18:00" # UTC
54+
open-pull-requests-limit: 20
4655
commit-message:
4756
prefix: "Upgrade: [dependabot] - "
57+
versioning-strategy: increase
58+
4859

4960
###################################
5061
# NPM workspace ##################
5162
###################################
5263
- package-ecosystem: "npm"
5364
directory: "/"
5465
schedule:
55-
interval: "daily"
56-
versioning-strategy: increase
66+
interval: "weekly"
67+
day: "friday"
68+
time: "18:00" # UTC
69+
open-pull-requests-limit: 20
5770
commit-message:
5871
prefix: "Upgrade: [dependabot] - "
72+
versioning-strategy: increase

.github/workflows/ci.yml

Lines changed: 29 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,30 @@ env:
88
BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }}
99

1010
jobs:
11+
get_asdf_version:
12+
runs-on: ubuntu-22.04
13+
outputs:
14+
asdf_version: ${{ steps.asdf-version.outputs.version }}
15+
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
19+
20+
- name: Get asdf version
21+
id: asdf-version
22+
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
23+
- name: Load config value
24+
id: load-config
25+
run: |
26+
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
27+
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
1128
quality_checks:
12-
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/quality-checks.yml@v4.1.1
29+
uses: NHSDigital/eps-common-workflows/.github/workflows/quality-checks.yml@9791a77de7b005056b4ddfb9789306f5179f53da
30+
needs: [get_asdf_version]
1331
secrets:
1432
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1533
with:
34+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
1635
install_java: true
1736

1837
get_commit_id:
@@ -26,69 +45,15 @@ jobs:
2645
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
2746
2847
tag_release:
29-
needs: quality_checks
30-
runs-on: ubuntu-22.04
31-
outputs:
32-
version_tag: ${{steps.output_version_tag.outputs.VERSION_TAG}}
33-
steps:
34-
- name: Checkout code
35-
uses: actions/checkout@v5
36-
with:
37-
ref: ${{ env.BRANCH_NAME }}
38-
fetch-depth: 0
39-
40-
# using git commit sha for version of action to ensure we have stable version
41-
- name: Install asdf
42-
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
43-
with:
44-
asdf_branch: v0.11.3
45-
46-
- name: Cache asdf
47-
uses: actions/cache@v4
48-
with:
49-
path: |
50-
~/.asdf
51-
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
52-
restore-keys: |
53-
${{ runner.os }}-asdf-
54-
55-
- name: Install asdf dependencies in .tool-versions
56-
uses: asdf-vm/actions/install@1902764435ca0dd2f3388eea723a4f92a4eb8302
57-
with:
58-
asdf_branch: v0.11.3
59-
env:
60-
PYTHON_CONFIGURE_OPTS: --enable-shared
61-
62-
- name: Install node packages
63-
run: |
64-
make install-node
65-
66-
- name: Set VERSION_TAG env var to be short git SHA and get next tag varsion
67-
id: output_version_tag
68-
run: |
69-
VERSION_TAG=$(git rev-parse --short HEAD)
70-
npx semantic-release --dry-run > semantic-release-output.log
71-
NEXT_VERSION=$(grep -i 'The next release version is' semantic-release-output.log | sed -E 's/.* ([[:digit:].]+)$/\1/')
72-
if [ -z "${NEXT_VERSION}" ]
73-
then
74-
echo "Could not get next tag. Here is the log from semantic-release"
75-
cat semantic-release-output.log
76-
exit 1
77-
fi
78-
tagFormat=$(node -e "const config=require('./release.config.js'); console.log(config.tagFormat)")
79-
if [ "${tagFormat}" = "null" ]
80-
then
81-
tagFormat="v\${version}"
82-
fi
83-
# disabling shellcheck as replace does not work
84-
# shellcheck disable=SC2001
85-
NEW_VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/")
86-
echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
87-
echo "## NEXT TAG WILL BE : ${NEW_VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY"
88-
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
89-
echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV"
90-
env:
91-
GITHUB_TOKEN: ${{ github.token }}
48+
needs: [quality_checks, get_commit_id, get_asdf_version]
49+
uses: NHSDigital/eps-common-workflows/.github/workflows/tag-release.yml@9791a77de7b005056b4ddfb9789306f5179f53da
50+
with:
51+
dry_run: true
52+
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
53+
branch_name: main
54+
publish_package: false
55+
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
56+
secrets: inherit
9257

9358
package_code:
9459
needs: tag_release

0 commit comments

Comments
 (0)