Skip to content

Commit f8217be

Browse files
committed
Merge branch 'main' into chore/cilium-drop-unread-values
Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
2 parents 700600e + 3ede7c4 commit f8217be

119 files changed

Lines changed: 6850 additions & 979 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
## What this PR does
1515

16+
<!-- Link the issues this PR addresses. For a complete fix targeting the default branch, use Closes #N (Closes owner/repository#N for another repository). Otherwise use a non-closing reference; release-branch PRs need manual issue linking and closure when appropriate. -->
1617

1718
### Screenshots
1819

‎.github/workflows/e2e-fork.yaml‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ jobs:
6161
# base-repo PR file list — NOT from the presence/absence of an artifact the
6262
# fork's own build controls. Fail-closed if the fork build failed or the
6363
# pr-patch artifact is missing; green-and-stop only for a PR whose file list is
64-
# entirely under docs/ (verified against the base-repo API).
64+
# entirely under docs/ or the CI-only tools cmd/backport-batch/ and
65+
# cmd/api-gate/ (verified against the base-repo API).
6566
resolve:
6667
name: Resolve fork PR
6768
# Only fork PRs: head_repository differs from the base repository. Same-repo
@@ -266,15 +267,21 @@ jobs:
266267
await decide('failure', 'PR file list hit the 3000-file API cap — cannot verify docs-only');
267268
return;
268269
}
270+
// Paths with nothing to build and nothing for e2e to install: docs,
271+
// and the CI-only Go tools no image builds. pull-requests.yaml's
272+
// plan job answers the same question with the same prefixes, and
273+
// hack/gate-concurrency-contract.bats holds the two lists equal.
274+
//
269275
// A rename reports the NEW path in `filename` and the old one in
270276
// `previous_filename`. Checking only `filename` would read a
271277
// packages/… -> docs/… rename as docs-only, when it in fact removes
272-
// a code path. BOTH sides must be under docs/ to count as docs-only.
273-
const isDocs = p => typeof p === 'string' && p.startsWith('docs/');
274-
const hasNonDocs = files.some(f =>
275-
!isDocs(f.filename) || (f.previous_filename && !isDocs(f.previous_filename)));
276-
if (!hasNonDocs) {
277-
await decide('success', 'docs-only PR (verified via PR file list) — e2e not required');
278+
// a code path. BOTH sides must be under these prefixes to count.
279+
const noRuntimePrefixes = ['docs/', 'cmd/backport-batch/', 'cmd/api-gate/'];
280+
const isNoRuntime = p => typeof p === 'string' && noRuntimePrefixes.some(x => p.startsWith(x));
281+
const hasRuntime = files.some(f =>
282+
!isNoRuntime(f.filename) || (f.previous_filename && !isNoRuntime(f.previous_filename)));
283+
if (!hasRuntime) {
284+
await decide('success', 'docs or CI-only tools (verified via PR file list) — e2e not required');
278285
return;
279286
}
280287

‎.github/workflows/pull-requests.yaml‎

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575
statuses: write
7676
outputs:
7777
code: ${{ steps.p.outputs.code }}
78+
docs: ${{ steps.p.outputs.docs }}
79+
backport_batch: ${{ steps.p.outputs.backport_batch }}
7880
matrix: ${{ steps.p.outputs.matrix }}
7981
any: ${{ steps.p.outputs.any }}
8082
touched: ${{ steps.p.outputs.touched }}
@@ -167,11 +169,27 @@ jobs:
167169
# alone here rather than widened by a side effect.
168170
git diff --name-only --no-renames "origin/${BASE_REF}...HEAD" > /tmp/changed_norenames.txt
169171
echo "Changed files:"; sed 's/^/ /' /tmp/changed_norenames.txt
170-
if grep -qvE '^docs/' /tmp/changed_norenames.txt; then
172+
# `code` is false when every path is under docs/ or in a CI-only Go
173+
# tool that no image builds (cmd/backport-batch, cmd/api-gate): there
174+
# is nothing to build and nothing for e2e to install. e2e-fork.yaml
175+
# answers the same question from the PR file list with the same
176+
# prefixes, and hack/gate-concurrency-contract.bats holds the two lists
177+
# equal.
178+
if grep -qvE '^(docs/|cmd/backport-batch/|cmd/api-gate/)' /tmp/changed_norenames.txt; then
171179
echo "code=true" >> "$GITHUB_OUTPUT"
172180
else
173181
echo "code=false" >> "$GITHUB_OUTPUT"
174182
fi
183+
# The Bats contracts read docs, so a docs change runs them even when
184+
# `code` is false; a change confined to the CI-only tools does not.
185+
if grep -qE '^docs/' /tmp/changed_norenames.txt; then
186+
echo "docs=true" >> "$GITHUB_OUTPUT"
187+
else
188+
echo "docs=false" >> "$GITHUB_OUTPUT"
189+
fi
190+
backport_batch="$(hack/backport-batch-tests-needed.sh /tmp/changed_norenames.txt)"
191+
echo "backport-batch tests needed: $backport_batch"
192+
echo "backport_batch=$backport_batch" >> "$GITHUB_OUTPUT"
175193
matrix="$(hack/build-matrix.sh /tmp/changed.txt)"
176194
echo "Build matrix: $matrix"
177195
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
@@ -293,9 +311,11 @@ jobs:
293311
contents: read
294312
needs: ["plan"]
295313
# Unit contracts read both code and documentation. Run this job for every
296-
# non-release PR: code changes take the complete unit path, while docs-only
297-
# changes run the Bats lane that owns those cross-tree contracts. Builds and
298-
# E2E remain gated on `code` below.
314+
# non-release PR: code changes take the complete unit path, docs changes run
315+
# the Bats lane that owns those cross-tree contracts, and the backport-batch
316+
# tests run whenever one of their inputs changed and at no other time. A
317+
# change confined to the CI-only tools runs no other lane. Builds and E2E
318+
# remain gated on `code` below.
299319
if: |
300320
!contains(github.event.pull_request.labels.*.name, 'release')
301321
steps:
@@ -306,29 +326,31 @@ jobs:
306326
# The module cache is restored from the key build-main.yaml writes on
307327
# main, which every PR run can read, so a PR's first run starts warm. The
308328
# download fetches whatever the cache lacks, the whole set on a miss. The
309-
# Go steps are for code changes only: a docs-only run is the Bats lane alone.
329+
# Go steps are for code changes and the backport-batch tests only: a
330+
# docs-only run is the Bats lane alone.
310331
- name: Locate Go module cache
311-
if: needs.plan.outputs.code == 'true'
332+
if: needs.plan.outputs.code == 'true' || needs.plan.outputs.backport_batch == 'true'
312333
id: gomodcache
313334
run: echo "dir=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
314335
- name: Cache Go modules
315-
if: needs.plan.outputs.code == 'true'
336+
if: needs.plan.outputs.code == 'true' || needs.plan.outputs.backport_batch == 'true'
316337
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
317338
with:
318339
path: ${{ steps.gomodcache.outputs.dir }}
319340
key: go-mod-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
320341
restore-keys: go-mod-${{ runner.os }}-
321342
- name: Download Go modules
322-
if: needs.plan.outputs.code == 'true'
343+
if: needs.plan.outputs.code == 'true' || needs.plan.outputs.backport_batch == 'true'
323344
run: |
324345
for mod in $(git ls-files go.mod '*/go.mod' | xargs -n1 dirname); do
325346
(cd "$mod" && "$GITHUB_WORKSPACE/hack/go-mod-download.sh")
326347
done
327348
# Ephemeral runners don't carry the helm-unittest plugin the persistent
328349
# self-hosted runner accreted. The plugin embeds its own Helm, so its
329350
# version is pinned: a plugin release must not change test results. Bats is
330-
# installed on every run, docs-only ones included.
351+
# installed whenever a Bats lane runs, docs-only ones included.
331352
- name: Set up test toolchain
353+
if: needs.plan.outputs.code == 'true' || needs.plan.outputs.docs == 'true'
332354
env:
333355
CODE_CHANGED: ${{ needs.plan.outputs.code }}
334356
HELM_UNITTEST_VERSION: "1.1.2"
@@ -374,8 +396,15 @@ jobs:
374396
if: needs.plan.outputs.code == 'true'
375397
run: make unit-tests test-controllers test-controllers-envtest -j4 -k --output-sync=target
376398
- name: Run Bats unit tests for docs-only changes
377-
if: needs.plan.outputs.code == 'false'
399+
if: needs.plan.outputs.code == 'false' && needs.plan.outputs.docs == 'true'
378400
run: make bats-unit-tests
401+
# Not part of `make unit-tests`: hack/backport-batch-tests-needed.sh
402+
# decides from cmd/backport-batch/test-inputs.txt, whatever `code` is.
403+
# `!cancelled()` for the reason the unit lane runs with -k: a red step
404+
# above must not hide this suite's own result.
405+
- name: Run backport-batch tests
406+
if: ${{ !cancelled() && needs.plan.outputs.backport_batch == 'true' }}
407+
run: make test-backport-batch
379408
- name: Upload unit test report
380409
if: always()
381410
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -1427,7 +1456,7 @@ jobs:
14271456
description = `release packages candidate did not verify (result: ${CANDIDATE_RESULT})`;
14281457
} else if (CODE !== 'true') {
14291458
state = 'success';
1430-
description = 'docs-only PR — e2e not required';
1459+
description = 'docs or CI-only tools — e2e not required';
14311460
} else if (IS_RELEASE === 'true' && IS_FULL_E2E !== 'true') {
14321461
// Release promotion PRs deliberately do not repeat e2e: the rc was
14331462
// already verified against the immutable candidate whose digests

‎AGENTS.md‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This file provides structured guidance for AI coding assistants and agents worki
3636

3737
- **E2E tests and E2E CI** (e.g., "write/fix an e2e test", "stabilize a flaky test", "add a bats test", "change the e2e workflow", "why did e2e fail")
3838
- Read: [`e2e-testing.md`](./docs/agents/e2e-testing.md)
39-
- Action: Read the entire file and follow the conventions exactly — no new retries on deterministic steps, event-driven backstops before every `kubectl wait`, no test-level `EXIT`/`RETURN` traps (a self-contained one inside a Chainsaw `script` step or an explicit subshell is fine — see the doc), no assertion beginning with `!` (errexit exempts an inverted status, so it cannot fail — write `if cmd; then echo "FAIL: …"; false; fi`), fail-fast on HelmRelease readiness
39+
- Action: Read the entire file and follow the conventions exactly — no new retries on deterministic steps, event-driven backstops before every `kubectl wait`, no test-level `EXIT`/`RETURN` traps (a self-contained one inside a Chainsaw `script` step or an explicit subshell is fine — see the doc), no assertion beginning with `!` (errexit exempts an inverted status, so it can be silently ignored — write `if cmd; then echo "FAIL: …"; false; fi`), fail-fast on HelmRelease readiness
4040

4141
- **General questions about contributing**
4242
- Read: [`contributing.md`](./docs/agents/contributing.md)
@@ -51,17 +51,30 @@ This file provides structured guidance for AI coding assistants and agents worki
5151
- PR titles: a Conventional Commits header (`type(scope): description`, types from [`contributing.md`](./docs/agents/contributing.md)) auto-applies `kind/*` and `area/*` via `.github/workflows/pr-labeler.yaml`. Append `!` (or add a `BREAKING CHANGE:` footer) to apply `kind/breaking-change`
5252

5353
**Important rules:**
54+
5455
- **Match scope, then read first.** Load a process file only when the task genuinely falls in its scope, and load it before starting work — not midway through. Tasks outside a file's scope should not pull it into context.
5556
- **Follow it exactly.** Do not assume you already know the process, and do not skip steps (`changelog.md` especially). Where the documentation and your instinct disagree, the documentation wins.
5657
- **[`overview.md`](./docs/agents/overview.md) is the standing reference** for structure and conventions, useful even when no route above points at it.
5758

59+
## Working Principles
60+
61+
These hold for every task, whichever document the routes above point at.
62+
63+
- **A causal claim needs a mechanism.** A failure that appeared after a commit, a bump or a rerun was not thereby caused by it, and matching symptoms prove nothing either: unrelated faults often look identical from outside. Back a root cause with a log line, a reproducer, a bisect, or a ruled-out alternative; without one, name at least two hypotheses and what would tell them apart. Before tying a problem to a change, check whether it predates the change (an older run, a condition's `lastTransitionTime`, `git blame`). Close a hypothesis when evidence rules it out. Missing evidence means inconclusive, not coincidence: record that limit, stop treating the hypothesis as a cause, and revisit it only with new evidence or a concrete discriminating check.
64+
- **Verify, do not recall.** Versions, CLI flags, API fields and defaults drift faster than a model's training data. Check the upstream source, the documentation at the pinned version, or `--help` before writing code or advice that depends on them. When a problem is not solved after two attempts, stop and research it instead of trying a third variation.
65+
- **Long flag names.** New and changed commands in docs, scripts, CI and PR text spell options out (`--namespace`, `--output`, `--filename`, `--message`), so that a reader does not need to know what `-f` means to this particular tool. An option with no long form is the only exception.
66+
- **Name the cluster.** Management and tenant clusters are different targets. Every `kubectl` call, including reads, carries `--context`; cluster-facing Helm commands carry `--kube-context`. Use the human-approved target and the task's kubeconfig where one was supplied, not the ambient current context. Before running wrappers or cluster-facing tests, verify that they propagate the chosen target. Tests that need no cluster must not inherit live cluster credentials.
67+
- **Respect the reader's time.** Lead with the answer or decision; prefer direct wording over formalities, filler and repeated conclusions. Put necessary detail after a short summary or in a linked document.
68+
- **Public text.** Everything that reaches GitHub (commits, PR and issue bodies, review comments, code comments) is in English. It names no private infrastructure (cluster, customer or internal namespace names) and none of an agent's private tooling (custom skills, slash commands). Nothing is published on someone's behalf without their approval, unless they have delegated it.
69+
5870
## Project Overview
5971

6072
**Cozystack** is a Kubernetes-based platform for building cloud infrastructure with managed services (databases, VMs, K8s clusters), multi-tenancy, and GitOps delivery.
6173

6274
## Quick Reference
6375

6476
### Code Structure
77+
6578
- `packages/core/` - Core platform charts (installer, platform)
6679
- `packages/system/` - System components (CSI, CNI, operators)
6780
- `packages/apps/` - User-facing applications in catalog
@@ -70,13 +83,15 @@ This file provides structured guidance for AI coding assistants and agents worki
7083
- `api/` - Kubernetes CRDs
7184

7285
### Conventions
86+
7387
- **Helm Charts**: Umbrella pattern, vendored upstream charts in `charts/`
7488
- **Go Code**: Controller-runtime patterns, kubebuilder style
7589
- **Git Commits**: Conventional Commits (`type(scope): description`) with `--signoff`; an agent-assisted commit adds one `Assisted-by: LLM` trailer
7690
- **Comments and commit bodies**: WHY, not a narration of WHAT; see [Review Blockers](./docs/agents/contributing.md#review-blockers-messages-trailers-comments) in contributing.md
7791
- **Prose**: One continuous line per paragraph — see [Prose Formatting](#prose-formatting)
7892

7993
### What NOT to Do
94+
8095
- ❌ Edit `/vendor/`, `zz_generated.*.go`, upstream charts directly
8196
- ❌ Modify `go.mod`/`go.sum` manually (use `go get`)
8297
- ❌ Force push to main/master

‎Makefile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ test:
120120
make -C packages/core/testing apply
121121
make -C packages/core/testing e2e
122122

123-
unit-tests: helm-unit-tests bats-unit-tests bats-posix-compat-tests go-unit-tests go-module-tests rd-presets-check test-check-readiness test-backport-batch migrations-target-check
123+
unit-tests: helm-unit-tests bats-unit-tests bats-posix-compat-tests go-unit-tests go-module-tests rd-presets-check test-check-readiness migrations-target-check
124124

125125
helm-unit-tests:
126126
hack/helm-unit-tests.sh
@@ -195,7 +195,9 @@ test-check-readiness:
195195
go test ./test/check-readiness/ -count=1
196196

197197
# The batch tool's suite drives real git repositories for minutes, so it is
198-
# kept out of go-unit-tests in a target of its own.
198+
# kept out of go-unit-tests in a target of its own. It is not a prerequisite
199+
# of unit-tests: the checks job in pull-requests.yaml runs it only when the
200+
# diff touches a path listed in cmd/backport-batch/test-inputs.txt.
199201
test-backport-batch:
200202
go test ./cmd/backport-batch/... -count=1
201203

0 commit comments

Comments
 (0)