Skip to content

ci: Add workflow to validate all kustomize builds#351

Merged
ptoscano merged 1 commit into
ansible:mainfrom
Francisco-xiq:ci/validate-kustomize-build
Jun 2, 2026
Merged

ci: Add workflow to validate all kustomize builds#351
ptoscano merged 1 commit into
ansible:mainfrom
Francisco-xiq:ci/validate-kustomize-build

Conversation

@Francisco-xiq
Copy link
Copy Markdown
Contributor

@Francisco-xiq Francisco-xiq commented May 28, 2026

Summary

Adds a new GitHub Actions workflow to validate all kustomization.yaml files in the repository on every pull request.

This was suggested in #350, where a stale reference to a deleted file (../default/manager_auth_proxy_patch.yaml) went undetected until manually tested. A kustomize validation step was suggested to solve this problem

What it does

  • Finds all kustomization.yaml files in the repository (excluding vendor/)
  • Runs kustomize build on each one to ensure all referenced files exist and the YAML is valid
  • Reports all failures at once instead of stopping at the first error

Testing

Validated locally and in CI on a test PR that intentionally reintroduced the broken reference, the workflow correctly failed with a clear error message pointing to the problematic file.

Summary by CodeRabbit

  • Chores
    • Added an automated pull-request CI check that validates kustomize configurations across the repository (skips vendored paths). It runs per-directory build validations on pull requests, reports per-directory results, annotates failing manifests inline, and fails the PR check if any validation fails.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 3cef2606-d0c7-4720-901c-a3ec07d9606f

📥 Commits

Reviewing files that changed from the base of the PR and between 3a849f8 and 7bc9494.

📒 Files selected for processing (1)
  • .github/workflows/validate-kustomize.yml

📝 Walkthrough

Walkthrough

This PR adds a GitHub Actions workflow that validates kustomize builds on pull requests by installing kustomize, discovering non-vendor/ kustomization.yaml files, running kustomize build per directory, emitting per-directory OK or ::error annotations, and failing the run if any build fails.

Changes

Kustomize Build Validation Workflow

Layer / File(s) Summary
Kustomize validation and build verification
.github/workflows/validate-kustomize.yml
Workflow installs kustomize, discovers all kustomization.yaml files excluding vendor/, runs kustomize build per directory, logs success/failure messages, emits error annotations on build failure, and exits non-zero if any validation fails.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 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 PR title clearly and concisely describes the main change: adding a GitHub Actions workflow to validate kustomize builds, which directly aligns with the changeset.
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

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

@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: 2

🤖 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/validate-kustomize.yml:
- Around line 12-13: Update the checkout step to use a specific commit SHA for
actions/checkout and add persist-credentials: false to harden credential
exposure, and replace the mutable kustomize install call that invokes
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh with a deterministic
installation of the pinned kustomize version (kustomize/v5.6.0) used by the repo
Makefile—e.g., download the v5.6.0 release binary or use a release-tagged action
instead of the master hack script so the workflow is reproducible and
version-aligned.
- Around line 15-18: The "Install kustomize" workflow step currently pipes the
install script from kubernetes-sigs/kustomize master, which is unpinned; change
this to fetch the kustomize v5.6.0 release artifact (or the install script from
the v5.6.0 tag) instead of master so CI matches the Makefile contract; update
the run step that currently curls "install_kustomize.sh | bash" to download the
v5.6.0 binary (or curl the install script URL pinned to v5.6.0) and then run the
same sudo mv kustomize /usr/local/bin/ to install it.
🪄 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: fbf11a8b-c570-4f3c-953b-217265a3b18c

📥 Commits

Reviewing files that changed from the base of the PR and between dd35b5c and 27ae77d.

📒 Files selected for processing (1)
  • .github/workflows/validate-kustomize.yml

Comment thread .github/workflows/validate-kustomize.yml Outdated
Comment thread .github/workflows/validate-kustomize.yml Outdated
@Francisco-xiq Francisco-xiq force-pushed the ci/validate-kustomize-build branch from 27ae77d to aa07da9 Compare May 28, 2026 21:59
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: 0

🧹 Nitpick comments (1)
.github/workflows/validate-kustomize.yml (1)

4-9: ⚡ Quick win

Add a least-privilege permissions block.

The workflow inherits the default GITHUB_TOKEN permissions. Since it only checks out and validates, scope it to read-only.

🔒 Suggested addition
 on:
   pull_request:

+permissions:
+  contents: read
+
 jobs:
   validate-kustomize:
     runs-on: ubuntu-latest
🤖 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/validate-kustomize.yml around lines 4 - 9, The workflow
currently uses the default GITHUB_TOKEN permissions; add a least-privilege
permissions block at the workflow top-level to scope the token to read-only
(e.g., set permissions: contents: read) so the validate-kustomize job (runs-on:
ubuntu-latest) only has repository read access when triggered on pull_request;
insert this permissions block alongside the existing on: pull_request
declaration to restrict the GITHUB_TOKEN.
🤖 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.

Nitpick comments:
In @.github/workflows/validate-kustomize.yml:
- Around line 4-9: The workflow currently uses the default GITHUB_TOKEN
permissions; add a least-privilege permissions block at the workflow top-level
to scope the token to read-only (e.g., set permissions: contents: read) so the
validate-kustomize job (runs-on: ubuntu-latest) only has repository read access
when triggered on pull_request; insert this permissions block alongside the
existing on: pull_request declaration to restrict the GITHUB_TOKEN.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 0758a104-b32e-4f80-8ca4-3d11595114ce

📥 Commits

Reviewing files that changed from the base of the PR and between 27ae77d and aa07da9.

📒 Files selected for processing (1)
  • .github/workflows/validate-kustomize.yml

@Francisco-xiq Francisco-xiq force-pushed the ci/validate-kustomize-build branch 2 times, most recently from 66e4843 to 1f6963d Compare May 28, 2026 22:25
@Francisco-xiq
Copy link
Copy Markdown
Contributor Author

Updated the workflow to use make kustomize so the CI stays in sync with whatever version the Makefile pins no duplication needed.

For the actions/checkout SHA pin, I've noticed that all other workflows here use @v4, so I kept it consistent. Happy to change if the project wants to adopt another solution.

@Francisco-xiq Francisco-xiq force-pushed the ci/validate-kustomize-build branch 2 times, most recently from 46789f3 to beefc5e Compare May 29, 2026 12:57
Copy link
Copy Markdown
Contributor

@ptoscano ptoscano left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! This mostly LGTM, there are few minor things to fix.

Comment thread .github/workflows/validate-kustomize.yml Outdated
Comment thread .github/workflows/validate-kustomize.yml
Comment thread .github/workflows/validate-kustomize.yml
Comment thread .github/workflows/validate-kustomize.yml Outdated
@Francisco-xiq Francisco-xiq force-pushed the ci/validate-kustomize-build branch from beefc5e to 3a849f8 Compare June 1, 2026 13:24
@Francisco-xiq Francisco-xiq requested a review from ptoscano June 1, 2026 13:26
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/validate-kustomize.yml:
- Around line 12-13: The checkout step currently uses actions/checkout@v6
without disabling credential persistence; update the Checkout sources step (the
actions/checkout@v6 usage) to include persist-credentials: false in its step
inputs so the GITHUB_TOKEN is not left in the workspace after checkout,
improving defense-in-depth.
🪄 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 50559e16-a3e0-429e-a8a7-12f99a4ed0b3

📥 Commits

Reviewing files that changed from the base of the PR and between 46789f3 and 3a849f8.

📒 Files selected for processing (1)
  • .github/workflows/validate-kustomize.yml

Comment thread .github/workflows/validate-kustomize.yml
Signed-off-by: Francisco-Xiq <franciscopsf.contato@gmail.com>
Signed-off-by: Francisco-xiq <franciscopsf.contato@gmail.com>
@Francisco-xiq Francisco-xiq force-pushed the ci/validate-kustomize-build branch from 3a849f8 to 7bc9494 Compare June 1, 2026 19:30
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 1, 2026

@ptoscano
Copy link
Copy Markdown
Contributor

ptoscano commented Jun 2, 2026

@coderabbitai resume

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

✅ Actions performed

Reviews resumed.

Copy link
Copy Markdown
Contributor

@ptoscano ptoscano left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@ptoscano ptoscano merged commit 0ca356d into ansible:main Jun 2, 2026
8 checks passed
@Francisco-xiq Francisco-xiq deleted the ci/validate-kustomize-build branch June 2, 2026 11:52
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.

2 participants