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

feat(custom-resource): add serviceTimeout property for custom resources #30911

Merged
merged 19 commits into from
Jan 4, 2025

Conversation

mazyu36
Copy link
Contributor

@mazyu36 mazyu36 commented Jul 20, 2024

Issue # (if applicable)

Closes #30517.

Reason for this change

L2 construct does not support setting serviceTimeout.

Enabling customizable timeouts is useful when using custom resources, as the current default timeout is set to 3600 seconds.

Ref: AWS CloudFormation accelerates dev-test cycle with adjustable timeouts for custom resources

Description of changes

Add serviceTimeout property for CustomResource and AwsCustomResource.

Description of how you validated changes

Add unit tests and integ tests.
Additionally, I confirmed that ServiceTimeout is set by checking the CloudWatch Logs of the Lambda function that generates custom resources.
スクリーンショット 2024-07-21 2 09 15

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team July 20, 2024 17:12
@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1 star-contributor [Pilot] contributed between 25-49 PRs to the CDK labels Jul 20, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 20, 2024
@xazhao xazhao self-assigned this Jul 30, 2024
Copy link
Contributor

@xazhao xazhao left a comment

Choose a reason for hiding this comment

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

Left a few minor comments. The code look good to me overall.

@@ -55,6 +56,13 @@ export interface CustomResourceProps {
*/
readonly serviceToken: string;

/**
* The maximum time, in seconds, that can elapse before a custom resource operation times out
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to mention the unit is seconds here? Since the type is Duration, customers should be able to use different units in Duration.
Also might be good to mention the range is 1 to 3600 seconds here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xazhao
Thanks.
I've updated docs.

/*
* Stack verification steps:
* - Deploy with `--no-clean`
* - Verify that `ServiceTimeout` is set to 60 in the CloudWatch Logs for the Lambda function that creates custom resources.
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious how did you verify the ServiceTimeout is set to 60?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nvm I see you explained it in the PR description.

@mazyu36 mazyu36 force-pushed the custom-resource-service-timeout-30517 branch from df369dc to d29130b Compare July 30, 2024 23:16
@mazyu36 mazyu36 requested a review from xazhao July 31, 2024 00:01
@TheRealAmazonKendra
Copy link
Contributor

I don't think we can accept this PR at this time, not because of anything wrong with your code but because of problems with AwsCustomResource. I'm going to put the do-not-close and do-not-merge label on this one while we work to assess whether this is actually safe to accept and/or resolve the other issues at play here.

@TheRealAmazonKendra TheRealAmazonKendra added pr/do-not-merge This PR should not be merged at this time. pr-linter/do-not-close The PR linter will not close this PR while this label is present labels Jul 31, 2024
@polothy
Copy link
Contributor

polothy commented Oct 31, 2024

Ran into wanting this feature (currently waiting for things to timeout hah), what's the concern with AwsCustomResource? The default is still an hour as it always was?

@mirodrr2
Copy link

mirodrr2 commented Nov 19, 2024

Please prioritize merging this, it's a huge pain point when using Custom Resources in cdk

If the custom resource has an unhandled exception, you have no choice but to wait around for an hour

@GavinZZ
Copy link
Contributor

GavinZZ commented Nov 20, 2024

Hello, thanks for pinging us on this issue. I apologize for the delay on the update on this issue. I will sync with Kendra internally and share some update on this PR.

@mazyu36 mazyu36 requested a review from a team as a code owner November 23, 2024 00:18
Copy link

codecov bot commented Nov 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.96%. Comparing base (a10c369) to head (72a269f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #30911   +/-   ##
=======================================
  Coverage   66.96%   66.96%           
=======================================
  Files         329      329           
  Lines       18663    18667    +4     
  Branches     3258     3260    +2     
=======================================
+ Hits        12497    12501    +4     
  Misses       5839     5839           
  Partials      327      327           
Flag Coverage Δ
suite.unit 66.96% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
packages/aws-cdk 80.71% <ø> (ø)
packages/aws-cdk-lib/core 82.09% <100.00%> (+0.01%) ⬆️

@GavinZZ
Copy link
Contributor

GavinZZ commented Nov 25, 2024

Hello, thanks for pinging us on this issue. I apologize for the delay on the update on this issue. I will sync with Kendra internally and share some update on this PR.

Kendra is currently out of office, and I haven’t had a chance to hear back from her yet. I’d like to understand her concerns first before proceeding with the PR review. Thank you for your patience!

Copy link
Contributor

mergify bot commented Dec 18, 2024

update

✅ Branch has been successfully updated

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 18, 2024
@mergify mergify bot dismissed rix0rrr’s stale review December 19, 2024 08:42

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 19, 2024
@mirodrr2
Copy link

mirodrr2 commented Jan 2, 2025

@GavinZZ , any updates on this?

@xazhao
Copy link
Contributor

xazhao commented Jan 3, 2025

@mirodrr2 this PR is ready to merge. I will approve and get it merged.

xazhao
xazhao previously approved these changes Jan 3, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 3, 2025
@mergify mergify bot dismissed xazhao’s stale review January 3, 2025 19:20

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 3, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 3, 2025
@xazhao
Copy link
Contributor

xazhao commented Jan 3, 2025

@Mergifyio update

Copy link
Contributor

mergify bot commented Jan 3, 2025

update

✅ Branch has been successfully updated

@mazyu36
Copy link
Contributor Author

mazyu36 commented Jan 4, 2025

@xazhao
Thank you for the approval.
Would you please remove the pr/do-not-merge label?
This label prevents the merge process from proceeding, I think.

@xazhao xazhao removed pr/do-not-merge This PR should not be merged at this time. pr-linter/do-not-close The PR linter will not close this PR while this label is present labels Jan 4, 2025
Copy link
Contributor

mergify bot commented Jan 4, 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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 72a269f
  • 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 Jan 4, 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 d599900 into aws:main Jan 4, 2025
19 checks passed
Copy link

github-actions bot commented Jan 4, 2025

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 Jan 4, 2025
@mazyu36 mazyu36 deleted the custom-resource-service-timeout-30517 branch January 4, 2025 06:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1 star-contributor [Pilot] contributed between 25-49 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

custom-resource: Support of ServiceTimeout from Cloudformation
9 participants