Skip to content

add generic-rake-test-only variant for least-privilege consumers - #376

Closed
opoudjis wants to merge 1 commit into
mainfrom
feature/ci-362-generic-rake-test-only
Closed

add generic-rake-test-only variant for least-privilege consumers#376
opoudjis wants to merge 1 commit into
mainfrom
feature/ci-362-generic-rake-test-only

Conversation

@opoudjis

Copy link
Copy Markdown
Contributor

Closes #362

Summary

Shape 1 from the 2026-07-25 revisit: opt-in generic-rake-test-only.yml reusable + master/rake_test_only.yml cimas template at permissions: contents: read. Existing generic-rake.yml and master/rake.yml untouched — all 48 cascade consumers keep working unchanged.

What it does

Drops the tests-passed job (both tests-passed and do-release repository_dispatch fires) from the reusable. In exchange, callers can declare contents: read at the workflow level — the least-privilege ceiling GitHub Actions permits for a reusable-caller pair. For repos that CI but don't participate in the release cascade (mn-samples-*, metanorma-model-*, externally-triggered releases).

Files

  • .github/workflows/generic-rake-test-only.yml — new reusable.
  • cimas-config/gh-actions/master/rake_test_only.yml — new cimas caller at contents: read.
  • docs/generic-rake.md — new subsection: when to use, when not to, how to switch.

No cimas.yml mappings changed; per-repo opt-in happens in a follow-up wave.

Preference

Naming — is master/rake_test_only.yml (underscore, matching release_manual_notes.yml) right, or would you prefer rake-test-only.yml (hyphen, matching rake-flavor.yml)? Happy to rename before merge.

🤖

@ronaldtse ronaldtse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Architecture review — reject sibling-workflow fragmentation

This PR ships a 144-line near-duplicate of generic-rake.yml. That is the exact drift risk class (g) of drift-audit was built for, and the PR does not register itself in VARIANT_REGISTRY.

Premise check

Existing generic-rake.yml already declares permissions: contents: read at the workflow level (line 64-65), with tests-passed overriding to contents: write at the job level. What forces callers to escalate is master/rake.yml:9-10 (the caller template). Before forking the reusable, verify whether GHA actually clamps job-level write under a caller-level read. If not, relaxing the caller template alone is sufficient and the duplication is unnecessary.

Required shape (consolidated, not fragmented)

One reusable. One concern. Extended via input:

# generic-rake.yml — add one input
cascade:
  description: >
    When true (default), fire tests-passed / do-release repository_dispatch
    after the matrix. When false, skip the cascade job entirely so callers
    can declare permissions: contents: read.
  type: boolean
  default: true
# tests-passed job
tests-passed:
  if: inputs.cascade
  needs: rake
  ...

Caller templates:

  • master/rake.ymlcascade: true (or omit; default), permissions: contents: write
  • master/rake_test_only.ymlcascade: false, permissions: contents: read

The matrix job body stays in ONE place. Class (g) registers the caller-template pair, not a second 144-line reusable.

Standing rule

Any new cimas variant or reusable must:

  1. Prefer extending an existing reusable via input over shipping a sibling.
  2. Register in VARIANT_REGISTRY in the same PR.

Please rework along these lines. Happy to take the rewrite if preferred.

@ronaldtse

Copy link
Copy Markdown
Contributor

Superseded by #383.

#383 takes the consolidated shape (Option 2 from #362): one reusable with a cascade boolean input, thin caller template for permissions. Rejects the 144-line sibling-reusable duplication.

Standing rule going forward: extend existing reusables via inputs; never ship near-duplicate sibling workflows. Any new cimas variant registers in VARIANT_REGISTRY in the same PR.

@ronaldtse ronaldtse closed this Aug 7, 2026
ronaldtse added a commit that referenced this pull request Aug 7, 2026
…rivilege caller (#383)

Closes #362. Supersedes #376's sibling-workflow approach.

One reusable. One concern. Extended via input:
- generic-rake.yml gains cascade boolean (default true)
- tests-passed job gated by if: inputs.cascade
- master/rake_test_only.yml is a thin caller (cascade: false,
  permissions: contents: read) — not a 144-line duplicate reusable
- VARIANT_REGISTRY row for the caller-template pair (class g)

Existing cascade consumers unchanged (cascade defaults true).
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.

rake.yml template: least-privilege permissions needs a split reusable (test-only vs test+relay)

2 participants