Skip to content

RHTAP-6520: Render Values before Deployment#56

Merged
Roming22 merged 1 commit into
redhat-appstudio:mainfrom
otaviof:RHTAP-6520
May 4, 2026
Merged

RHTAP-6520: Render Values before Deployment#56
Roming22 merged 1 commit into
redhat-appstudio:mainfrom
otaviof:RHTAP-6520

Conversation

@otaviof

@otaviof otaviof commented May 4, 2026

Copy link
Copy Markdown
Collaborator

The GitOps path (helmet-ex gitops) needs to write a single values/values.yaml into the generated repository, shared by all ArgoCD Application manifests. For this to be semantically equivalent to the imperative path, the imperative deployer must also produce values from a single render — not per-chart inside the loop.

Summary by CodeRabbit

  • Refactor

    • Improved value rendering workflow in the deploy command to pre-process Helm values before installation.
    • When using --verbose flag with deploy, additional rendered values information is now displayed.
  • Tests

    • Added comprehensive unit tests for value handling and rendering functionality.

@otaviof otaviof added the enhancement New feature or request label May 4, 2026
@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8b9b8ae8-87c4-45a2-8ab4-031e82d5b8ab

📥 Commits

Reviewing files that changed from the base of the PR and between 4eb1db2 and 79034d0.

📒 Files selected for processing (3)
  • internal/installer/installer.go
  • internal/installer/installer_test.go
  • internal/subcmd/deploy.go
📝 Walkthrough

Walkthrough

The PR refactors the Helm values workflow by introducing Installer.SetRenderedValues() to accept pre-rendered template bytes and parsed values directly, moving template rendering responsibility from the installer to the deploy command, which now renders values upfront before dependency installation.

Changes

Values Rendering Workflow Refactoring

Layer / File(s) Summary
Core API
internal/installer/installer.go
Installer.SetRenderedValues(renderedBytes []byte, values chartutil.Values) method added to accept pre-rendered YAML bytes and parsed Helm values, bypassing internal template rendering.
Deploy Integration
internal/subcmd/deploy.go
Deploy command now renders valuesTmpl upfront via engine.NewEngine(), parses rendered output with chartutil.ReadValues(), optionally prints verbose output, and passes both artifacts to installer via SetRenderedValues() instead of deferring rendering to the installer.
Unit Tests
internal/installer/installer_test.go
Test helper newTestInstaller() and three test cases verify SetRenderedValues() stores rendered bytes and parsed values, PrintRawValues() outputs correct YAML, and RenderValues() requires prior value initialization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Once the renderer toiled inside,
Now it renders and steps aside,
Pre-cooked values, fresh and clean,
Flow refactored, workflows lean!
Installer waits, takes what's given,
One good change—all nicely driven! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'RHTAP-6520: Render Values before Deployment' accurately describes the main change: values rendering is now performed once before the deployment loop rather than separately for each chart, ensuring semantic equivalence with the GitOps path.
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
Review rate limit: 0/1 reviews remaining, refill in 34 minutes and 9 seconds.

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

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/subcmd/deploy.go (1)

124-149: ⚡ Quick win

Extract the values render/parse flow into one shared helper.

This block now duplicates the existing SetValues/RenderValues path in internal/installer/installer.go, while internal/subcmd/template.go still uses the older implementation. That makes the deploy and template commands easy to drift apart the next time template variables or parsing rules change. Please move this into one shared helper and have both call sites use it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/subcmd/deploy.go` around lines 124 - 149, The render/parse sequence
(creating engine via NewEngine(...).Render, setting variables via
variables.SetInstaller and variables.SetOpenShift, optionally printing when
d.flags.Verbose, then parsing with chartutil.ReadValues) is duplicated; extract
it into a single shared helper (e.g., RenderAndParseValues or
RenderValuesHelper) and replace both usages so SetValues/RenderValues in
installer.go and the call site in template.go and the block in deploy.go both
call that helper; ensure the helper accepts the same inputs used above
(context/Kube/runCtx, values template bytes, installer config/flags) and returns
rendered bytes or parsed values and errors so callers (deploy.go, template.go,
installer.go SetValues/RenderValues) can use it without duplicating logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/installer/installer_test.go`:
- Around line 51-64: The test mutates global os.Stdout and leaves the pipe ends
open; wrap the stdout swap and pipe close in guaranteed cleanup so state is
restored even on test failures: capture old := os.Stdout and the pipe r,w as
before, then register a t.Cleanup (or defer) that restores os.Stdout = old and
closes both w and r; ensure the call to i.PrintRawValues() happens after
replacing os.Stdout and before closing the writer, and remove any paths that
risk leaving r or w open (reference symbols: os.Stdout, os.Pipe(), old, r, w,
and i.PrintRawValues()).

---

Nitpick comments:
In `@internal/subcmd/deploy.go`:
- Around line 124-149: The render/parse sequence (creating engine via
NewEngine(...).Render, setting variables via variables.SetInstaller and
variables.SetOpenShift, optionally printing when d.flags.Verbose, then parsing
with chartutil.ReadValues) is duplicated; extract it into a single shared helper
(e.g., RenderAndParseValues or RenderValuesHelper) and replace both usages so
SetValues/RenderValues in installer.go and the call site in template.go and the
block in deploy.go both call that helper; ensure the helper accepts the same
inputs used above (context/Kube/runCtx, values template bytes, installer
config/flags) and returns rendered bytes or parsed values and errors so callers
(deploy.go, template.go, installer.go SetValues/RenderValues) can use it without
duplicating logic.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8e1c7ef8-d87b-4e16-bba3-c3d2422fd916

📥 Commits

Reviewing files that changed from the base of the PR and between 049fbd4 and 4eb1db2.

📒 Files selected for processing (3)
  • internal/installer/installer.go
  • internal/installer/installer_test.go
  • internal/subcmd/deploy.go

Comment thread internal/installer/installer_test.go

@dperaza4dustbit dperaza4dustbit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@Roming22 Roming22 merged commit 105ac3e into redhat-appstudio:main May 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants