fix: ensure runner deregisters on shutdown regardless of token source#5
Merged
prasadvamer merged 3 commits intomainfrom Mar 30, 2026
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.