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(cloudfront): propagate originAccessControlId CloudFront Origin property to CloudFormation templates #32020

Merged
merged 4 commits into from
Nov 28, 2024

Conversation

ivanbarlog
Copy link
Contributor

Issue

Closes #32018.

Reason for this change

The originAccessControlId property of CloudFront Origin has not been propagated to CloudFormation templates.

Description of changes

Propagate the property to render function.

Description of how you validated changes

have run the run build over the whole repo - my computer almost exploded.

I have also run tests for the aws-cloudfront which run successfully.

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 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. labels Nov 5, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team November 5, 2024 06:12
@github-actions github-actions bot added the p2 label Nov 5, 2024
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.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@ivanbarlog ivanbarlog changed the title propagate originAccessControlId CloudFront Origin property to CloudFormation templates fix(cloudfront origin): propagate originAccessControlId CloudFront Origin property to CloudFormation templates Nov 5, 2024
@ivanbarlog
Copy link
Contributor Author

Exemption Request

I've just fixed the place where the value which supposed to be rendered in the CloudFormation template was missing. It was set in the L2 construct but not propagated to the CloudFormation template.

I don't really see how can I write test for this.

Can you please guide me with this?

@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 Nov 5, 2024
@ivanbarlog ivanbarlog changed the title fix(cloudfront origin): propagate originAccessControlId CloudFront Origin property to CloudFormation templates fix(cloudfront): propagate originAccessControlId CloudFront Origin property to CloudFormation templates Nov 7, 2024
@github-actions github-actions bot added the effort/small Small work item – less than a day of effort label Nov 7, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review November 7, 2024 19:18

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

@ivanbarlog ivanbarlog force-pushed the issue-32018 branch 3 times, most recently from 7878d5a to 46c5e96 Compare November 13, 2024 16:29
Copy link
Contributor

@gracelu0 gracelu0 left a comment

Choose a reason for hiding this comment

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

Thanks for opening a PR! I left a comment on updating the tests. I don't think we need an integration test here so once unit tests are updated I can add the exemption label.

defaultBehavior: { origin: new origins.FunctionUrlOrigin(fnUrl) },
defaultBehavior: {
origin: new origins.FunctionUrlOrigin(fnUrl, {
originAccessControlId: oac.attrId,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can add a new unit test instead of updating this integration test. For the unit test I'd suggest:

  • adding a new function to test-origin.ts here which returns a test origin with originAccessControlId defined
  • adding a unit test to distribution.test.ts which sets up a distribution using the test origin from above and check that the Origin property in DistributionConfig contains OriginAccessControlId (can reference existing unit test here)

Let me know if you need more guidance on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @gracelu0, thanks for the feedback!

I have removed the integration tests (which your automated CI forced me to write) and I hope I've added the unit tests correctly. It has run for me so let's see what CI will tell us :-)

Thanks for help!

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.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@gracelu0 gracelu0 added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Nov 21, 2024
@gracelu0
Copy link
Contributor

@ivanbarlog I think the build failed due to some lint errors, try running yarn lint --fix from the root to fix the formatting issues and then I believe the build should pass

@aws-cdk-automation aws-cdk-automation dismissed their stale review November 21, 2024 22:45

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

@gracelu0 gracelu0 removed the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.19%. Comparing base (9f3d09b) to head (9b58405).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #32020   +/-   ##
=======================================
  Coverage   78.19%   78.19%           
=======================================
  Files         105      105           
  Lines        7176     7176           
  Branches     1318     1318           
=======================================
  Hits         5611     5611           
  Misses       1377     1377           
  Partials      188      188           
Flag Coverage Δ
suite.unit 78.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 78.19% <ø> (ø)

gracelu0
gracelu0 previously approved these changes Nov 27, 2024
Copy link
Contributor

@gracelu0 gracelu0 left a comment

Choose a reason for hiding this comment

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

Thank you for contributing!

@gracelu0
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Nov 27, 2024

update

❌ Mergify doesn't have permission to update

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/codecov.yml without workflows permission

Copy link
Contributor

mergify bot commented Nov 27, 2024

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 dismissed gracelu0’s stale review November 27, 2024 23:49

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 9b58405
  • 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 Nov 28, 2024

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 f9708a6 into aws:main Nov 28, 2024
19 checks passed
Copy link

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 Nov 28, 2024
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 bug This issue is a bug. effort/small Small work item – less than a day of effort 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-cloudfront: setting originAccessControlId in aws-cloudfront-origins does nothing
3 participants