Conversation
Implements resource counting integrated into the existing synth job: - count-resources CLI tool parses cloud assembly and counts resources per stack - ResourceCountStep wraps the CLI as a pipeline step - GitHub: adds pull_request trigger to deploy workflow, posts PR comment with resource counts and deltas vs target branch, skips deploy jobs on PRs - GitLab: adds resource counting to synth job with conditional MR comment - Configurable: enableResourceCounting (default true), resourceCountWarningThreshold (default 450), resourceCountLimit (default 500) Closes #158
- Fix continueOnError rendering in baseline checkout step (was using kebab-case key that projen's renderer ignores, now uses camelCase) - Append || true to count-resources CLI invocation so the step does not block PR comment posting when resources exceed the limit - Replace GITLAB_TOKEN with CI_JOB_TOKEN fallback (MR_TOKEN uses GITLAB_TOKEN if set, otherwise CI_JOB_TOKEN) and document requirement - Add TODO comment noting GitLab delta tracking could be added later - Add comprehensive unit tests for ResourceCounter class (17 tests covering boundary conditions, missing manifests, mixed stacks, etc.)
hoegertn
commented
Aug 9, 2026
hoegertn
commented
Aug 9, 2026
hoegertn
commented
Aug 9, 2026
| }, | ||
| ...githubSteps.flatMap(s => s.steps), | ||
| { | ||
| name: 'Download baseline resource counts', |
Contributor
Author
There was a problem hiding this comment.
@kiro-agent Where does this file come from in the repo. Where is it committed? It should not be stored
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reimplements #158 with improvements based on the feedback from the previous attempt in PR #172.
This PR adds a CloudFormation resource counting feature that monitors resource usage across stacks during CDK synthesis and warns when approaching the 500 resource limit.
Changes
New Files
src/awscdk/count-resources.ts— Standalone CLI tool that parses the cloud assembly'smanifest.json, counts resources per stack, and outputs results to console, JSON file, and optionally GitHub step summarysrc/awscdk/resource-count-step.ts—ResourceCountSteppipeline step wrapping the CLI calltest/count-resources.test.ts— Unit tests for the resource counter logictest/resource-count-github.test.ts— Integration tests for GitHub pipelinetest/resource-count-gitlab.test.ts— Integration tests for GitLab pipelineModified Files
src/awscdk/base.ts— Adds configuration options andprovideResourceCountStep()to base classsrc/awscdk/github.ts— Integrates resource counting into existing synth job with PR comment supportsrc/awscdk/gitlab.ts— Integrates resource counting into existing synth job with MR comment supportsrc/awscdk/index.ts— Exports new module.projenrc.ts— Addscount-resourcesbin entryConfiguration
Improvements over PR #172
resourceCountLimitoption (default 500) for accounts with increased quotas|| trueso the step does not fail the pipeline; results are always reportedTest Results
Closes #158