Skip to content

Add job metadata labels + annotations to runner pods when a job is assigned#4486

Open
arjunmadan-toast wants to merge 2 commits intoactions:masterfrom
arjunmadan-toast:label-pods-with-job-info
Open

Add job metadata labels + annotations to runner pods when a job is assigned#4486
arjunmadan-toast wants to merge 2 commits intoactions:masterfrom
arjunmadan-toast:label-pods-with-job-info

Conversation

@arjunmadan-toast
Copy link
Copy Markdown

Addresses #4485 by patching pod labels/annotations with job metadata when the controller reconciles an EphemeralRunner that has been assigned a job:

actions.github.com/job-repository (label, sanitized)
actions.github.com/job-display-name (label, sanitized)
actions.github.com/job-repository-name (annotation, full value)
actions.github.com/workflow-run-id (annotation)

When the listener reports a job assignment via EphemeralRunner status,
the reconciler now patches the runner pod with labels and annotations
identifying the repository, job name, job ID, and workflow run ID.
This enables cost attribution for shared org-level runner pools.

Generated with Claude Code
- Move labelPodWithJobInfo before container status switch so labels
  are applied even when the job finishes before the next reconcile
- Check JobRepositoryName instead of HasJob() since GHES doesn't
  populate JobID in the event payload
- Replace character-by-character sanitizer with regex that handles
  all invalid label characters and enforces start/end constraints
- Add patch verb to scale set manager role for pod resources

Generated with Claude Code
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