Skip to content

Commit 246bf88

Browse files
Merge branch 'AEA-0000-sonarcloud-issue' into aea-6313-eps-storage-terraform-image
2 parents 91ec9d6 + 6bf3826 commit 246bf88

1 file changed

Lines changed: 10 additions & 25 deletions

File tree

README.md

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ USER root
6262
# specify DOCKER_GID to force container docker group id to match host
6363
RUN if [ -n "${DOCKER_GID}" ]; then \
6464
if ! getent group docker; then \
65-
groupadd -g ${DOCKER_GID} docker; \
65+
groupadd -g "${DOCKER_GID}" docker; \
6666
else \
67-
groupmod -g ${DOCKER_GID} docker; \
67+
groupmod -g "${DOCKER_GID}" docker; \
6868
fi && \
6969
usermod -aG docker vscode; \
7070
fi
@@ -108,40 +108,26 @@ IMAGE_NAME and IMAGE_VERSION should be changed as appropriate.
108108
You should not need to add any features as these are already baked into the image
109109

110110
## Getting image name and version in GitHub Actions
111-
This job should be used in GitHub Actions wherever you need to get the dev container name or tag
111+
This shared workflow should be used in GitHub Actions wherever you need to get the dev container name or tag.
112+
113+
verify_published_from_main_image should be set to false for testing pull request images.
112114

113115
```
114116
get_config_values:
115-
runs-on: ubuntu-22.04
116-
outputs:
117-
devcontainer_image_name: ${{ steps.load-config.outputs.DEVCONTAINER_IMAGE_NAME }}
118-
devcontainer_image_version: ${{ steps.load-config.outputs.DEVCONTAINER_VERSION }}
119-
steps:
120-
- name: Checkout code
121-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
122-
- name: Load config value
123-
id: load-config
124-
run: |
125-
DEVCONTAINER_IMAGE_NAME=$(jq -r '.build.args.IMAGE_NAME' .devcontainer/devcontainer.json)
126-
DEVCONTAINER_IMAGE_VERSION=$(jq -r '.build.args.IMAGE_VERSION' .devcontainer/devcontainer.json)
127-
echo "DEVCONTAINER_IMAGE_NAME=$DEVCONTAINER_IMAGE_NAME" >> "$GITHUB_OUTPUT"
128-
echo "DEVCONTAINER_IMAGE_VERSION=$DEVCONTAINER_VERSION" >> "$GITHUB_OUTPUT"
117+
uses: NHSDigital/eps-common-workflows/.github/workflows/get-repo-config.yml@8404cf6e3a61ac8de4d1644e175e288aa4965815
118+
with:
119+
verify_published_from_main_image: false
129120
```
130121
## Using images in GitHub Actions
131122
To use the image in GitHub Actions, you should first verify the attestation of the image and reference the image by the digest
132123
For CI and release pipelines, you should set verify_published_from_main_image to ensure that only images published from main are used.
133124
```
134125
jobs:
135-
verify_attestation:
136-
uses: NHSDigital/eps-common-workflows/.github/workflows/verify-attestation.yml@<latest published version>
137-
with:
138-
runtime_docker_image: "${{ inputs.runtime_docker_image }}"
139-
verify_published_from_main_image: false
140126
my_job_name:
141127
runs-on: ubuntu-22.04
142-
needs: verify_attestation
128+
needs: get_config_values
143129
container:
144-
image: ${{ needs.verify_attestation.outputs.pinned_image }}
130+
image: ${{ needs.get_config_values.outputs.pinned_image }}
145131
options: --user 1001:1001 --group-add 128
146132
defaults:
147133
run:
@@ -153,7 +139,6 @@ jobs:
153139
... other steps ....
154140
```
155141
It is important that:
156-
- the image specified uses the tag starting githubactions-
157142
- there is `options: --user 1001:1001 --group-add 128` below image to ensure it uses the correct user id and is added to the docker group
158143
- the default shell is set to be bash
159144
- the first step copies .tool-versions from /home/vscode to $HOME/.tool-versions

0 commit comments

Comments
 (0)