Skip to content

feat(runners): setup-runner.sh — idempotent GH Actions runner registration - #1614

Closed
POWERFULMOVES wants to merge 4 commits into
mainfrom
feat/1463-runner-registration
Closed

POWERFULMOVES wants to merge 4 commits into
mainfrom
feat/1463-runner-registration

Conversation

@POWERFULMOVES

Copy link
Copy Markdown
Owner

Summary

  • Adds setup-runner.sh: idempotent self-hosted GitHub Actions runner registration script
  • Keeps auth token out of ssh argv (security: uses stdin/env instead)
  • Handles re-registration on label changes without removing existing runner config

Test plan

  • setup-runner.sh registers a new runner without error on a fresh node
  • Re-running on an already-registered node is a no-op (idempotent)
  • Auth token not visible in process listing (ps aux)

🤖 Generated with Claude Code

POWERFULMOVES and others added 4 commits May 24, 2026 07:10
…er registration

Closes the #1463 residual: bootstrap-node.sh previously printed manual
gh api instructions for runner registration, leaving every node hand-rolled
and subject to label drift and restart loops.

setup-runner.sh implements three-case idempotency:
  1. online → skip (no-op)
  2. offline/drifted → delete stale GH entry + rm container + re-register
  3. missing → fresh register

Auth cascade: GITHUB_PAT → GH_TOKEN → GITHUB_TOKEN → gh api registration token.
RUNNER_ALLOW_RUNNER_REUSE=true always injected (matches local_cert_runners.py:317).
Label mapping matches existing three-lane definitions in local_cert_runners.py.
check() pattern compatible with verify-claw.sh output format.

bootstrap-node.sh gains --with-runner, --runner-lane, --runner-repo flags
triggering step 3.5 after gh CLI install (step 3), before Glances (step 4).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- bootstrap-node.sh: handle exit 2 from setup-runner.sh gracefully;
  set -euo pipefail would abort bootstrap on drift remediation
- setup-runner.sh: fix gh api --paginate + jq interaction; pipe pages
  through jq -sc slurp instead of mixing --paginate with --jq filter
- setup-runner.sh: guard docker version fetch behind $DRY_RUN check;
  ssh_or_dry skips SSH in dry-run but raw ssh call would still execute

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@POWERFULMOVES, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 52 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 932207cf-296b-4eb2-a8f7-7d2921c36c7b

📥 Commits

Reviewing files that changed from the base of the PR and between 96b5e8e and 51b10aa.

📒 Files selected for processing (2)
  • pmoves/scripts/claws/bootstrap-node.sh
  • pmoves/scripts/claws/setup-runner.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1463-runner-registration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51b10aafbe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +99 to +102
"$SCRIPT_DIR/setup-runner.sh" \
--target "$TARGET" \
--repo "$RUNNER_REPO" \
--lane "$RUNNER_LANE" || {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Mark setup-runner.sh executable or invoke via bash

This call executes setup-runner.sh directly, but the new file is committed with mode 100644 in this commit, so it lacks the executable bit. In the --with-runner path, bootstrap will fail with a permission error before registration runs unless users manually chmod +x the script or invoke it through bash.

Useful? React with 👍 / 👎.

Comment on lines +233 to +237
REG_TOKEN=$(gh api --method POST "repos/${REPO}/actions/runners/registration-token" \
--jq '.token' 2>/dev/null || true)

if [[ -z "$REG_TOKEN" ]]; then
check "Registration token" "fail" "gh api call failed — check REPO and gh auth scopes"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip registration-token API call when PAT mode is selected

The script always requests a GitHub registration token and exits on failure, even when a PAT was already chosen for ACCESS_TOKEN. In environments where local gh auth can list runners but cannot create registration tokens, this causes a hard failure despite PAT-based container registration being otherwise viable, so valid PAT setups can fail unnecessarily.

Useful? React with 👍 / 👎.

@POWERFULMOVES

Copy link
Copy Markdown
Owner Author

All commits already merged into main via PR #1587. Branch is empty — closing as superseded.

@POWERFULMOVES
POWERFULMOVES deleted the feat/1463-runner-registration branch June 13, 2026 03:21
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.

2 participants