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(stepfunctions-tasks): create scheduler #29458

Merged
merged 77 commits into from
Nov 14, 2024

Conversation

badmintoncryer
Copy link
Contributor

@badmintoncryer badmintoncryer commented Mar 12, 2024

Issue # (if applicable)

Closes #29351.

Reason for this change

Although the creation of schedule task is supported, the AWS CDK currently lacks the capability to create these without a custom task definition.

Description of changes

I've introduced the EventBridgeSchedulerCreateScheduleTask class to address this gap.

The original issue discussed the need for both creating and updating schedules. However, to maintain focus and simplicity, this PR will only cover the creation aspect. A subsequent PR will be dedicated to schedule updates.

Description of how you validated changes

I have added both integ and unit 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 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Mar 12, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team March 12, 2024 06:06
@github-actions github-actions bot added the star-contributor [Pilot] contributed between 25-49 PRs to the CDK label Mar 12, 2024
@badmintoncryer
Copy link
Contributor Author

@cshields236 Please wait for a while.

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.

@aws-cdk-automation aws-cdk-automation dismissed their stale review March 14, 2024 01:28

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

@badmintoncryer badmintoncryer marked this pull request as ready for review March 14, 2024 01:43
@badmintoncryer badmintoncryer force-pushed the 29351-schedulerIntegration branch 2 times, most recently from 562fae8 to 6a21c6d Compare March 15, 2024 04:36
@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 Mar 15, 2024
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks 👍 Left comments for adjustments

*
* @see https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html
*/
readonly scheduleExpression: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using a Schedule class similar to 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.

It's a really nice suggestion. Do you mean implementing the Schedule class in create-schedule.ts? Or importing this class directly?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that the class is declared in multiple packages already.
I think you can create it inside the aws-stepfunctions-tasks/lib package.

Copy link
Contributor Author

@badmintoncryer badmintoncryer Jul 4, 2024

Choose a reason for hiding this comment

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

I defined Schedule class in create-schedule.ts.

I also referred to this class, particularly the rate() method.
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-events/lib/schedule.ts#L11

packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md Outdated Show resolved Hide resolved
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 12, 2024
Copy link
Contributor Author

@badmintoncryer badmintoncryer 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 your review!! I've addressed your comments.
I have one question about implementation of Schedule class.

*
* @see https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets.html
*/
readonly target: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to name this parameter as targetArn but it causes linter failure.

error: [awslint:props-no-arn-refs:aws-cdk-lib.aws_stepfunctions_tasks.EventBridgeSchedulerCreateScheduleTaskProps.targetArn] props must use strong types instead of attributes. props should not have "arn" suffix 

*
* @see https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html
*/
readonly scheduleExpression: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a really nice suggestion. Do you mean implementing the Schedule class in create-schedule.ts? Or importing this class directly?

packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

mergify bot commented Nov 12, 2024

update

☑️ Nothing to do

  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.17%. Comparing base (92bfb59) to head (2ccf2e8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #29458   +/-   ##
=======================================
  Coverage   77.17%   77.17%           
=======================================
  Files         105      105           
  Lines        7162     7162           
  Branches     1311     1311           
=======================================
  Hits         5527     5527           
  Misses       1455     1455           
  Partials      180      180           
Flag Coverage Δ
suite.unit 77.17% <ø> (ø)

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

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

@paulhcsun
Copy link
Contributor

paulhcsun commented Nov 12, 2024

Hi @badmintoncryer, we've recently added codecov for checking coverage for CLI related files and it seems to be blocking this PR even though it is an unrelated file failing: packages/aws-cdk/lib/api/logs/logs-monitor.ts. I will check with the team to see if we can manually merge or if we need to take any additional action. Either way I don't expect that you will need to fix that coverage for this PR. Thanks for your patience while we figure this out.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 12, 2024
@badmintoncryer
Copy link
Contributor Author

@paulhcsun Thank you very much for your assistance!

@mergify mergify bot dismissed paulhcsun’s stale review November 13, 2024 09:41

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 Nov 13, 2024
@paulhcsun
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Nov 13, 2024

update

✅ Branch has been successfully updated

paulhcsun
paulhcsun previously approved these changes Nov 13, 2024
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 13, 2024
@mergify mergify bot dismissed paulhcsun’s stale review November 14, 2024 05:56

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 Nov 14, 2024
@paulhcsun
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Nov 14, 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

@paulhcsun
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Nov 14, 2024

update

☑️ Nothing to do

  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

@paulhcsun
Copy link
Contributor

Ok it should hopefully work this time 🤞

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 2ccf2e8
  • 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 14, 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 d14a01c into aws:main Nov 14, 2024
18 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 14, 2024
@badmintoncryer badmintoncryer deleted the 29351-schedulerIntegration branch November 14, 2024 21:36
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. p2 pr/needs-maintainer-review This PR needs a review from a 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.

(stepfunction-tasks): eventbridge scheduler create, update schedule
5 participants