aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.55k stars 3.87k forks source link

fix(eks): update private ecr repo url regex #31394

Closed natekruse-aws closed 2 weeks ago

natekruse-aws commented 2 weeks ago

Issue # (if applicable)

Reason for this change

The regex for private ECR repos currently excludes some supported URLs in AWS regions. Updating the regex to be more inclusive of all AWS regions.

Description of changes

Modified private ECR repo URL to be domain agnostic.

Description of how you validated changes

All existing tests pass:

Manually updated lambda function highside to verify change works in isolated regions as well.

Checklist


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

natekruse-aws commented 2 weeks ago

Exemption Request

Integ test changes not required due to how small the change is. Existing tests still work.

shikha372 commented 2 weeks ago

No change flagged in integration test due to modification in private repo URL only, but there are manual integration steps defined to check for private repo here. Also, asked user to add unit tests to verify that this is working for all expected domains.

shikha372 commented 2 weeks ago

verified that there is no change in integration snapshot with yarn integ under aws-cdk/packages/@aws-cdk-testing/framework-integ/test.

Manually verified the changes for private repo with deployment in us-east-1

// there is no opinionated way of testing charts from private ECR, so there is description of manual steps needed to reproduce:
    // 1. `export AWS_PROFILE=youraccountprofile; aws ecr create-repository --repository-name helm-charts-test/s3-chart --region YOUR_REGION`
    // 2. `helm pull oci://public.ecr.aws/aws-controllers-k8s/s3-chart --version v0.1.0`
    // 3. Login to ECR (howto: https://docs.aws.amazon.com/AmazonECR/latest/userguide/push-oci-artifact.html )
    // 4. `helm push s3-chart-v0.1.0.tgz oci://YOUR_ACCOUNT_ID.dkr.ecr.YOUR_REGION.amazonaws.com/helm-charts-test/`
    // 5. Change `repository` in above test to oci://YOUR_ACCOUNT_ID.dkr.ecr.YOUR_REGION.amazonaws.com/helm-charts-test
    // 6. Run integration tests as usual

Results:

Verifying integration test snapshots...

  CHANGED    aws-eks/test/integ.eks-helm-asset 1.447s
      Resources
[~] Custom::AWSCDK-EKS-HelmChart Clustercharttestocichart9C188967 
 └─ [~] Repository
     ├─ [-] oci://public.ecr.aws/aws-controllers-k8s/s3-chart
     └─ [+] oci://<account>.dkr.ecr.us-east-1.amazonaws.com/helm-charts-test/s3-chart

Running in parallel across regions: us-east-1, us-east-2, us-west-2
Running test /Users/shikagg/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js in us-east-1
  SUCCESS    aws-eks/test/integ.eks-helm-asset-aws-cdk-eks-helm/DefaultTest 1390.33s
       NO ASSERTIONS
shikha372 commented 2 weeks ago

@mergifyio update

mergify[bot] commented 2 weeks ago

update

✅ Branch has been successfully updated

mergify[bot] commented 2 weeks ago

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).

aws-cdk-automation commented 2 weeks ago

AWS CodeBuild CI Report

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

mergify[bot] commented 2 weeks ago

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).

github-actions[bot] commented 2 weeks ago

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.