-
Notifications
You must be signed in to change notification settings - Fork 4k
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
cdk diff: always fails on diff #19110
Comments
@ryparker This is the source of the bug in v1. aws-cdk/packages/aws-cdk/bin/cdk.ts Line 333 in 789f2dc
Since I strongly question why that feature flag was even introduced, instead of just letting people opt-out via In any case, please fix v1 to handle the boolean correctly. It needs to distinguish |
@rittneje The same line of code exists for v1 and v2. When you have the feature flag enabled in v1 it produces the behavior @ryparker displayed above. If the app you're experiencing this issue in was created before the feature flag existed, you'll need to add it to the |
@TheRealAmazonKendra If I explicitly pass |
The feature flag was used because it caused a breaking change when it was implemented. You are correct that it is enabled by default in v2. The fix here, however, is to enable the feature flag in your project and then it will work by passing those very cli arguments. I understand the frustration of "it should have been this way in the first place," but because it wasn't, and the fix would cause a breaking change for customers, the feature flag was added. |
@TheRealAmazonKendra You misunderstand. Originally What the feature flag should have done is changed the default behavior of
|
…il` feature flag (#21107) The CLI doesn't distinguish between `cdk diff --no-fail` and just `cdk diff`. In both cases, it's taking the value of `enableDiffNoFail` feature flag to decide which status code to return. Change the behavior to: | Is there a difference? | `--fail` (CLI option) | `enableDiffNoFail` (FF) | Return code | |------------------------|------------------------|-------------------------|-------------| | No | Don't care | Don't care | 0 | | Yes | false | Don't care | 0 | | Yes | true | Don't care | 1 | | Yes | null | false | 1 | | Yes | null | true | 0 | Fixes #19110. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
What is the problem?
The docs for cdk diff with respect to
--fail
are wrong.cdk diff
exits with status code 1 if there is a diff.--fail=false
nor--no-fail
have any effect.In a deployment pipeline, we do not want the build to fail when there is a diff. But we also don't want to ignore the exit code from
cdk diff
entirely, since if it fails for some other reason that should be fatal.Reproduction Steps
Run
cdk diff
.What did you expect to happen?
I expected
cdk diff
to abide by the documented behavior.What actually happened?
It failed in violation of the documented behavior.
CDK CLI Version
1.140.0
Framework Version
No response
Node.js Version
16.13.2
OS
Alpine 3.15
Language
Python
Language Version
3.9.10
Other information
No response
The text was updated successfully, but these errors were encountered: