New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The --expect-no-changes
flag checks for output diffs
#15903
The --expect-no-changes
flag checks for output diffs
#15903
Conversation
Changelog[uncommitted] (2024-05-01)Bug Fixes
|
@@ -162,7 +163,9 @@ func displayUpdatesJSON(updates []backend.UpdateInfo, decrypter config.Decrypter | |||
info.EndTime = makeStringRef(time.Unix(update.EndTime, 0).UTC().Format(timeFormat)) | |||
resourceChanges := make(map[string]int) | |||
for k, v := range update.ResourceChanges { | |||
resourceChanges[string(k)] = v | |||
if k != deploy.OpOutputChange { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we filter out OpOutputChange here? That's not obvious from context, deserves an explanation comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment
newOutputs := step.New().Outputs | ||
diff := oldOutputs.Diff(newOutputs) | ||
if diff.AnyChanges() { | ||
acts.Ops[deploy.OpOutputChange] += len(diff.Adds) + len(diff.Deletes) + len(diff.Updates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels odd that this counts per-field changes rather than a count of how many resources made any change. Is there a reason to prefer this rather than just +1 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the scenarios where this number is shown to the user, this then means that the number shown matches the listed output diffs
@@ -823,7 +823,7 @@ func TestStackReferenceSecretsNodejs(t *testing.T) { | |||
{ | |||
Dir: filepath.Join(d, "nodejs", "step2"), | |||
Additive: true, | |||
ExpectNoChanges: true, | |||
ExpectNoChanges: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just remove the field, it defaults to false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
6ca6016
to
1f7ee5e
Compare
changes: | ||
- type: fix | ||
scope: cli/engine | ||
description: "Fixes #15564, --expect-no-changes now causes pulumi cli to fail if the only changes are output changes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: "Fixes #15564, --expect-no-changes now causes pulumi cli to fail if the only changes are output changes" | |
description: "Make --expect-no-changes fail if the only changes are output changes" |
8927a32
to
5a4a942
Compare
5a4a942
to
6c2125f
Compare
This is now safe with pulumi-service |
6c2125f
to
8a13150
Compare
This reverts commit b72399b.
Description
This adds a pseudo op
OpOutputChange
to the set of changes that are recorded indisplay.ResourceChanges
to count the number of output changes, this is then included in the check used to evaluate the--expect-no-changes
flagWhen resource outputs are registered, they are checked against their previous value using existing functionality, the total count of changes is then added
The internal capability is validated with an engine test, the cli is validated using an integration test
This will break user workflows that depend on the previous behavior
Fixes #15564
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change