mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
## What this PR does `packages/system/kubevirt-operator` had only an `update:` target, so `hack/helm-unit-tests.sh` skipped it: that script decides what to run by probing `make -C <dir> -n test`. Nothing rendered the chart after a refresh. The same recipe pulled the upstream manifest with `wget` and ran two transforms over whatever came back, with no check on the download. `update` now fetches outside `templates/`, checks the download against a pinned sha256, transforms it there, and moves it in last. The vendored file gets written once per refresh with finished content, and a failure at any step leaves it alone. It has to stay out of `templates/` because Helm renders every file in there, and that directory also holds `prometheusrule.yaml`, which is ours and not upstream's. Upstream ships no checksum for `kubevirt-operator.yaml`. `v1.9.0.tar.gz.asc` signs the source tarball, not the generated manifest. So I measured the pin: downloaded the v1.9.0 asset, hashed it, got `f11307caafc3c23ffedf9887d8beb5a4419e2694da242fa68f63d1ec820de2e0`, and confirmed the recipe's two transforms turn that download into the committed `templates/kubevirt-operator.yaml` byte for byte. It catches an asset that moved under its tag. It is not authenticity verification, and the comment says that. The digest command is resolved at parse time: `sha256sum` when it is on PATH, `shasum -a 256` otherwise. Worth saying which one actually ran, because the usual claim about macOS is out of date: this machine picked `sha256sum`, and it is not GNU coreutils but `/sbin/sha256sum`, a native Darwin binary hardlinked to `/sbin/md5` that reports `sha256sum (Darwin) 1.0` and prints the same `<digest> <path>` format. I checked the fallback separately with `make update SHA256SUM='shasum -a 256'`, which finished and left the tree clean. The fallback still earns its place for older macOS, but it does not make `update` portable on its own: `sed -i` and `awk -i inplace` in the same recipe need GNU sed and gawk, and the comment now says so. `test:` runs `helm unittest`, then greps the vendored manifest for `RELEASE`, same shape as `packages/system/reloader`. helm-unittest cannot see `RELEASE`, so without the grep a pin bumped without re-running `update` leaves every assertion green against the old release. The suite pins that the `PrometheusRule` still renders, and that the `virt-operator` Deployment carries the pinned release in its image, `VIRT_OPERATOR_IMAGE` and `KUBEVIRT_VERSION`, plus both transforms. Every assertion is mutation-tested: removing `prometheusrule.yaml`, drifting each of the three version strings, reverting the namespace rewrite, adding a `Namespace` document back, renaming the Deployment, and bumping `RELEASE` without re-vendoring all go red. `any: true` on the negated `containsDocument` is doing real work, drop it and the suite stays green with a `Namespace` document present. The sweep now runs 84 package suites, one of them new, all green. Closes #4031. ### Screenshots No UI changes. ### Downstream repositories Walked the trigger map against the diff. Two entries look close and neither fires. The website triggers on developer tooling and package Makefiles, but `content/en/docs/next/development.md` documents `make update` only as "Update Helm chart and versions from the upstream source", which still holds, and its `make test` line refers to the e2e sandbox in `packages/core/testing`, not per-package unit tests. `ccp` triggers on `hack/` layout and what a make target does, and its skills anchor on `hack/package.mk` and `hack/common-envs.mk`; nothing under `hack/` is touched and its `package-bump` skill handles vendored charts, in-repo image builds and version enums, none of which is this package's raw manifest download. Everything else in the map needs an app, a schema, an installer value, a variant or a release asset, and this PR changes none of them. - [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: ### Release note ```release-note fix(kubevirt): kubevirt-operator now verifies the upstream manifest against a pinned sha256 before vendoring it, and the package has a unit-test target so hack/helm-unit-tests.sh no longer skips it. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved manifest updates so incomplete downloads or integrity-check failures no longer overwrite the existing working manifest. - Temporary download files are cleaned up after failed updates. - **Tests** - Added validation for the bundled KubeVirt operator manifest, including the expected version, image configuration, namespace, monitoring alert, and removal of an unwanted namespace resource. - **Chores** - Pinned the KubeVirt operator release and verified downloaded manifests against their expected checksum. <!-- end of auto-generated comment: release notes by coderabbit.ai -->