-
Notifications
You must be signed in to change notification settings - Fork 4k
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): allow setting comment on state machine #25858
Conversation
There was a problem hiding this 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.
962fcbc
to
d16caeb
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
this is "ready" but the build is failing for what appears to be an unrelated reason... going to mark as draft until i have the cycles to look into that more thoroughly (also going to update from main in case it was just a flake) |
build succeeded on re-run so good to go :) |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
1 similar comment
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
I probably won't have time to look into the merge conflict until next week. Let me know if I should just close this until then or not (donno if the new DefinitionBody.fromChainable stuff sets the sfn comment or not so need to test, but def don't have time this week. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
2 similar comments
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
bf9cd08
to
c3e8144
Compare
Just wanted to follow up on this- would appreciate if someone has time to look at it thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, this looks great. Thank you for contributing.
I have just some NITs.
Tagging @iliapolo for a second opinion.
* Read/write. Only makes sense on the top-level graph, subgraphs | ||
* do not support this feature. | ||
* | ||
* @default No comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Could you change this to @default - No comment
.
/** | ||
* Comment that describes this state machine | ||
* | ||
* @default No comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to earlier comment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh yup, np, updated :D
Pull request has been modified.
Thank you for addressing the feedback. :) LGTM, syncing with Eli to get a second opinion. |
* Read/write. Only makes sense on the top-level graph, subgraphs | ||
* do not support this feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand you followed the same pattern as the timeout
property - but this behavior makes me a little uncomfortable and I think that timeout
also wasn't implemented in an ideal way. Lets see if we can make it better?
See other comments.
@@ -707,6 +714,7 @@ export class ChainDefinitionBody extends DefinitionBody { | |||
public bind(scope: Construct, sfnPrincipal: iam.IPrincipal, sfnProps: StateMachineProps): DefinitionConfig { | |||
const graph = new StateGraph(this.chainable.startState, 'State Machine definition'); | |||
graph.timeout = sfnProps.timeout; | |||
graph.comment = sfnProps.comment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if instead we do:
const graphJson = Stack.of(scope).toJsonString(graph.toGraphJson());
return {
definitionString: { Comment: sfnProps.comment, ...graphJson },
};
Basically having the state machine augment the graph with properties that are only relevant to the state machine as a whole - and not to sub-graphs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally updated,
const graphJson = graph.toGraphJson();
return {
definitionString: Stack.of(scope).toJsonString({ ...graphJson, Comment: sfnProps.comment }),
};
how's that? I included comment after since the graph always sets it (even if undefined) and {something: 'foo', ... {something:undefined}} will override with undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@curquhart leaving a request changes review to reflect the current state of this PR and remove the needs-review
label. We'll take another look when outstanding comments are addressed!
sure thing. Sorry haven't addressed yet, I'm on vaca at the moment, should address it next week. |
e699785
to
ab90a05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @curquhart! Thanks for sticking with this PR. One last comment about the changes to StateGraph
.
@@ -113,6 +123,7 @@ export class StateGraph { | |||
StartAt: this.startState.stateId, | |||
States: states, | |||
TimeoutSeconds: this.timeout && this.timeout.toSeconds(), | |||
Comment: this.comment, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think changes to StateGraph
are necessary anymore. StateGraph
is exposed but not meant to be used externally. No one should be setting comment
on StateGraph
and internally we are not doing that anymore either. So there's no need to have this prop.
(This means that the ordering between ...graphJson
and Comment: sfnProps.comment
won't matter anymore, but its fine to have graphJson in front).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha... I forgot i added it to state-graph, totally makes sense to take it out - updated
ab90a05
to
94a2dea
Compare
94a2dea
to
42495e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @curquhart! Looks good
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Just a small PR to allow setting top level comment on a state machine
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license