Skip to content

Conversation

@scoobydrew
Copy link
Contributor

@scoobydrew scoobydrew commented Jul 8, 2025

Reason for this change

It would be helpful to have more options around how the validation report is output. Currently the pretty print and JSON formatted file options are mutually exclusive. This pull request allows both to be used.

The primary driver is to allow users to see their report results in a human-readable format while also having an output artifact that can be consumed by other CI/CD tools.

Description of changes

It is now possible to print multiple validation report formats. I added a new context key @aws-cdk/core:validationReportPrettyPrint boolean that prints the validation report to the console when true. I have made this value true by default so that users today maintain the same behavior they expect. Setting the existing @aws-cdk/core:validationReportJson key still results in only JSON formatted output. Users may now select both options by enabling both keys.

Rather than a pretty print context key, I considered implementing a @aws-cdk/core:validationReportBoth key but this seemed to assume there would not be another format option added. It would allow the JSON format key to also keep its current behavior but the tradeoff of both report types appearing for those who only provide the JSON key seemed like a reasonable trade for keeping the report formats open for additional options in the future.

Describe any new or updated permissions being added

N/A

Description of how you validated changes

I have added unit tests that validate my changes.

Checklist

EDIT

Following review suggestions the logic has been updated such that:

  • Default: pretty print only
  • Enable JSON format context key: JSON only
  • Enable pretty print context key: pretty print only
  • Enable both keys: both formats

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

@scoobydrew scoobydrew requested a review from a team as a code owner July 8, 2025 17:59
@github-actions github-actions bot added the p2 label Jul 8, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team July 8, 2025 17:59
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Jul 8, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@scoobydrew
Copy link
Contributor Author

Exemption request for integration test / snapshot requirement

This change adds functionality inside the core package’s synthesis class. There does not seem to be an integration test file that specifically targets this.

A new test just to hit invokeValidationPlugins would be redundant with unit tests without adding meaningful coverage.

Given that the validation report output does not affect synthesized templates directly, I believe an integration test is unnecessary in this case.

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Jul 8, 2025
Copy link
Contributor

@iliapolo iliapolo left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for this.

@iliapolo iliapolo changed the title feat(aws-cdk-lib): allow validation report multi-write based on context keys feat(core): allow validation report multi-write based on context keys Jul 17, 2025
@iliapolo iliapolo added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Jul 17, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 17, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review July 17, 2025 05:30

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify mergify bot dismissed iliapolo’s stale review July 17, 2025 13:54

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 17, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: d7dfd7a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Jul 23, 2025

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

@mergify mergify bot merged commit 9571599 into aws:main Jul 23, 2025
20 checks passed
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants