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(stepfunctions): the Retry field in the statesJson in CustomState is always overwrited #28793

Merged
merged 3 commits into from
Feb 1, 2024

Conversation

sakurai-ryo
Copy link
Contributor

@sakurai-ryo sakurai-ryo commented Jan 20, 2024

After #28422 was merged, the regression that overwrites the Retry field defined in the stateJson was introduced.
The this.renderRetryCatch() method overwrites the Retry field in the stateJson.

This PR fixes this regression and clarifies the current behavior for configuring the Retry and Catch field.

Previously, I added the addRetry method to add the Retry field and did not render the Retry field in the stateJson in #28598, but this is initially a regression and should have been fixed.

Closes #28769
Relates #28586


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 January 20, 2024 14:47
@github-actions github-actions bot added admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1 labels Jan 20, 2024
...this.renderNextEnd(),
...this.stateJson,
...this.renderRetryCatch(),
};

// merge the Retry filed defined in the stateJson into the state
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Retry is configured in two ways(the addRetry method and defining it in the stateJson), so we need to merge them.

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

Nicely done, fix looks good to me. Thanks @sakurai-ryo for updating the documentation for clarification too.
Will wait for someone from aws-cdk team to sign off :)

@sakurai-ryo sakurai-ryo changed the title fix(stepfunctions): the Retry field in the statesJson is always overwrited fix(stepfunctions): the Retry field in the statesJson of CustomState is always overwrited Jan 22, 2024
@sakurai-ryo sakurai-ryo changed the title fix(stepfunctions): the Retry field in the statesJson of CustomState is always overwrited fix(stepfunctions): the Retry field in the statesJson in CustomState is always overwrited Jan 22, 2024
@moelasmar moelasmar self-requested a review January 22, 2024 22:55
@@ -562,6 +562,10 @@ Custom states can be chained together with any of the other states to create you
definition. You will also need to provide any permissions that are required to the `role` that
the State Machine uses.

The Retry and Catch fields are available for error handling.
You can configure the Retry field by defining it in the JSON object or by adding it using the `addRetry` method.
However, the Catch field cannot be configured by defining it in the JSON object, so it must be added using the `addCatch` method.
Copy link
Contributor

Choose a reason for hiding this comment

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

why not to do the same for the Catch field?

Copy link
Contributor Author

@sakurai-ryo sakurai-ryo Jan 24, 2024

Choose a reason for hiding this comment

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

@moelasmar
Thanks for clarifying.
As mentioned in the comments (#25798 (comment)), the method of defining the Catch directly in JSON for the CustomState did not render well and forced us to call _addCatch in the base State class.
The addCatch method was added to solve this in this PR (#28422), but now it overrides the Catch and Retry fields in the JSON.
So it will take some investigation and changes to be able to define the Catch directly in JSON.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @sakurai-ryo for the clarifying.

moelasmar
moelasmar previously approved these changes Jan 30, 2024
Copy link
Contributor

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

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

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

@GavinZZ
Copy link
Contributor

GavinZZ commented Jan 31, 2024

@mergify update

Copy link
Contributor

mergify bot commented Jan 31, 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/repo-metrics.yml without workflows permission

@moelasmar
Copy link
Contributor

https://github.com/Mergifyio update

Copy link
Contributor

mergify bot commented Jan 31, 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/repo-metrics.yml without workflows permission

@sakurai-ryo
Copy link
Contributor Author

Thanks @moelasmar @GavinZZ
Do I need to do the update locally?

@moelasmar
Copy link
Contributor

@Mergifyio update

1 similar comment
@moelasmar
Copy link
Contributor

@Mergifyio update

@moelasmar
Copy link
Contributor

Thanks @moelasmar @GavinZZ Do I need to do the update locally?

for some reason mergify is not working, could you please do the update locally, and update your branch

@mergify mergify bot dismissed moelasmar’s stale review February 1, 2024 01:07

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 65885ad
  • 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 Feb 1, 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 3c33e2c into aws:main Feb 1, 2024
11 checks passed
SankyRed pushed a commit that referenced this pull request Feb 8, 2024
…is always overwrited (#28793)

After #28422 was merged, the regression that overwrites the Retry field defined in the stateJson was introduced.
The `this.renderRetryCatch()` method overwrites the Retry field in the stateJson.
https://github.com/aws/aws-cdk/blob/45b8398bec9ba9c03f195c14f3b92188c9058a7b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/custom-state.ts#L74

This PR fixes this regression and clarifies the current behavior for configuring the Retry and Catch field.

Previously, I added the `addRetry` method to add the Retry field and did not render the Retry field in the stateJson in #28598, but this is initially a regression and should have been fixed.

Closes #28769
Relates #28586

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TheRealAmazonKendra pushed a commit that referenced this pull request Feb 9, 2024
…is always overwrited (#28793)

After #28422 was merged, the regression that overwrites the Retry field defined in the stateJson was introduced.
The `this.renderRetryCatch()` method overwrites the Retry field in the stateJson.
https://github.com/aws/aws-cdk/blob/45b8398bec9ba9c03f195c14f3b92188c9058a7b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/custom-state.ts#L74

This PR fixes this regression and clarifies the current behavior for configuring the Retry and Catch field.

Previously, I added the `addRetry` method to add the Retry field and did not render the Retry field in the stateJson in #28598, but this is initially a regression and should have been fixed.

Closes #28769
Relates #28586

----

*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
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-stepfunctions: Retry in statesJson no longer appears in StateMachine definition
5 participants