Skip to content

feat(workflows): add optional per-job runner_type overrides - #636

Merged
fredcamaral merged 5 commits into
developfrom
feat/per-job-runner-overrides
Jul 31, 2026
Merged

feat(workflows): add optional per-job runner_type overrides#636
fredcamaral merged 5 commits into
developfrom
feat/per-job-runner-overrides

Conversation

@fredcamaral

Copy link
Copy Markdown
Member

Description

Today every job in the Go umbrella pipelines runs on the single runner_type input, so a caller cannot right-size individual jobs: Blacksmith telemetry on LerianStudio/matcher shows the Go Lint/Tests jobs saturating all 4 vCPUs (95th percentile CPU at 99-100%) while trivial gate/summary jobs idle at ~20% average CPU on the same SKU. This PR adds optional per-job runner overrides so callers can tune hot and idle jobs independently, without changing anything for callers that do not set them.

Affected workflows: go-pr-validation.yml, go-pr-analysis.yml, pr-security-scan.yml, pr-validation.yml, go-release.yml, build.yml, release.yml (plus their docs pages).

New inputs (all type: string, default: '' = no override):

  • go-pr-analysis.yml: lint_runner_type, test_runner_type, coverage_runner_type, build_runner_type
  • pr-security-scan.yml: security_scan_runner_type
  • pr-validation.yml: pr_checks_summary_runner_type
  • go-pr-validation.yml (umbrella): exposes and forwards all of the above, plus gate_runner_type for its own utility jobs (Detect non-doc changes and the Go Analysis / Security / Lib Version result gates)
  • build.yml: build_runner_type (Build jobs only; prepare/notify stay on runner_type)
  • release.yml: publish_runner_type (Release publish jobs only)
  • go-release.yml (umbrella): build_runner_type and release_runner_type, forwarded to build.yml / release.yml (extra_build intentionally stays on runner_type)

The resolution pattern on every touched runs-on: line is:

runs-on: ${{ inputs.lint_runner_type || vars.GENERAL_RUNNERS || inputs.runner_type }}

An explicit per-job override deliberately wins over vars.GENERAL_RUNNERS, since it is an ad-hoc, caller-declared decision for that specific job; leaving it empty preserves today's resolution exactly. This mirrors the precedent of the existing job-scoped runner inputs in go-release.yml (apidog_runner_type, e2e_runner_type, ungoliant_runner_type).

First consumer: LerianStudio/matcher, which will pin Go Lint/Tests, the root security scan, and the release image build to blacksmith-8vcpu-ubuntu-2404, and Coverage, PR Checks Summary, the Lib Version gate, and the release publish job to blacksmith-2vcpu-ubuntu-2404, per its 30-day right-sizing report.

Type of Change

  • feat: New workflow or new input/output/step in an existing workflow
  • fix: Bug fix in a workflow (incorrect behavior, broken step, wrong condition)
  • perf: Performance improvement (e.g. caching, parallelism, reduced steps)
  • refactor: Internal restructuring with no behavior change
  • docs: Documentation only (README, docs/, inline comments)
  • ci: Changes to self-CI (workflows under .github/workflows/ that run on this repo)
  • chore: Dependency bumps, config updates, maintenance
  • test: Adding or updating tests
  • BREAKING CHANGE: Callers must update their configuration after this PR

Breaking Changes

None. All new inputs default to '', which reproduces the current vars.GENERAL_RUNNERS || inputs.runner_type resolution unchanged. No existing input names, defaults, outputs, or secrets were modified.

Testing

  • YAML syntax validated locally
  • Triggered a real workflow run on a caller repository using @this-branch or the beta tag
  • Verified all existing inputs still work with default values
  • Confirmed no secrets or tokens are printed in logs
  • Checked that unrelated workflows are not affected

Caller repo / workflow run: to be validated from LerianStudio/matcher by pointing pr-validation.yml at @feat/per-job-runner-overrides with the new inputs set, before tagging.

Related Issues

N/A (follow-up to the matcher runner right-sizing report)

@fredcamaral
fredcamaral requested a review from a team as a code owner July 31, 2026 16:51
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c0778281-ba1e-4c60-a67e-8f992dfc1358

📥 Commits

Reviewing files that changed from the base of the PR and between 5513648 and b1f9add.

📒 Files selected for processing (4)
  • .github/workflows/js-release.yml
  • docs/go-pr-analysis-workflow.md
  • docs/go-release-workflow.md
  • docs/js-release.md

Summary by CodeRabbit

  • New Features

    • Added independent runner configuration for build, testing, linting, coverage, security scanning, validation, PR summaries, and release jobs.
    • Added fallback behavior to preserve existing runner settings when overrides are not provided.
    • Registered the streaming-hub application for the Benedita environment.
  • Documentation

    • Documented the new runner configuration options and fallback behavior across workflow guides.
  • Chores

    • Removed obsolete test application entries from deployment configuration.

Walkthrough

The pull request adds per-job runner overrides across reusable workflows and their callers. Each override uses vars.GENERAL_RUNNERS, then runner_type as fallback. It also updates the deployment matrix with streaming-hub and obsolete severino-teste removals.

Changes

Workflow runner overrides

Layer / File(s) Summary
Reusable workflow runner selection
.github/workflows/build.yml, .github/workflows/go-pr-analysis.yml, .github/workflows/pr-security-scan.yml, .github/workflows/pr-validation.yml, .github/workflows/release.yml
Reusable workflows accept dedicated runner inputs. Jobs prefer the dedicated input, then vars.GENERAL_RUNNERS, then runner_type.
Caller workflow forwarding and gate runners
.github/workflows/go-pr-validation.yml, .github/workflows/go-release.yml, .github/workflows/js-release.yml
Caller workflows define runner inputs, forward them to reusable workflows, and apply the gate runner fallback chain.
Runner override documentation
docs/*
Workflow documentation describes the new inputs, defaults, forwarding, and fallback precedence.

Deployment matrix changes

Layer / File(s) Summary
Application registry and cluster assignments
config/deployment-matrix.yml
Adds streaming-hub to the registry and Benedita cluster. Removes obsolete severino-teste entries from the registry and cluster lists.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: config

Suggested reviewers: bedatty

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: optional per-job runner overrides in workflows.
Description check ✅ Passed The description covers the change, affected workflows, inputs, fallback behavior, breaking changes, and testing status; caller validation remains clearly marked as pending.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/per-job-runner-overrides

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

ferr3ira-gabriel and others added 4 commits July 31, 2026 16:52
Adds `severino-testing-final` to `apps.registry` and to
`clusters.anacleto.apps` and `clusters.benedita.apps` (the repo's own lint requires an app in a cluster
list to also be in the registry).

Which environments actually receive updates is NOT decided here — this file
has no environment dimension. It is decided by whether the app's
values.yaml exists in the gitops repo, which the same automation created
only for the environments the requester selected. Environments without one
are logged as a WARNING by gitops-update.yml and skipped.

Provisioned-By: Severino app-provisioning automation
Provisioning-Request: 41ab349b-4565-43f0-9793-041a799f17ad
Provisioning-App: severino-testing-final
Provisioning-Requester: admin
Provisioning-Team: devops-team
Removes `severino-testing-final` from `apps.registry`, from every cluster list it
appeared under, and from any `app_helmfile_env` override — the app was torn
down, so leaving it registered would keep gitops-update attempting it on
every release and logging "values file not found" indefinitely.

Provisioned-By: Severino app-provisioning automation
Provisioning-Request: 41ab349b-4565-43f0-9793-041a799f17ad
Provisioning-App: severino-testing-final
Provisioning-Requester: admin
Provisioning-Team: devops-team
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@fredcamaral
fredcamaral force-pushed the feat/per-job-runner-overrides branch from 6fd1c48 to 5513648 Compare July 31, 2026 16:52
@lerian-studio lerian-studio added size/S PR changes 50–199 lines documentation Improvements or additions to documentation workflow Changes to one or more reusable workflow files security Changes to security workflows or vulnerability reporting policy golang Changes to Go-related workflows validate Changes to PR validation composite actions (src/validate/) deployment-matrix Changes to the canonical deployment matrix (config/deployment-matrix.yml) labels Jul 31, 2026
@lerian-studio

lerian-studio commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Validation Summary

✅ PR Mergeable — no blocking failures

Check Status Blocking
Source Branch ✅ success yes
PR Title ✅ success yes
PR Description ✅ success yes
PR Size ✅ success no
Auto Labels ✅ success no
PR Metadata ✅ success no

🔍 View workflow run

@lerian-studio

lerian-studio commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🔍 Lint Analysis

Check Files Scanned Status
YAML Lint 9 file(s) ✅ success
Action Lint 8 file(s) ✅ success
Pinned Actions 8 file(s) ✅ success
Markdown Link Check 8 file(s) ✅ success
Spelling Check 17 file(s) ✅ success
Shell Check 8 file(s) ✅ success
README Check 8 file(s) ✅ success
Composite Schema no changes ⏭️ skipped
Deployment Matrix 1 file(s) ✅ success

🔍 View full scan logs

@lerian-studio

lerian-studio commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🛡️ CodeQL Analysis Results

Languages analyzed: actions

Found 1 issue(s): 1 Medium

Severity Rule File Message
🟡 Medium actions/untrusted-checkout/medium .github/workflows/build.yml:304 Potential unsafe checkout of untrusted pull request on non-privileged workflow.

🔍 View full scan logs | 🛡️ Security tab

@coderabbitai coderabbitai 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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/go-release.yml:
- Line 445: Update the extra_build invocation to forward the build_runner_type
input alongside runner_type, matching the primary build call so matrix jobs use
the configured runner override.

In @.github/workflows/release.yml:
- Around line 31-34: Update the documented js-release.yml umbrella workflow to
declare the publish_runner_type input and forward its value into the underlying
release workflow’s corresponding input, then update docs/js-release.md to
document the new option and mapping. Preserve the existing fallback behavior
when the input is empty.

In `@docs/go-pr-analysis-workflow.md`:
- Around line 99-101: Update the documentation entries for test_runner_type,
coverage_runner_type, and build_runner_type to describe their fallback chain: an
empty value uses vars.GENERAL_RUNNERS, then runner_type. Keep the input table
synchronized with the workflow contract and match the fallback wording used for
lint_runner_type.

In `@docs/go-release-workflow.md`:
- Line 30: Update the release_runner_type row in the inputs table to document
its empty-value fallback chain: vars.GENERAL_RUNNERS, then runner_type, matching
the workflow input description and keeping the table synchronized with the
workflow behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1565453d-4f71-4ec5-bfd2-d020f17a2a4d

📥 Commits

Reviewing files that changed from the base of the PR and between 7bdd940 and 6fd1c48.

📒 Files selected for processing (15)
  • .github/workflows/build.yml
  • .github/workflows/go-pr-analysis.yml
  • .github/workflows/go-pr-validation.yml
  • .github/workflows/go-release.yml
  • .github/workflows/pr-security-scan.yml
  • .github/workflows/pr-validation.yml
  • .github/workflows/release.yml
  • config/deployment-matrix.yml
  • docs/build-workflow.md
  • docs/go-pr-analysis-workflow.md
  • docs/go-pr-validation.md
  • docs/go-release-workflow.md
  • docs/pr-security-scan-workflow.md
  • docs/pr-validation.md
  • docs/release-workflow.md

Comment thread .github/workflows/go-release.yml
Comment thread .github/workflows/release.yml
Comment thread docs/go-pr-analysis-workflow.md Outdated
Comment thread docs/go-release-workflow.md Outdated
…s-release forwarding

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@fredcamaral
fredcamaral merged commit 0f55a48 into develop Jul 31, 2026
19 of 20 checks passed
@github-actions
github-actions Bot deleted the feat/per-job-runner-overrides branch July 31, 2026 17:05

@coderabbitai coderabbitai 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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build.yml:
- Line 284: Restrict the build workflow’s callable execution so pull-request
callers cannot run it with fork-controlled inputs. Update the job/workflow
guards around the build entry point and runner selection using the visible
build_runner_type, runner_type, and checkout_ref inputs, allowing only trusted
release callers and approved runners while preserving legitimate release builds.

In `@docs/go-pr-validation.md`:
- Around line 26-31: Update the inputs tables to document the fallback chain
vars.GENERAL_RUNNERS, then runner_type for all six inputs in
docs/go-pr-validation.md lines 26-31: lint_runner_type, test_runner_type,
coverage_runner_type, build_runner_type, security_scan_runner_type, and
pr_checks_summary_runner_type. Apply the same documentation update to
release_runner_type in docs/go-release-workflow.md line 30, keeping both tables
synchronized with the workflow behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 741790c9-ae56-4b4f-baf0-ad9e5e1535b0

📥 Commits

Reviewing files that changed from the base of the PR and between 6fd1c48 and 5513648.

📒 Files selected for processing (15)
  • .github/workflows/build.yml
  • .github/workflows/go-pr-analysis.yml
  • .github/workflows/go-pr-validation.yml
  • .github/workflows/go-release.yml
  • .github/workflows/pr-security-scan.yml
  • .github/workflows/pr-validation.yml
  • .github/workflows/release.yml
  • config/deployment-matrix.yml
  • docs/build-workflow.md
  • docs/go-pr-analysis-workflow.md
  • docs/go-pr-validation.md
  • docs/go-release-workflow.md
  • docs/pr-security-scan-workflow.md
  • docs/pr-validation.md
  • docs/release-workflow.md

needs: prepare
if: needs.prepare.outputs.has_builds == 'true'
runs-on: ${{ vars.GENERAL_RUNNERS || inputs.runner_type }}
runs-on: ${{ inputs.build_runner_type || vars.GENERAL_RUNNERS || inputs.runner_type }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 12 \
  'pull_request|uses:.*build\.yml|checkout_ref|build_runner_type|id-token: write|packages: write' \
  .github/workflows

Repository: LerianStudio/github-actions-shared-workflows

Length of output: 50401


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- build.yml structure ---'
ast-grep outline .github/workflows/build.yml

printf '%s\n' '--- build.yml inputs, triggers, checkout, runner, and job conditions ---'
rg -n -C 8 \
  'workflow_call|workflow_dispatch|checkout_ref|build_runner_type|runs-on:|actions/checkout|if:' \
  .github/workflows/build.yml

printf '%s\n' '--- all build.yml callers ---'
rg -n -C 10 \
  'uses:\s+(\./)?\.github/workflows/build\.yml|uses:.*build\.yml' \
  .github/workflows

printf '%s\n' '--- caller trigger declarations ---'
python3 - <<'PY'
from pathlib import Path
import re

for path in Path(".github/workflows").glob("*.yml"):
    text = path.read_text()
    if re.search(r'uses:\s+.*build\.yml', text):
        print(f"\n### {path}")
        for i, line in enumerate(text.splitlines(), 1):
            if re.match(r'\s*(on:|workflow_call:|workflow_dispatch:|pull_request(?:_target)?:|push:|workflow_run:)', line):
                print(f"{i}:{line}")
PY

Repository: LerianStudio/github-actions-shared-workflows

Length of output: 19991


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- build.yml trigger and input definitions ---'
sed -n '1,205p' .github/workflows/build.yml

printf '%s\n' '--- go-release trigger and build caller conditions ---'
sed -n '1,80p' .github/workflows/go-release.yml
sed -n '400,470p' .github/workflows/go-release.yml
sed -n '610,655p' .github/workflows/go-release.yml

printf '%s\n' '--- every repository reference to build.yml ---'
rg -n -C 4 \
  'build\.yml|checkout_ref|build_runner_type|runner_type' \
  --glob '!*.log' \
  --glob '!node_modules/**' \
  .

printf '%s\n' '--- pull-request triggers in workflows that call reusable workflows ---'
python3 - <<'PY'
from pathlib import Path

for path in Path(".github/workflows").glob("*.yml"):
    lines = path.read_text().splitlines()
    has_build_call = any("build.yml" in line for line in lines)
    if not has_build_call:
        continue
    print(f"\n### {path}")
    for i, line in enumerate(lines, 1):
        if any(token in line for token in (
            "pull_request:", "pull_request_target:", "workflow_call:",
            "workflow_dispatch:", "push:", "workflow_run:"
        )):
            print(f"{i}:{line}")
PY

Repository: LerianStudio/github-actions-shared-workflows

Length of output: 50403


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- build workflow documentation and examples ---'
sed -n '1,125p' docs/build-workflow.md
sed -n '200,240p' docs/build-workflow.md

printf '%s\n' '--- repository guidance for pull_request runners and reusable callers ---'
rg -n -C 5 \
  'pull_request|self-hosted|workflow_call|external|build_runner_type|checkout_ref' \
  AGENTS.md docs .github/workflows \
  --glob '*.md' --glob '*.yml'

printf '%s\n' '--- static caller/event summary ---'
python3 - <<'PY'
from pathlib import Path
import re

for path in sorted(Path(".github/workflows").glob("*.yml")):
    text = path.read_text()
    if "build.yml" not in text:
        continue
    events = re.findall(
        r"^\s{0,4}(pull_request_target|pull_request|workflow_call|workflow_dispatch|workflow_run|push):",
        text,
        flags=re.MULTILINE,
    )
    calls = [
        line.strip()
        for line in text.splitlines()
        if "build.yml" in line and "uses:" in line
    ]
    print(path)
    print("events:", events or ["none"])
    print("calls:", calls)
PY

Repository: LerianStudio/github-actions-shared-workflows

Length of output: 50403


Block pull-request execution of this build job.

build.yml is callable by external repositories, has no event guard, and accepts unrestricted checkout_ref and build_runner_type inputs. A pull_request caller can therefore run fork-controlled Docker build code on a caller-selected runner, including a self-hosted runner. Reject pull-request events or restrict this workflow to trusted release callers and approved runners.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build.yml at line 284, Restrict the build workflow’s
callable execution so pull-request callers cannot run it with fork-controlled
inputs. Update the job/workflow guards around the build entry point and runner
selection using the visible build_runner_type, runner_type, and checkout_ref
inputs, allowing only trusted release callers and approved runners while
preserving legitimate release builds.

Comment thread docs/go-pr-validation.md
Comment on lines +26 to +31
| `lint_runner_type` | Optional runner override for the Go analysis Lint jobs only | string | `''` |
| `test_runner_type` | Optional runner override for the Go analysis Tests jobs only | string | `''` |
| `coverage_runner_type` | Optional runner override for the Go analysis Coverage jobs only | string | `''` |
| `build_runner_type` | Optional runner override for the Go analysis Build jobs only | string | `''` |
| `security_scan_runner_type` | Optional runner override for the security_scan jobs only | string | `''` |
| `pr_checks_summary_runner_type` | Optional runner override for the PR Checks Summary job only | string | `''` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Keep runner input tables synchronized with the fallback contract.

The new runner inputs use the same empty-value resolution: vars.GENERAL_RUNNERS, then runner_type. The documentation omits this contract in both tables.

  • docs/go-pr-validation.md#L26-L31: add the fallback chain to lint_runner_type, test_runner_type, coverage_runner_type, build_runner_type, security_scan_runner_type, and pr_checks_summary_runner_type.
  • docs/go-release-workflow.md#L30-L30: add the fallback chain to release_runner_type.

As per path instructions, keep the inputs table synchronized with the corresponding workflow changes in this PR.

📍 Affects 2 files
  • docs/go-pr-validation.md#L26-L31 (this comment)
  • docs/go-release-workflow.md#L30-L30
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/go-pr-validation.md` around lines 26 - 31, Update the inputs tables to
document the fallback chain vars.GENERAL_RUNNERS, then runner_type for all six
inputs in docs/go-pr-validation.md lines 26-31: lint_runner_type,
test_runner_type, coverage_runner_type, build_runner_type,
security_scan_runner_type, and pr_checks_summary_runner_type. Apply the same
documentation update to release_runner_type in docs/go-release-workflow.md line
30, keeping both tables synchronized with the workflow behavior.

Source: Path instructions

@coderabbitai coderabbitai Bot mentioned this pull request Aug 1, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployment-matrix Changes to the canonical deployment matrix (config/deployment-matrix.yml) documentation Improvements or additions to documentation golang Changes to Go-related workflows security Changes to security workflows or vulnerability reporting policy size/S PR changes 50–199 lines validate Changes to PR validation composite actions (src/validate/) workflow Changes to one or more reusable workflow files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants