Skip to content

fix: unbreak CI workflow and Helm chart, publish image on main#1

Closed
Arsolitt wants to merge 7 commits into
mainfrom
fix/ci-and-chart
Closed

fix: unbreak CI workflow and Helm chart, publish image on main#1
Arsolitt wants to merge 7 commits into
mainfrom
fix/ci-and-chart

Conversation

@Arsolitt
Copy link
Copy Markdown
Collaborator

@Arsolitt Arsolitt commented May 15, 2026

Summary

The CI workflow was failing on every commit, and the Helm chart shipped two
runtime-blocking bugs. This PR addresses both so the project can be deployed
from a published image.

CI fixes

  • lintgoconst was firing on test fixtures (CIDRs, namespace names,
    cluster names). Add goconst to the existing lint exclusions for
    _test\.go files in .golangci.yml.
  • generatemake manifests generate produced a diff on a clean
    checkout because zz_generated.deepcopy.go was committed without the
    boilerplate copyright header and because manifests generated a CRD for
    the external kilo.squat.ai/Peer type the operator does not own.
    Regenerate the deepcopy files with the header and restrict CRD generation
    to ./api/....
  • helm — Helm 4 requires plugin source verification by default, which
    the helm-unittest source does not support. Pass --verify=false to
    helm plugin install.

Chart fixes

  • The manager binary does not define a --namespace flag; the chart passed
    one and caused the Pod to exit on startup. Remove the argument and the
    matching unit test.
  • The chart configured --metrics-bind-address=:8080 but the binary
    defaults metrics-secure to true, which started HTTPS on the HTTP port
    and produced an unscrapeable endpoint without a TLS setup. Add
    metricsSecure to values.yaml (default false) and pass
    --metrics-secure explicitly. Add unit-test coverage for both branches.

Image publishing

  • Add an image job to .github/workflows/ci.yml that builds the
    multi-arch Containerfile and pushes to
    ghcr.io/cozystack/kilo-clustermesh-operator with :main and
    :sha-<commit> tags on push to main. The job gates on all preceding
    checks. Tagged releases continue to use release.yml.

Out of scope

  • The operator still assumes Kilo runs with --mesh-granularity=cross.
    Existing cluster configs need to be adjusted separately.
  • release.yml is left untouched; tagged release publishing is unchanged.

Test plan

  • golangci-lint run0 issues
  • go test ./api/... ./pkg/... ./internal/... -race — all pass
  • go build -o /dev/null ./cmd/main.go
  • helm lint charts/kilo-clustermesh-operator --strict
  • helm unittest charts/kilo-clustermesh-operator — 39/39 tests pass
  • make manifests generate && git diff --exit-code — clean
  • CI green on this PR
  • After merge: image appears at
    ghcr.io/cozystack/kilo-clustermesh-operator:main

Summary by CodeRabbit

  • New Features

    • Added configurable metricsSecure option in Helm chart values to control secure metrics endpoint behavior
  • Tests

    • Expanded Helm chart tests with metrics configuration coverage
  • Chores

    • Enhanced CI/CD pipeline with automated container image building and registry publishing
    • Improved build manifest generation workflow

Review Change Stack

Arsolitt added 5 commits May 15, 2026 12:15
Restrict CRD generation to ./api/... so manifests no longer produces
config/crd/bases/kilo.squat.ai_peers.yaml for the external Kilo Peer
type. Regenerate deepcopy files so the boilerplate header from
hack/boilerplate.go.txt is committed, matching what controller-gen
produces in CI.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
Test files contain CIDRs, namespace names and similar fixtures repeated
across cases; promoting them to constants only obscures intent. Add
goconst to the linter exclusion list for _test\.go.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
The operator binary does not define a --namespace flag; passing it
caused the manager to exit at startup. Remove the argument from the
Deployment and the corresponding unit test.

The chart wired --metrics-bind-address=:8080 while the binary defaults
metrics-secure to true, which started HTTPS on an HTTP port and made
metrics unscrapeable without a TLS setup. Expose metricsSecure in
values.yaml (default false) and pass --metrics-secure explicitly.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
Helm 4.1 requires plugin source verification by default, which the
helm-unittest source does not support. Without the flag the helm CI
job aborts with "plugin source does not support verification" before
helm lint and unit tests can run.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
Add an image job that builds the multi-arch Containerfile and pushes
to ghcr.io/cozystack/kilo-clustermesh-operator with :main and
:sha-<commit> tags. The job runs only on push to main and waits for
all checks (lint, test, integration, build, helm, generate) so a
broken commit cannot publish an image. Tagged releases are still
handled by .github/workflows/release.yml.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@Arsolitt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 46 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 146c7596-320c-4572-b6ff-e471ed0dbed4

📥 Commits

Reviewing files that changed from the base of the PR and between e3c5682 and f4497d6.

📒 Files selected for processing (2)
  • pkg/kilo/v1alpha1/register.go
  • pkg/kilo/v1alpha1/types_test.go
📝 Walkthrough

Walkthrough

This PR adds metrics security configuration to the Helm chart, enhances the CI pipeline with Docker image building and publication to ghcr.io, refines build tooling by splitting controller-gen invocations, adjusts linter exclusions for test files, and maintains Apache 2.0 license headers in autogenerated files.

Changes

Metrics and Build Infrastructure Updates

Layer / File(s) Summary
Metrics security configuration and testing
charts/kilo-clustermesh-operator/values.yaml, charts/kilo-clustermesh-operator/templates/deployment.yaml, charts/kilo-clustermesh-operator/tests/deployment_test.yaml
New metricsSecure Helm value defaults to false and passes --metrics-secure to the manager container. Deployment tests verify both default (false) and enabled (true) configurations.
Container image build and registry push pipeline
.github/workflows/ci.yml
New image job triggered on main branch pushes: logs into ghcr.io, generates Docker tags/labels, builds image from Containerfile with VERSION and REVISION args, and pushes to ghcr.io/${{ github.repository }} using GitHub Actions cache. Helm job now installs helm-unittest with --verify=false.
Controller generation and linter configuration
Makefile, .golangci.yml
manifests target splits controller-gen into separate RBAC/webhook and CRD invocations. Test file linter exclusions add goconst to disabled linters.
Generated file license headers
api/v1alpha1/zz_generated.deepcopy.go, pkg/kilo/v1alpha1/zz_generated.deepcopy.go
Added Apache 2.0 copyright/license header comments following build-tag directives. No changes to deepcopy implementations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Metrics now secure, a config so fine,
Docker images built and pushed in the line,
With headers so proper and tools set apart,
CI flows brighter—a well-structured art!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixing CI workflow, Helm chart issues, and adding image publishing to main.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-and-chart

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several configuration and build-related updates. The Makefile was modified to refine CRD generation by targeting specific API paths, and the goconst linter was enabled for test files in the golangci configuration. The kilo-clustermesh-operator Helm chart was updated to include a new --metrics-secure flag, while the --namespace argument was removed from the deployment template. Additionally, license headers were added to auto-generated deepcopy files. There are no review comments to address, and I have no feedback to provide.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/ci.yml:
- Around line 83-96: Replace the floating tags for the Docker actions with
immutable commit SHAs: change usages of docker/login-action@v3,
docker/setup-buildx-action@v3, docker/metadata-action@v5 (id: meta) and
docker/build-push-action@v6 to their corresponding full commit@sha values and
add the original version (e.g., v3/v5/v6) as a trailing comment for readability;
ensure each action line is updated so the workflow uses the exact commit SHA to
prevent upstream retags from changing 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b03e4b45-7a09-4f2d-a040-f682e1fb6910

📥 Commits

Reviewing files that changed from the base of the PR and between f0e9b03 and e3c5682.

📒 Files selected for processing (8)
  • .github/workflows/ci.yml
  • .golangci.yml
  • Makefile
  • api/v1alpha1/zz_generated.deepcopy.go
  • charts/kilo-clustermesh-operator/templates/deployment.yaml
  • charts/kilo-clustermesh-operator/tests/deployment_test.yaml
  • charts/kilo-clustermesh-operator/values.yaml
  • pkg/kilo/v1alpha1/zz_generated.deepcopy.go

Comment thread .github/workflows/ci.yml
Comment on lines +83 to +96
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=main
type=sha,prefix=sha-,format=long
- uses: docker/build-push-action@v6
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/ci.yml

Repository: cozystack/kilo-clustermesh-operator

Length of output: 3825


🌐 Web query:

GitHub Actions security best practices pin commit SHA Docker actions

💡 Result:

Pinning GitHub Actions to a full-length commit SHA is a critical security best practice for protecting your CI/CD supply chain [1][2][3]. Why Pin to a Commit SHA GitHub Actions referenced by tags (e.g., @v4) or branches (e.g., @main) are mutable [4][5][6]. This means an attacker who compromises the action's repository or the maintainer's account can force-push a new commit to that tag, silently changing the code your workflow executes [7][8][9]. Pinning to an immutable, full-length commit SHA ensures that your workflow always runs the exact, audited code you expect, preventing unauthorized code execution [5][6][3]. How to Implement SHA Pinning 1. Identify the current commit SHA: You can retrieve the full SHA for a specific tag using Git commands (e.g., git ls-remote https://github.com/owner/repo tag_name) or by viewing the commit history in the action's repository [1][7]. 2. Update your workflow: Replace the tag in your workflow file with the full SHA [7][8]. 3. Add a version comment: To maintain readability and ease of updates, include the original version tag as a comment next to the SHA [7][8][10]. Example: uses: actions/checkout@11bd719 # v4.2.2 Governance and Enforcement GitHub now supports organization-level and repository-level policies that can enforce SHA pinning [2][10][3]. When enabled, any workflow attempting to use an action referenced by a tag or branch will fail, ensuring compliance across your organization [2][5][10]. Administrators can configure these policies in the GitHub Actions settings for their organization or repository [3]. Maintaining Pinned Actions Because pinned actions do not automatically receive updates, you must manage them manually or via automation [1][9]. Tools like Dependabot or Renovate can be configured to monitor for updates to your pinned actions and automatically open pull requests to update the SHAs, allowing you to review and test changes before merging [1][2][9].

Citations:


Pin the Docker actions to immutable commit SHAs.

Version refs like v3, v5, and v6 float with upstream tag updates. Since this workflow publishes release artifacts to ghcr.io on every push to main, any re-tagging of upstream actions could silently change the image contents without a PR in this repository.

Pin each Docker action to its full commit SHA and include the version tag as a comment for maintainability:

Suggested shape
-      - uses: docker/login-action@v3
+      - uses: docker/login-action@<full-commit-sha> # v3

-      - uses: docker/setup-buildx-action@v3
+      - uses: docker/setup-buildx-action@<full-commit-sha> # v3

-      - uses: docker/metadata-action@v5
+      - uses: docker/metadata-action@<full-commit-sha> # v5

-      - uses: docker/build-push-action@v6
+      - uses: docker/build-push-action@<full-commit-sha> # v6
🤖 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/ci.yml around lines 83 - 96, Replace the floating tags for
the Docker actions with immutable commit SHAs: change usages of
docker/login-action@v3, docker/setup-buildx-action@v3, docker/metadata-action@v5
(id: meta) and docker/build-push-action@v6 to their corresponding full
commit@sha values and add the original version (e.g., v3/v5/v6) as a trailing
comment for readability; ensure each action line is updated so the workflow uses
the exact commit SHA to prevent upstream retags from changing behavior.

Arsolitt added 2 commits May 15, 2026 12:35
golangci-lint v2.12 flagged "kilo.squat.ai" repeated across register.go
and types_test.go via goconst. Define a GroupName constant in the Kilo
v1alpha1 package and use it from both call sites; this also matches
the convention used by upstream Kubernetes API packages.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
golangci-lint v2.12 picked up another goconst occurrence:
the literal "v1alpha1" repeated across register.go and types_test.go.
Define a GroupVersion constant alongside GroupName and use it from
both call sites.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
@Arsolitt Arsolitt closed this May 15, 2026
@Arsolitt Arsolitt deleted the fix/ci-and-chart branch May 15, 2026 10:45
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.

1 participant