core: cdk diff --fail
should return a unique exit code when there is a difference
#27246
Labels
@aws-cdk/core
Related to core CDK functionality
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
p2
Describe the bug
Detecting a difference is very different class of error from running an invalid command or not being authorised to even run a diff at all. This should be clearly indicated in the exit code, to make CDK automation easier. With the current functionality, you must check standard error to see if there's a difference, which is much harder than checking the exit code, and even harder than just checking standard output.
Basically, with the current functionality you need to do something like this in Bash to keep the original output while detecting an actual diff:
Expected Behavior
cdk diff --fail
should return a specific exit code among one of the 254 exit codes other than 0 and 1 when a difference is detected.Current Behavior
cdk diff --fail
returns exit code 1 in case of a difference. This is the same exit code as a host of completely different classes of errors.Reproduction Steps
Run
cdk diff --fail
against a stack with a difference.Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.93.0 (build 724bd01)
Framework Version
No response
Node.js Version
v18.17.1
OS
NixOS
Language
Typescript
Language Version
5.2.2
Other information
No response
The text was updated successfully, but these errors were encountered: