Skip to content
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

fix(cli): 'cdk synth' not able to fail if stacks have errors #14475

Merged
merged 2 commits into from
May 4, 2021
Merged

fix(cli): 'cdk synth' not able to fail if stacks have errors #14475

merged 2 commits into from
May 4, 2021

Conversation

otaviomacedo
Copy link
Contributor

@otaviomacedo otaviomacedo commented Apr 30, 2021

The environment variable STACKS_TO_VALIDATE contains the stack hierarchical ids that should be validated after synthesis. By default (when the variable is undefined), it validates only the printed stacks, keeping backward compatibility.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Apr 30, 2021

@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Apr 30, 2021
@@ -394,14 +394,15 @@ export class CdkToolkit {

private async selectStacksForDiff(stackNames: string[], exclusively?: boolean) {
Copy link
Contributor

Choose a reason for hiding this comment

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

selectStacksForDiff ? Is that just a poorly chosen name?

It's a bit confusing in this context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same stacks are selected for diff and synthesis. This method is reused in both contexts.

@@ -394,14 +394,15 @@ export class CdkToolkit {

private async selectStacksForDiff(stackNames: string[], exclusively?: boolean) {
const assembly = await this.assembly();
const stacks = await assembly.selectStacks(stackNames, {

const idsToValidate = process.env.STACKS_TO_VALIDATE ? process.env.STACKS_TO_VALIDATE.split(';') : stackNames;
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we confirm that the method of using an environment variable is going to scale to large sizes? Or are we going to use wildcards?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried with values as long as 50K characters and it worked fine.

@otaviomacedo otaviomacedo changed the title fix(cli): Metadata errors should fail synthesis fix(cli): 'cdk synth' should fail if there was an error when synthesizing any stack Apr 30, 2021
@rix0rrr rix0rrr changed the title fix(cli): 'cdk synth' should fail if there was an error when synthesizing any stack fix(cli): 'cdk synth' should be able to fail on select stacks May 4, 2021
@rix0rrr rix0rrr changed the title fix(cli): 'cdk synth' should be able to fail on select stacks fix(cli): 'cdk synth' not able to fail if stacks have errors May 4, 2021
@mergify
Copy link
Contributor

mergify bot commented May 4, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: a9ec1c4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 963d1c7 into aws:master May 4, 2021
@mergify
Copy link
Contributor

mergify bot commented May 4, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

john-tipper pushed a commit to john-tipper/aws-cdk that referenced this pull request May 10, 2021
The environment variable `STACKS_TO_VALIDATE` contains the stack hierarchical ids that should be validated after synthesis. By default (when the variable is undefined), it validates only the printed stacks, keeping backward compatibility.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
The environment variable `STACKS_TO_VALIDATE` contains the stack hierarchical ids that should be validated after synthesis. By default (when the variable is undefined), it validates only the printed stacks, keeping backward compatibility.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants