-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[cli] cdk diff difficult to use programmatically #10417
Comments
I agree distinguishing the error codes could be useful. |
I am happy to pick this issue with some guidance. |
is there any update on this issue? it seems very useful feature. |
For the part of using stdout for the output, please not that it is possible today by using You can see the description of this option using
|
…26297) Reported issue with `diff` is that it treats the fail return status for cases when there are actual diffs, making it hard to know what happened with pipeline automations. The proposed solution adds a logging statement with a similar format that is used for deploy (but here the total time is reported) specifying how many stacks have differences, as presented below. As a result, it will be possible to check in pipelines for this logging statement to correctly detect situation when there are no actual changes, when there are changes, and when there are failures, since on failures this statement will not be present: Case of no changes: ✨ Number of stacks with differences: 0 Case of changes in 5 stacks: ✨ Number of stacks with differences: 5 Closes #10417. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…ws#26297) Reported issue with `diff` is that it treats the fail return status for cases when there are actual diffs, making it hard to know what happened with pipeline automations. The proposed solution adds a logging statement with a similar format that is used for deploy (but here the total time is reported) specifying how many stacks have differences, as presented below. As a result, it will be possible to check in pipelines for this logging statement to correctly detect situation when there are no actual changes, when there are changes, and when there are failures, since on failures this statement will not be present: Case of no changes: ✨ Number of stacks with differences: 0 Case of changes in 5 stacks: ✨ Number of stacks with differences: 5 Closes aws#10417. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
We're integrating CDK into a build pipeline and finding it difficult to differentiate between these possibilities:
When running
cdk diff --fail
, we can check the return code to differentiate case 1 vs. 2/3, however we can't differentiate between diff detecting changes and failing for some other type of error (they both return exitCode 1).Additionally, it appears that we can't rely on whether output was printed to stdout or stderr - from a quick read through the code it appears diffs are printed to stderr along with errors as well.
Is there a supported mechanism to call the
cdk diff
command and differentiate the options above?Use Case
We're integrating CDK into a build pipeline and would like to first determine if there are any differences before requiring an approval step for deployment.
Proposed Solution
A few options might be possible:
cdk diff --fail
to differentiate "there are differences" from "there was an error calculating differences".Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: