ci(workflows): run push and schedule workflows only in cozystack/cozystack (#5186)

## What this PR does

GitHub runs no CI in a security advisory's temporary private fork, and
merging from the advisory skips branch protection, so an embargoed fix
currently reaches `main` with nothing having run on it. This PR prepares
the repository for verifying such a fix in a separate private copy of
the repository (an embargo mirror), and documents that process.

- Every job of a workflow that a push or a schedule starts now runs only
in `cozystack/cozystack`. A mirror receives all workflow files on each
sync, and without the guard it would build, publish, prune and cut
releases from that copy on every sync and cron tick. Workflows that also
run on `pull_request` keep running on pull requests, which is what the
mirror is for. Every job carries the guard rather than only the root
jobs, because a job whose condition calls a status function such as
`!cancelled()` runs even when the job it needs was skipped.
- `hack/workflow-repo-guard.bats` holds every current and future push or
schedule workflow to that guard, accepting it only as the leading
conjunct so nothing ORed after it can reopen the job.
- `docs/security/incident-response.md` describes the verification flow:
sync the mirror on demand, open the fix PR inside it, record the green
run in the advisory, then merge from the advisory. It also records why
the mirror must not hold the public registry credentials: pull request
CI pushes every image and the packages artifact (the full chart tree) to
a registry that is anonymously readable, tag listing included, so a run
there would publish the fix before the release.

Behaviour in `cozystack/cozystack` is unchanged: the guard is true
there, and each existing condition is kept intact inside the new
conjunction. Contributor forks with Actions enabled stop running these
workflows too.

Out of scope, as a follow-up: letting pull request CI push to a private
registry and pull from it in the E2E cluster, so the mirror can run the
E2E suite and not only planning, pre-commit and the unit tests.

Verification:

- `hack/workflow-repo-guard.bats` was red before the workflow changes
(30 unguarded jobs) and is green after; removing the guard from
`tags.yaml` `rc-e2e`, dropping the pull request clause from
`zizmor.yml`, or adding an unguarded scheduled workflow each turns it
red.
- Every changed workflow is identical to `main` once job `if` fields are
removed (`yq 'del(.jobs[].if)'`).
- `zizmor --offline` reports no findings; `actionlint` reports the same
findings on the changed files as on `main`.
- `hack/stitch-multiarch_test.bats` pinned the exact `if` of two
`tags.yaml` jobs and is updated to the guarded form.

### Screenshots

Not a UI change.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

The trigger map entry that touches this diff is `cozystack/ccp` for
`tags.yaml`: its `package-bump` skill describes the release pipeline of
`cozystack/cozystack`, which this PR does not change.

### Release note

```release-note
ci(workflows): push- and schedule-triggered workflows run only in cozystack/cozystack, so a private mirror used to verify embargoed security fixes does not build, publish or release from its copy.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **CI**
* Scheduled, release, and maintenance workflows now run only in the
canonical repository. Pull-request checks continue to run where
configured.
* Build, validation, and security workflows now follow
repository-specific run conditions.

* **Documentation**
* Updated incident-response guidance with steps for verifying fixes in a
private advisory mirror, including CI limitations, check requirements,
and credential restrictions.

* **Tests**
* Added workflow checks to verify repository guards and event-specific
conditions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Aleksei Sviridkin authored and GitHub committed 2026-11-26 11:09:54 +03:00
commit 74e103d6f2
20 files changed
+247 -18

No files matched your search

+5 -5
View File
@@ -82,9 +82,9 @@ jobs:
# of the gate, which can only withhold a re-evaluation: a push then leaves no
# status at all, and a withdrawn approval is caught by the sweep.
if: >-
${{ github.event_name == 'workflow_run'
${{ github.repository == 'cozystack/cozystack' && (github.event_name == 'workflow_run'
&& github.event.workflow_run.conclusion != 'cancelled'
&& github.event.workflow_run.conclusion != 'skipped' }}
&& github.event.workflow_run.conclusion != 'skipped') }}
runs-on: ubuntu-latest
permissions:
pull-requests: read
@@ -157,7 +157,7 @@ jobs:
detect:
name: Detect sizeable API changes
needs: [resolve]
if: ${{ needs.resolve.outputs.should_run == 'true' }}
if: ${{ github.repository == 'cozystack/cozystack' && (needs.resolve.outputs.should_run == 'true') }}
runs-on: ubuntu-latest
permissions:
contents: read
@@ -236,9 +236,9 @@ jobs:
name: Report fork API review gate status
needs: [resolve, detect]
if: >-
${{ !cancelled()
${{ github.repository == 'cozystack/cozystack' && (!cancelled()
&& (github.event_name != 'workflow_run'
|| needs.resolve.outputs.should_run == 'true') }}
|| needs.resolve.outputs.should_run == 'true')) }}
runs-on: ubuntu-latest
permissions:
contents: read
@@ -24,6 +24,7 @@ permissions:
jobs:
build-arm64:
if: github.repository == 'cozystack/cozystack'
name: Build main arm64 images
runs-on: oracle-vm-24cpu-96gb-arm64
# Starts from the rc leg's budget; re-measure after the first runs.
+1
View File
@@ -38,6 +38,7 @@ permissions:
jobs:
warm-cache:
if: github.repository == 'cozystack/cozystack'
name: Warm build cache
# Runs on the ephemeral pool, not the dedicated self-hosted runner, so the
# build path no longer depends on that host (#2937 decommission). Serial
+1
View File
@@ -60,6 +60,7 @@ permissions:
jobs:
build-line:
if: github.repository == 'cozystack/cozystack'
name: Build ${{ github.ref_name }} images and packages artifact
runs-on: oracle-vm-24cpu-96gb-x86-64
timeout-minutes: 120
+1
View File
@@ -21,6 +21,7 @@ concurrency:
jobs:
analyze:
if: (github.event_name == 'pull_request' || github.repository == 'cozystack/cozystack')
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 120
+1
View File
@@ -38,6 +38,7 @@ permissions:
jobs:
e2e:
if: github.repository == 'cozystack/cozystack'
name: E2E (isp-hosted on kind)
# The whole platform lands on one kind node with nothing pre-pulled. The
# smaller 4-vCPU class was not tried; sizing down is left to a measured run.
+1 -1
View File
@@ -38,7 +38,7 @@ jobs:
# cancels it, so the schedule fires only where the stand is declared;
# manual dispatch always runs. The runner must be v2.327.1 or newer, the
# minimum the checkout README names for its node24 runtime.
if: github.event_name == 'workflow_dispatch' || vars.PROXMOX_NIGHTLY == 'true'
if: ${{ github.repository == 'cozystack/cozystack' && (github.event_name == 'workflow_dispatch' || vars.PROXMOX_NIGHTLY == 'true') }}
runs-on: [self-hosted, proxmox]
timeout-minutes: 90
env:
+1
View File
@@ -55,6 +55,7 @@ concurrency:
jobs:
triage:
if: github.repository == 'cozystack/cozystack'
runs-on: ubuntu-latest
# A run that reaches the write cap paces roughly seven minutes of work, so
# anything near this ceiling is a call that hung rather than a long sweep.
+2 -1
View File
@@ -23,6 +23,7 @@ concurrency:
jobs:
validate:
if: (github.event_name == 'pull_request' || github.repository == 'cozystack/cozystack')
runs-on: ubuntu-latest
permissions:
contents: read
@@ -73,7 +74,7 @@ jobs:
sync:
needs: validate
if: github.event_name != 'pull_request'
if: ${{ (github.event_name == 'pull_request' || github.repository == 'cozystack/cozystack') && (github.event_name != 'pull_request') }}
runs-on: ubuntu-latest
permissions:
contents: read
+3 -1
View File
@@ -41,7 +41,7 @@ jobs:
# packages artifact + installer chart on GHCR. No rebuild.
mirror:
name: Mirror images to GHCR
if: vars.NIGHTLY_ENABLED == 'true' || github.event_name == 'workflow_dispatch'
if: ${{ github.repository == 'cozystack/cozystack' && (vars.NIGHTLY_ENABLED == 'true' || github.event_name == 'workflow_dispatch') }}
runs-on: oracle-vm-4cpu-16gb-x86-64
timeout-minutes: 60
permissions:
@@ -188,6 +188,7 @@ jobs:
# ── Assemble the Talos nocloud disk from the upstream imager (no cozystack
# image dependency) and publish it as a GHCR OCI artifact.
build-disk:
if: github.repository == 'cozystack/cozystack'
name: Build & publish nocloud disk
needs: [mirror]
runs-on: oracle-vm-4cpu-16gb-x86-64
@@ -239,6 +240,7 @@ jobs:
# upstream Talos image, so the nocloud disk built above is published but
# not exercised here, and e2e does not wait for it.
e2e:
if: github.repository == 'cozystack/cozystack'
name: E2E (full suite)
needs: [mirror]
# Same sandbox as the other e2e lanes: three nodes at 8 vCPU / 24 GiB each
+1
View File
@@ -57,6 +57,7 @@ concurrency:
jobs:
prune:
if: github.repository == 'cozystack/cozystack'
name: Prune old GHCR temporary artifacts
runs-on: ubuntu-latest
permissions:
+1
View File
@@ -12,6 +12,7 @@ permissions: read-all
jobs:
analysis:
if: github.repository == 'cozystack/cozystack'
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
+1
View File
@@ -16,6 +16,7 @@ concurrency:
jobs:
stale:
if: github.repository == 'cozystack/cozystack'
runs-on: ubuntu-latest
permissions:
issues: write
+6 -5
View File
@@ -28,7 +28,7 @@ jobs:
# e2e sandbox is amd64 only, so none of them has an arm64 half here.
build-arm64:
name: Build arm64 images
if: contains(github.ref_name, '-')
if: ${{ github.repository == 'cozystack/cozystack' && (contains(github.ref_name, '-')) }}
runs-on: oracle-vm-24cpu-96gb-arm64
# Starts from build-amd64's budget; re-measure after the first runs.
timeout-minutes: 120
@@ -140,6 +140,7 @@ jobs:
# It runs for every tag, since the release-exists no-op and the rejection of
# a hand-pushed stable tag live here.
build-amd64:
if: github.repository == 'cozystack/cozystack'
name: Build amd64 images and assets
# Ephemeral pool, not the dedicated self-hosted runner (#2937 decommission).
# Serial `make build` + `make assets` is CPU-bound, so use the large shape —
@@ -388,7 +389,7 @@ jobs:
# build-arm64 is skipped only for a stable tag, which never builds. On a
# pre-release, either half failing or being cancelled leaves this job
# skipped and the run red: an rc ships multi-arch or not at all.
if: ${{ !cancelled() && needs.build-amd64.result == 'success' && (needs.build-arm64.result == 'success' || needs.build-arm64.result == 'skipped') }}
if: ${{ github.repository == 'cozystack/cozystack' && (!cancelled() && needs.build-amd64.result == 'success' && (needs.build-arm64.result == 'success' || needs.build-arm64.result == 'skipped')) }}
runs-on: oracle-vm-24cpu-96gb-x86-64
# The stitch reads and writes every first-party image once, then the
# packages artifact, the chart and the assets are pushed; start there and
@@ -643,7 +644,7 @@ jobs:
# !cancelled(): every job below build-arm64 carries a status function,
# since a stable tag skips build-arm64. This one only runs for an rc,
# where build-arm64 always runs, so here it just follows that rule.
if: ${{ !cancelled() && needs.prepare-release.result == 'success' && contains(github.ref_name, '-rc.') }}
if: ${{ github.repository == 'cozystack/cozystack' && (!cancelled() && needs.prepare-release.result == 'success' && contains(github.ref_name, '-rc.')) }}
# A caller's permissions are the ceiling for every job in the called
# workflow, and GitHub validates that ceiling STATICALLY, when it creates the
# run — before this job's `if:` is evaluated, let alone before a step runs.
@@ -700,7 +701,7 @@ jobs:
# finalized at the stable release, so the changelog is generated then.
# !cancelled(): this job runs on stable tags only, which skip build-arm64,
# and a skipped ancestor makes the implicit success() false.
if: ${{ !cancelled() && needs.prepare-release.result == 'success' && !contains(github.ref_name, '-') }}
if: ${{ github.repository == 'cozystack/cozystack' && (!cancelled() && needs.prepare-release.result == 'success' && !contains(github.ref_name, '-')) }}
# Non-blocking: this is a best-effort backfill of an already-published
# release, never a gate on one.
continue-on-error: true
@@ -959,7 +960,7 @@ jobs:
# promoted stable.
# Stable tags only — a prerelease (ref_name contains '-') would otherwise open
# an "update managed apps for vX.Y.Z-rc.N" website PR on every rc.
if: ${{ !cancelled() && needs.prepare-release.result == 'success' && !contains(github.ref_name, '-') }}
if: ${{ github.repository == 'cozystack/cozystack' && (!cancelled() && needs.prepare-release.result == 'success' && !contains(github.ref_name, '-')) }}
permissions:
contents: read
steps:
+1
View File
@@ -24,6 +24,7 @@ permissions:
jobs:
test:
if: (github.event_name == 'pull_request' || github.repository == 'cozystack/cozystack')
name: Typecheck and test
runs-on: ubuntu-latest
steps:
@@ -30,6 +30,7 @@ permissions:
jobs:
update-releasenotes:
if: github.repository == 'cozystack/cozystack'
name: Update Release Notes
# GitHub API calls only — no docker, no repo toolchain: GitHub-hosted.
runs-on: ubuntu-latest
+1
View File
@@ -32,6 +32,7 @@ concurrency:
jobs:
zizmor:
if: (github.event_name == 'pull_request' || github.repository == 'cozystack/cozystack')
name: Audit workflows
runs-on: ubuntu-latest
permissions: