Skip to content

fix: ensure runner deregisters on shutdown regardless of token source#5

Merged
prasadvamer merged 3 commits intomainfrom
fix/runner-deregistration-on-shutdown
Mar 30, 2026
Merged

fix: ensure runner deregisters on shutdown regardless of token source#5
prasadvamer merged 3 commits intomainfrom
fix/runner-deregistration-on-shutdown

Conversation

@prasadvamer
Copy link
Copy Markdown
Owner

Previously, the cleanup function could only deregister the runner when RUNNER_TOKEN_FILE was used. When passing RUNNER_TOKEN as a plain env var (the most common usage), the token was unset after registration and cleanup could never read it back — leaving ghost runners in GitHub.

Now the token is saved to /home/runner/.runner-token-cleanup (mode 600) before being unset, so cleanup always has access. The file is deleted after deregistration and lives inside the container filesystem (never bind-mounted), avoiding conflicts with shared volumes.

Previously, the cleanup function could only deregister the runner when
RUNNER_TOKEN_FILE was used. When passing RUNNER_TOKEN as a plain env var
(the most common usage), the token was unset after registration and
cleanup could never read it back — leaving ghost runners in GitHub.

Now the token is saved to /home/runner/.runner-token-cleanup (mode 600)
before being unset, so cleanup always has access. The file is deleted
after deregistration and lives inside the container filesystem (never
bind-mounted), avoiding conflicts with shared volumes.
Upstream containerd 2.2.2 and Docker 29.3.1 ship with
google.golang.org/grpc < 1.79.3 and gosu 1.19 ships with Go < 1.24.13,
both flagged by Docker Hub security scanning with no upstream fix available.

Introduce a multi-stage build that compiles all affected binaries from
source using Go 1.24.13 and grpc v1.79.3, then overlays them onto the
apt-installed packages in the final image:

- containerd, containerd-shim-runc-v2, ctr (grpc >= 1.79.3)
- dockerd (grpc >= 1.79.3)
- gosu (Go >= 1.24.13)

Affected paths: /usr/bin/containerd, /usr/bin/containerd-shim-runc-v2,
/usr/bin/ctr, /usr/bin/dockerd, /usr/sbin/gosu
…sion optimization

- Split builder stage into builder-containerd (Go 1.24.13) and builder-moby (Go 1.25.8) to match moby v29.3.1 requirements
- Update moby version tag from v29.3.1 to docker-v29.3.1 for correct git reference
- Add go mod vendor step to both builder stages for reproducible builds
- Implement build cache mounts for /go/pkg/mod and /root/.cache/go-build to improve build performance
- Update COPY directives to reference correct builder stages (builder-containerd and builder-moby)
- Ensures grpc >= 1.79.3 and appropriate Go versions are used in each build stage to fix CVEs
@prasadvamer prasadvamer merged commit 7d26143 into main Mar 30, 2026
1 check passed
prasadvamer added a commit that referenced this pull request Mar 30, 2026
…ion-on-shutdown"

This reverts commit 7d26143, reversing
changes made to de73db6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant