Skip to content

feat(deployer): configurable Helm release history (HELM_HISTORY_MAX) (#676) - #712

Merged
omattsson merged 1 commit into
mainfrom
feat/676-helm-history-max
Oct 25, 2026
Merged

omattsson merged 1 commit into
mainfrom
feat/676-helm-history-max

Conversation

@omattsson

Copy link
Copy Markdown
Owner

Fixes #676.

What it does

  • New setting HELM_HISTORY_MAX (config.ParseHelmHistoryMax). It is passed as --history-max <n> to every helm upgrade --install and helm rollback.
  • The cluster registry builds every HelmClient and sets the limit with HelmClient.WithHistoryMax. The streaming executor embeds the client, so deploy, redeploy, quick deploy, rollback to a target and plain rollback all get it.
  • Unset: no flag. The Helm commands are unchanged, and Helm's own default applies: its HELM_MAX_HISTORY environment variable, else 10.
  • Bad values: 0, 1, a negative number or text stops the start with an error that names the setting.
    • A plain rollback needs the previous revision, so the minimum is 2.
    • A rollback to a target log reinstalls with the stored values and chart version, so it does not need old revisions.
  • Helm chart: backend.helmHistoryMax (default null) renders HELM_HISTORY_MAX only when it is set.
    • Whole floats from a values file or --set-json are converted to integers first.
    • A value below 2 fails the render.
    • An explicit backend.env.HELM_HISTORY_MAX wins.
  • Docs: README.md, backend/README.md, the WIKI.md rollback section, values.yaml, docs/claude/helm-chart.md, docs/claude/domain.md, backend/CLAUDE.md and .github/copilot-instructions.md.

Behaviour change: with a small limit, Helm keeps the last deployed revision when it prunes. After several failed deploys in a row, a plain rollback goes to the last good revision instead of an older failed one.

Tested on a local cluster (Docker Desktop Kubernetes, the backend image with Helm 3.22.1, a one-chart podinfo stack)

Acceptance criterion Result
HELM_HISTORY_MAX=3, 5 deploys Revisions 3, 4 and 5 kept; 1 and 2 pruned
Rollback to target deploy 1 after revision 1 was pruned Success (new revision 6)
Plain rollback with HELM_HISTORY_MAX=2 Success ("Rollback to 6"), and again ("Rollback to 7"); history stays at 2
HELM_HISTORY_MAX=1 at start Start fails: invalid configuration: HELM_HISTORY_MAX must be a whole number of 2 or more, got "1"

Other checks

  • Unit tests: config parsing and LoadConfig errors, the install and rollback arguments with and without a limit (including the streaming executor), and the registry wiring.
  • go test ./... -short -race
  • make lint (0 errors)
  • make gosec (0 issues)
  • make helm-test: new checks for the default, a set value, the env override, numbers from --set-json, and failures that must show the backend.helmHistoryMax message
  • make helm-lint

🤖 Generated with Claude Code

…676)

- New setting HELM_HISTORY_MAX (config.ParseHelmHistoryMax): passed as
  --history-max to every helm upgrade --install and helm rollback through
  HelmClient.WithHistoryMax, set by the cluster registry for each cluster.
- Unset: no flag, so the Helm default (10) applies and the commands are
  unchanged. 0, 1, a negative number or text stops the start with an error
  that names the setting: the plain rollback needs the previous revision. A
  rollback to a target log uses the stored values and chart version, so it
  needs no older revision.
- Helm chart: backend.helmHistoryMax (default null), rendered as
  HELM_HISTORY_MAX only when set; a value below 2 fails the render, and an
  explicit backend.env value wins. make helm-test covers it.
- Docs: README and backend README tables, WIKI rollback, chart and domain
  references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omattsson omattsson added the enhancement New feature or request label Oct 25, 2026
@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f4fe05c9-0d7f-4f2a-946e-5013718b8c52
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@omattsson
omattsson merged commit 0939992 into main Oct 25, 2026
8 checks passed
@omattsson
omattsson deleted the feat/676-helm-history-max branch October 25, 2026 19:36
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.

Configurable Helm release history (--history-max)

1 participant