Skip to content

fix(dolibarr): centralize template validation#660

Merged
mberlofa merged 4 commits into
mainfrom
fix/dolibarr-template-standards
Jul 6, 2026
Merged

fix(dolibarr): centralize template validation#660
mberlofa merged 4 commits into
mainfrom
fix/dolibarr-template-standards

Conversation

@mberlofa

@mberlofa mberlofa commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a dolibarr.validate helper and validate.yaml entrypoint for fail-fast chart validation
  • cover ingress, Gateway API, External Secrets, backup, and reserved selector-label validation with unit tests
  • guard reserved selector-label validation when podLabels is unset

Validation

  • make template-standards-check CHART=dolibarr
  • helm unittest charts/dolibarr
  • helm lint --strict charts/dolibarr
  • make standards-check CHART=dolibarr
  • make validate-chart CHART=dolibarr TIMEOUT=1200: FULLY VALIDATED (17 layers)
  • make site-sync-check CHART=dolibarr
  • make release-check REPO=charts
  • make attribution-check REPO=charts

Site PR: helmforgedev/site#339
Issue: #633

Summary by CodeRabbit

  • Bug Fixes

    • Added chart-time validation to fail fast on misconfigurations for ingress, gateway, S3 backups, and external secrets.
    • Prevents overriding reserved selector labels that could break label matching.
  • Tests

    • Expanded Helm validation coverage for gateway and external-secrets failure scenarios, including required admin-password mapping behavior.
    • Added assertions ensuring reserved pod label restrictions are enforced and podLabels: null is accepted.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Standards Check (GR-079) — PASS

Every changed chart fully passes standards-check.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ba4d6871-6d17-413e-a7c5-8cb51dac736b

📥 Commits

Reviewing files that changed from the base of the PR and between 7e95859 and 6341bdf.

📒 Files selected for processing (1)
  • charts/dolibarr/tests/validation_test.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/dolibarr/tests/validation_test.yaml

📝 Walkthrough

Walkthrough

Adds a Helm validation helper, wires it into chart rendering, and extends tests for ingress, gateway, backup, externalSecrets, and podLabels validation.

Changes

Chart Validation

Layer / File(s) Summary
Validation helper template
charts/dolibarr/templates/_helpers.tpl, charts/dolibarr/templates/validate.yaml
Adds dolibarr.validate with checks for database mode, backup, ingress hosts, gateway parentRefs, externalSecrets, and reserved selector labels, and invokes it from a new validation template.
Ingress, gateway, backup, and podLabels checks
charts/dolibarr/tests/validation_test.yaml
Adds tests for missing ingress hosts, Gateway parentRefs validation, reserved podLabels overrides, accepted podLabels: null, and incomplete backup S3 config.
External secrets checks
charts/dolibarr/tests/validation_test.yaml
Adds tests for missing admin.existingSecret, empty externalSecrets.data, a missing admin-password mapping, and a positive combined ingress, gateway, and external secrets case.

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 title clearly reflects the main change: centralizing Dolibarr chart validation in a shared template.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dolibarr-template-standards

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

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🟢 Security Scan: dolibarr

Framework Score
MITRE + NSA + SOC2 87.878784%

✅ Security posture acceptable.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80fcdb64c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread charts/dolibarr/templates/_helpers.tpl Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
charts/dolibarr/tests/validation_test.yaml (1)

1-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test coverage gap: Gateway API and remaining externalSecrets branches untested.

The PR objectives state unit tests cover "Gateway API" and "External Secrets" validation, but this suite only exercises ingress, podLabels, backup, and the admin.existingSecret externalSecrets branch. Missing negative cases for the new dolibarr.validate branches added in _helpers.tpl:

  • gateway.enabled with no gateway.parentRefs (Line 275-277 of _helpers.tpl).
  • gateway.parentRefs entries missing name (Line 279-281).
  • externalSecrets.data empty (Line 288-290).
  • externalSecrets.data missing the admin-password key mapping (Line 296-298).

Recommend adding these cases to keep the validation helper's test coverage in sync with its actual branches.

➕ Example additional test cases
  - it: should reject gateway without parentRefs
    set:
      gateway.enabled: true
    asserts:
      - failedTemplate:
          errorMessage: "gateway.enabled requires gateway.parentRefs to be populated to create a valid HTTPRoute."

  - it: should reject gateway parentRefs entry missing name
    set:
      gateway.enabled: true
      gateway.parentRefs:
        - namespace: default
    asserts:
      - failedTemplate:
          errorMessage: "Each gateway.parentRefs entry must define a 'name' field"

  - it: should reject externalSecrets without data
    set:
      admin.existingSecret: dolibarr-admin
      externalSecrets.enabled: true
      externalSecrets.data: []
    asserts:
      - failedTemplate:
          errorMessage: "externalSecrets.data must not be empty when externalSecrets.enabled=true"

  - it: should reject externalSecrets missing admin password mapping
    set:
      admin.existingSecret: dolibarr-admin
      externalSecrets.enabled: true
      externalSecrets.data:
        - secretKey: some-other-key
          remoteRef:
            key: dolibarr/other
    asserts:
      - failedTemplate:
          errorMessage: "externalSecrets.data must include a mapping for key 'admin-password' (admin password)"
🤖 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 `@charts/dolibarr/tests/validation_test.yaml` around lines 1 - 40, Add missing
validation tests in validation_test.yaml to cover the remaining branches in
dolibarr.validate from _helpers.tpl. Include negative cases for gateway.enabled
without gateway.parentRefs, gateway.parentRefs entries missing name,
externalSecrets.enabled with empty externalSecrets.data, and
externalSecrets.data that does not map admin-password. Use the existing test
style and failedTemplate assertions so the suite matches the actual validation
paths.
🤖 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 `@charts/dolibarr/tests/validation_test.yaml`:
- Around line 1-40: Add missing validation tests in validation_test.yaml to
cover the remaining branches in dolibarr.validate from _helpers.tpl. Include
negative cases for gateway.enabled without gateway.parentRefs,
gateway.parentRefs entries missing name, externalSecrets.enabled with empty
externalSecrets.data, and externalSecrets.data that does not map admin-password.
Use the existing test style and failedTemplate assertions so the suite matches
the actual validation paths.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 10e22b92-f9b1-4dba-89e9-2f709b35d386

📥 Commits

Reviewing files that changed from the base of the PR and between 870b4c7 and 80fcdb6.

📒 Files selected for processing (3)
  • charts/dolibarr/templates/_helpers.tpl
  • charts/dolibarr/templates/validate.yaml
  • charts/dolibarr/tests/validation_test.yaml

@mberlofa mberlofa force-pushed the fix/dolibarr-template-standards branch from b636270 to 581f747 Compare July 4, 2026 15:39
@mberlofa mberlofa force-pushed the fix/dolibarr-template-standards branch from 581f747 to 7e95859 Compare July 5, 2026 21:13
@mberlofa

mberlofa commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the remaining CodeRabbit review-summary nitpick for centralized validation coverage.

Changes:

  • Added validation tests for gateway.enabled without gateway.parentRefs.
  • Added validation tests for gateway.parentRefs entries missing name.
  • Added validation tests for externalSecrets.enabled with empty externalSecrets.data.
  • Added validation tests for externalSecrets.data missing the admin password mapping.

Validation:

  • make validate-chart CHART=dolibarr passed after rebasing on current origin/main
  • Result: dolibarr: FULLY VALIDATED (17 layers), including k3d GR-027 for ci/external-secrets.yaml and ci/gateway-api.yaml
  • make release-check REPO=charts passed with only the expected post-merge release confirmation warning
  • make attribution-check REPO=charts passed
  • git diff --check passed

Note: this CodeRabbit item was posted in the review summary/body, not as an active review thread, so there is no thread ID to reply to or resolve for it. The existing inline thread is already resolved.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
charts/dolibarr/tests/validation_test.yaml (2)

31-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider also testing the app.kubernetes.io/instance reserved label.

The helper (charts/dolibarr/templates/_helpers.tpl:298-303) validates both app.kubernetes.io/name and app.kubernetes.io/instance as reserved podLabels keys, but only the former is covered here.

♻️ Proposed additional test
   - it: should reject reserved selector label overrides
     set:
       podLabels:
         app.kubernetes.io/name: custom
     asserts:
       - failedTemplate:
           errorMessage: "podLabels must not override selector label app.kubernetes.io/name"
+
+  - it: should reject reserved instance label overrides
+    set:
+      podLabels:
+        app.kubernetes.io/instance: custom
+    asserts:
+      - failedTemplate:
+          errorMessage: "podLabels must not override selector label app.kubernetes.io/instance"
🤖 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 `@charts/dolibarr/tests/validation_test.yaml` around lines 31 - 38, The
validation coverage only checks the reserved podLabels override for
app.kubernetes.io/name, but the _helpers.tpl selector-label guard also protects
app.kubernetes.io/instance. Update the validation test in validation_test.yaml
to add a case that sets podLabels.app.kubernetes.io/instance and asserts the
same failedTemplate behavior, using the existing reserved-label validation
pattern so both reserved keys are covered.

5-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

No happy-path test for a fully valid configuration.

All tests in this suite assert failedTemplate (plus one notFailedTemplate for null podLabels). Adding a positive test with valid ingress, gateway, and externalSecrets values all populated together would guard against false-positive failures introduced by future edits to dolibarr.validate.

🤖 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 `@charts/dolibarr/tests/validation_test.yaml` around lines 5 - 83, Add a
happy-path validation test in validation_test.yaml for a fully valid
configuration, since the current suite only checks failures and one null
podLabels case. Create a new `it` block that uses valid `ingress`, `gateway`,
and `externalSecrets` values together, and assert `notFailedTemplate` to cover
the expected pass case. Use the existing test patterns around
`failedTemplate`/`notFailedTemplate` in this suite to place the new scenario
alongside the current `dolibarr.validate` coverage.
🤖 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 `@charts/dolibarr/tests/validation_test.yaml`:
- Around line 31-38: The validation coverage only checks the reserved podLabels
override for app.kubernetes.io/name, but the _helpers.tpl selector-label guard
also protects app.kubernetes.io/instance. Update the validation test in
validation_test.yaml to add a case that sets
podLabels.app.kubernetes.io/instance and asserts the same failedTemplate
behavior, using the existing reserved-label validation pattern so both reserved
keys are covered.
- Around line 5-83: Add a happy-path validation test in validation_test.yaml for
a fully valid configuration, since the current suite only checks failures and
one null podLabels case. Create a new `it` block that uses valid `ingress`,
`gateway`, and `externalSecrets` values together, and assert `notFailedTemplate`
to cover the expected pass case. Use the existing test patterns around
`failedTemplate`/`notFailedTemplate` in this suite to place the new scenario
alongside the current `dolibarr.validate` coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5441b5db-ce63-46f8-94a1-f306b991db85

📥 Commits

Reviewing files that changed from the base of the PR and between 581f747 and 7e95859.

📒 Files selected for processing (3)
  • charts/dolibarr/templates/_helpers.tpl
  • charts/dolibarr/templates/validate.yaml
  • charts/dolibarr/tests/validation_test.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/dolibarr/templates/_helpers.tpl

@mberlofa

mberlofa commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest CodeRabbit review-summary findings for Dolibarr.

Changes:

  • Added validation coverage for reserved podLabels.app.kubernetes.io/instance overrides.
  • Added a happy-path validation test that renders Ingress, Gateway API, and ExternalSecrets together.

Validation:

  • make validate-chart CHART=dolibarr passed end-to-end, including lint, template scenarios, unittest, kubeconform, Artifact Hub lint, and all k3d behavioral scenarios.
  • make standards-check CHART=dolibarr passed.
  • make release-check REPO=charts passed with the expected rendered-output release warning.
  • make attribution-check REPO=charts passed.
  • git diff --check passed.

The CodeRabbit feedback was posted in a review summary, not a resolvable review thread, so there is no thread to resolve.

@mberlofa mberlofa merged commit 5720cca into main Jul 6, 2026
17 checks passed
@mberlofa mberlofa deleted the fix/dolibarr-template-standards branch July 6, 2026 08:34
mberlofa added a commit to helmforgedev/site that referenced this pull request Jul 6, 2026
## Summary
- add `dolibarr` to the playground coverage allowlist required by the
chart site-sync gate

## Validation
- make site-sync-check CHART=dolibarr
- npm run lint
- npm run format:check
- npm run build
- make release-check REPO=site
- make attribution-check REPO=site

Chart PR: helmforgedev/charts#660
Issue: helmforgedev/charts#633

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

## Summary by CodeRabbit

* **New Features**
* Added support for the `dolibarr` chart in the playground, making it
available alongside other approved charts.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant