Skip to content

Commit fd2fc81

Browse files
authored
Fix CI failure (#411)
1 parent 11cb188 commit fd2fc81

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.github/workflows/ci_common.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,13 @@ jobs:
764764
(cd common && npm install && npm run build)
765765
(cd github-action/ && npm install && npm run build && npm run package)
766766
767+
- name: UID INFO
768+
run: echo 'UID INFO'; id; ls -l /var/run/docker.sock
769+
770+
- name: Set DOCKER_GID
771+
run: |
772+
echo "DOCKER_GID=$(getent group docker | cut -d: -f3)" >> $GITHUB_ENV
773+
767774
- name: Run test
768775
uses: ./
769776
with:
@@ -775,6 +782,8 @@ jobs:
775782
eventFilterForPush: |
776783
push
777784
pull_request
785+
env:
786+
DOCKER_GID: ${{ env.DOCKER_GID }}
778787

779788
test-gh-docker-from-docker-root:
780789
name: Run GitHub docker-from-docker-root test

github-tests/Dockerfile/docker-from-docker-non-root/.devcontainer/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ COPY scripts/docker-client.sh /tmp/
5252
RUN /tmp/docker-client.sh
5353

5454
#Add user to docker group
55-
RUN sudo groupadd docker && sudo usermod -aG docker $USERNAME && newgrp docker
55+
ARG DOCKER_GID=
56+
RUN if [ -n "$DOCKER_GID" ]; then \
57+
sudo groupadd -g $DOCKER_GID docker; \
58+
else \
59+
sudo groupadd docker; \
60+
fi \
61+
&& sudo usermod -aG docker $USERNAME
5662

5763
# __DEVCONTAINER_SNIPPET_INSERT__ (control where snippets get inserted using the devcontainer CLI)
5864

github-tests/Dockerfile/docker-from-docker-non-root/.devcontainer/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"name": "dc-test",
55
"dockerFile": "Dockerfile",
66
"build": {
7+
"args": {
8+
"DOCKER_GID": "${localEnv:DOCKER_GID}"
9+
},
710
"cacheFrom": "ghcr.io/devcontainers/ci/tests/docker-from-docker-non-root:latest"
811
},
912

@@ -55,6 +58,7 @@
5558

5659
// Use 'postCreateCommand' to run commands after the container is created.
5760
"postCreateCommand": "./scripts/go-tools.sh",
61+
"postStartCommand": "echo 'UID INFO'; id; ls -l /var/run/docker.sock",
5862

5963
"remoteUser": "vscode",
6064

0 commit comments

Comments
 (0)