Skip to content

chore(ec2): update PrefixList.fromLookup() to expect the result from CcApi context provider has exactly one resource #34199

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

Merged
merged 12 commits into from
May 26, 2025

Conversation

Tietew
Copy link
Contributor

@Tietew Tietew commented Apr 18, 2025

Issue # (if applicable)

Follow-up to #33619.

Reason for this change

CcApi context provider now can expect the matched count of resources: aws/aws-cdk-cli#251.
PrefixList.fromLookup() is needed to be updated using this feature not to persist invalid results in cdk.context.json.
See also aws/aws-cdk-cli#257.

Description of changes

  • Bumped @aws-cdk/cloud-assembly-schema to latest ^43.6.0.
  • Specify expectedMatchCount: 'exactly-one' to expect exactly one prefix list id is returned.
  • Updated validation to check unexpected result. Actual error will be returned from the context provider.

Describe any new or updated permissions being added

N/A

Description of how you validated changes

Updated integ tests.

Checklist


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

@github-actions github-actions bot added p2 star-contributor [Pilot] contributed between 25-49 PRs to the CDK labels Apr 18, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team April 18, 2025 11:27
@Tietew

This comment was marked as resolved.

@aws-cdk-automation aws-cdk-automation added the pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run label Apr 18, 2025
@shikha372
Copy link
Contributor

shikha372 commented May 7, 2025

Clarification Request Test of @aws-cdk/cx-api failed. How should I do to fix it? Or could you please update cloud-assembly-schema version?

@aws-cdk/cx-api: FAIL test/cloud-assembly-builder.test.ts
@aws-cdk/cx-api:   ● cloud assembly builder
@aws-cdk/cx-api:     expect(received).toStrictEqual(expected) // deep equality
@aws-cdk/cx-api:     - Expected  - 0
@aws-cdk/cx-api:     + Received  + 1
@aws-cdk/cx-api:     @@ -35,10 +35,11 @@
@aws-cdk/cx-api:               "file": "foo.tree.json",
@aws-cdk/cx-api:             },
@aws-cdk/cx-api:             "type": "cdk:tree",
@aws-cdk/cx-api:           },
@aws-cdk/cx-api:         },
@aws-cdk/cx-api:     +   "minimumCliVersion": "2.1010.0",
@aws-cdk/cx-api:         "missing": Array [
@aws-cdk/cx-api:           Object {
@aws-cdk/cx-api:             "key": "foo",
@aws-cdk/cx-api:             "props": Object {
@aws-cdk/cx-api:               "account": "1234",
@aws-cdk/cx-api:       68 |   // THEN
@aws-cdk/cx-api:       69 |   // verify the manifest looks right
@aws-cdk/cx-api:     > 70 |   expect(manifest).toStrictEqual({
@aws-cdk/cx-api:          |                    ^
@aws-cdk/cx-api:       71 |     version: cxschema.Manifest.version(),
@aws-cdk/cx-api:       72 |     missing: [
@aws-cdk/cx-api:       73 |       {
@aws-cdk/cx-api:       at Object.<anonymous> (test/cloud-assembly-builder.test.ts:70:20)

Hey @Tietew , this issue is now fixed in main repo with PR #34369, please take a look at the current failing tests for eks and redshift to proceed further.

@shikha372 shikha372 removed the pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run label May 7, 2025
@Tietew
Copy link
Contributor Author

Tietew commented May 8, 2025

@shikha372 Thanks for fix!
#34385 seems to fix same failures.
I'll wait for merge.

@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 May 8, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

Copy link
Contributor

mergify bot commented May 26, 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 04061f2 into aws:main May 26, 2025
17 checks passed
@Tietew Tietew deleted the ec2-prefixlist-fromlookup branch May 26, 2025 08:22
@GavinZZ
Copy link
Contributor

GavinZZ commented May 26, 2025

@rix0rrr and @Tietew I have to revert this PR because the recent release of cloud-assembly-schema contains changes that JSII can't handle and it's failing our pipelines.

aws-cdk-lib.cloud_assembly_schema.CcApiContextQuery-example.ts:31:3 - error TS2322: Type '"expectedMatchCount"' is not assignable to type '"any" | "at-least-one" | "at-most-one" | "exactly-one" | undefined'.
31   expectedMatchCount: 'expectedMatchCount',
     ~~~~~~~~~~~~~~~~~~
  /codebuild/output/src3909207084/src/node_modules/@aws-cdk/cloud-assembly-schema/lib/cloud-assembly/context-queries.d.ts:387:14
    387     readonly expectedMatchCount?: 'any' | 'at-least-one' | 'at-most-one' | 'exactly-one';
                     ~~~~~~~~~~~~~~~~~~
    The expected type comes from property 'expectedMatchCount' which is declared here on type 'CcApiContextQuery'

mergify bot pushed a commit that referenced this pull request May 27, 2025
…om CcApi context provider has exactly one resource (#34557)

Reverts #34199
@Tietew Tietew deleted the ec2-prefixlist-fromlookup branch May 28, 2025 02:42
mergify bot pushed a commit that referenced this pull request May 30, 2025
…m CcApi context provider has exactly one resource (#34565)

Re-creation of #34199
A jsii related issue #34199 (comment) should be fixed before merging this PR.

### Issue # (if applicable)

Follow-up to #33619.

### Reason for this change

CcApi context provider now can expect the matched count of resources: aws/aws-cdk-cli#251.
`PrefixList.fromLookup()` is needed to be updated using this feature not to persist invalid results in `cdk.context.json`.
See also aws/aws-cdk-cli#257.

### Description of changes

- Bumped `@aws-cdk/cloud-assembly-schema` to latest ^44.1.0.
- Specify `expectedMatchCount: 'exactly-one'` to expect exactly one prefix list id is returned.
- Updated validation to check unexpected result. Actual error will be returned from the context provider.

### Describe any new or updated permissions being added

N/A

### Description of how you validated changes

Updated integ tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*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
p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. star-contributor [Pilot] contributed between 25-49 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants