Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,26 @@ jobs:
exit 1
fi
echo "::notice::executor-service serves with status=ok, ready=false (expected in CI)"
# The service runs validator containers as --user=1000:1000 and writes
# into its workspace as the image's own non-root user. Both depend on
# the image: the node user has to exist at uid 1000 and gid 1000, the
# service has to run as that user, and the workspace has to accept its
# writes. This is checked in the image itself, so that a change of the
# base image cannot move it unnoticed.
- name: Verify the process user and the workspace contract in the image
run: |
echo "node in the image: $(docker run --rm --network none --entrypoint node gitwire-executor-service:ci -v)"
ID=$(docker exec gitwire-executor-service-ci sh -c 'id')
echo "service process identity: $ID"
# The whole number has to match: uid=1000, not uid=10000.
echo "$ID" | grep -qE '(^|\s)uid=1000(\(|\s)' || { echo "::error::the service does not run as uid 1000: $ID"; exit 1; }
echo "$ID" | grep -qE '(^|\s)gid=1000(\(|\s)' || { echo "::error::the service does not run as gid 1000: $ID"; exit 1; }
docker exec gitwire-executor-service-ci sh -c 'id node' | grep -qE 'uid=1000\(node\) gid=1000\(node\)' || { echo "::error::the node user is not uid 1000 and gid 1000"; exit 1; }
docker exec gitwire-executor-service-ci sh -c 'test -d /workspace-tmp && touch /workspace-tmp/.ci-write-check && rm /workspace-tmp/.ci-write-check' \
|| { echo "::error::the service user cannot write into /workspace-tmp"; exit 1; }
docker exec gitwire-executor-service-ci sh -c 'test -x /usr/bin/docker && docker --version' \
|| { echo "::error::docker-cli is missing from the image"; exit 1; }
echo "::notice::the image keeps the identity contract: node user at 1000:1000, service runs as it, workspace writable, docker-cli present"
- name: Dump executor-service logs on failure
if: failure()
run: docker logs gitwire-executor-service-ci || true
Expand Down
4 changes: 2 additions & 2 deletions packages/executor-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# (it will be able to run validator containers via the mounted socket), but
# the service itself drops root and runs as uid 1000.

FROM node:20-alpine AS runtime
FROM node:24-alpine AS runtime
WORKDIR /app

# Install docker-cli so probeRuntime() can shell out to `docker --version`
Expand All @@ -29,7 +29,7 @@ RUN apk add --no-cache docker-cli wget
# tempdirs there (mounted as a Docker volume in compose for Docker-in-LXC visibility).
RUN mkdir -p /workspace-tmp && chown 1000:1000 /workspace-tmp && chmod 777 /workspace-tmp

# Drop root. node:20-alpine already ships a non-root `node` user at uid 1000
# Drop root. node:24-alpine already ships a non-root `node` user at uid 1000
# (gid 1000), which matches the validator container's non-root contract.
# Creating a fresh executor group at gid 1000 collides with the existing node
# group, so we reuse the built-in node user instead.
Expand Down
Loading