Skip to content

feat: explain required install with no planned resource changes#645

Open
Sharvash wants to merge 4 commits into
werf:mainfrom
Sharvash:feat/release-plan-outdated-reason
Open

feat: explain required install with no planned resource changes#645
Sharvash wants to merge 4 commits into
werf:mainfrom
Sharvash:feat/release-plan-outdated-reason

Conversation

@Sharvash

@Sharvash Sharvash commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

nelm's release plan install command now explains why a release must still be installed even when no Kubernetes resource changes are planned.

Previously, when the plan found no resource changes but the release still had to be installed, it printed only a generic yellow warning:

No resource changes planned, but still must install release "app" (namespace: "ns")

There was no way to tell what triggered the install — a failed previous release, changed values, updated manifests, or something else.

IsReleaseUpToDate is the single place that decides whether a release is up to date. It now returns a typed ReleaseOutdatedReason next to its boolean result instead of just (bool, error), and the check is split into separate guard clauses that each return their specific reason:

  • there is no previously deployed release
  • the previously deployed release was not successful
  • the release notes changed
  • the release values changed
  • the release hooks changed
  • the release manifests changed

release plan install appends the reason to the existing warning through a small releaseMustInstallMessage helper, so it now reads:

No resource changes planned, but still must install release "app" (namespace: "ns") because the release values changed

The helper leaves the message untouched when the reason is empty, so there is never a dangling " because". The release install and release rollback commands ignore the reason and keep their current "already as desired" messages unchanged.

Table-driven unit tests cover every branch of IsReleaseUpToDate and the message-builder guard. Build, lint and unit tests are green.

Closes #512

The `release plan install` command now explains why a release must still
be installed even when no Kubernetes resource changes are planned.

Previously, the plan command only printed a yellow warning saying it must
still install the release, without explaining why. Users had no way to
know whether the cause was a failed previous release, changed values,
updated manifests, or something else.

The `IsReleaseUpToDate` function now returns a typed `ReleaseOutdatedReason`
alongside the existing boolean result. The reasons surfaced are:

- there is no previously deployed release
- the previously deployed release was not successful
- the release notes changed
- the release values changed
- the release hooks changed
- the release manifests changed

The single function that already decides whether a release is up to date
now also returns the reason, so there is no duplicated logic. Only the
`release plan install` command surfaces the reason; the "skipped, already
as desired" messages of the install and rollback commands are unchanged.

Table-driven unit tests cover every branch of `IsReleaseUpToDate` and the
message-builder guard (no dangling " because" when the reason is empty).
Build, lint, and test pipeline is green.

Closes werf#512
Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
@Sharvash Sharvash force-pushed the feat/release-plan-outdated-reason branch from 4566520 to f0c844c Compare June 22, 2026 14:06
Comment thread pkg/release/release.go Outdated
// Check if the new Release is up-to-date compared to the old Release. It doesn't check any
// resources of the release in the cluster, just compares Release objects.
func IsReleaseUpToDate(oldRel, newRel *helmrelease.Release) (bool, error) {
func IsReleaseUpToDate(oldRel, newRel *helmrelease.Release) (bool, ReleaseOutdatedReason, error) {

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.

I like the idea generally, but I wonder if we can make it cleaner. Later I'd like to be able to also show (at least in some cases) diffs on what changed, e.g. which values changed exactly or in what way manifests changed.

Maybe we shouldn't return isUpToDate + reason, but should return IsReleaseUpToDateResult instead? It can encapsulate both, can also contain additional info for displaying stuff later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, IsReleaseUpToDate now returns an IsReleaseUpToDateResult that carries UpToDate and Reason, instead of the separate bool and reason. That gives us a place to add the diff details later (which values changed, how the manifests differ) without touching the signature again.

IsReleaseUpToDate now returns (IsReleaseUpToDateResult, error) instead of
(bool, ReleaseOutdatedReason, error). The struct carries the UpToDate flag
and the Reason a release is outdated, replacing the positional (bool,
reason) pair that every caller had to destructure by hand.

All callers in pkg/action are updated accordingly. Behavior is unchanged:
the same checks yield the same verdict and reason as before.

Signed-off-by: Alexey Gorovenko <sharvashinho@gmail.com>
@Sharvash Sharvash force-pushed the feat/release-plan-outdated-reason branch from 32b4716 to feba3bd Compare June 26, 2026 12:03
@Sharvash Sharvash requested a review from ilya-lesikov June 26, 2026 12:08
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.

plan doesn't show exact reason for new release, if no resource changes

2 participants