-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(codepipeline): stage level condition feature L2 construct #33809
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
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.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33809 +/- ##
=======================================
Coverage 82.38% 82.38%
=======================================
Files 120 120
Lines 6938 6938
Branches 1170 1170
=======================================
Hits 5716 5716
Misses 1119 1119
Partials 103 103
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
5790787
to
f85ce3b
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.
Thank you, in general looks good to me. Left some minor feedbacks.
public readonly beforeEntry?: Conditions; | ||
public readonly onSuccess?: Conditions; | ||
public readonly onFailure?: FailureConditions; |
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.
Do they need to be public? Do you expect CDK users to be able to access these fields like
const pipeline = new CodePipeline(.....);
pipeline.beforeEntry
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.
Sure. Switch these to private
* | ||
* @default - No configuration | ||
*/ | ||
readonly configuration?: any; |
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.
Is there a way to make the type more strict? I see that it's an json object, is there certain interface we can draft for the object?
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.
That Ideal one is a Map<any,any>, but it's kind of same as any. So I choose to match the CFN type
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.
IMO I think we should at least make this a Map/object since the CFN type is JSON.
* | ||
* @default 'Rule' | ||
*/ | ||
readonly category?: string; |
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.
Seems that category
only supports Rule
for now. Do you expect that this will support more values in the future? I think we should make it a ENUM-like class type. https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md#enums
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.
No. This one is fixed value applied for Rule
ruleTypeId: { | ||
provider: this._props.provider, | ||
version: this._props.version, | ||
category: 'Rule', | ||
owner: 'AWS', | ||
}, |
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.
Nice, I like how you flatten these in the props. Thanks!
ruleTypeId: { | ||
provider: this._props.provider, | ||
version: this._props.version, | ||
category: 'Rule', |
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 see you're hardcoding Rule
instead of using this.props.category
. Should we not expose the property isntead then?
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 category in RuleProps
should be deleted.
})); | ||
// -- | ||
|
||
// eslint-disable-next-line no-console |
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.
remove this plz
|
||
// eslint-disable-next-line no-console | ||
console.log(Template.fromStack(stack).findResources('AWS::CodePipeline::Pipeline')); | ||
// eslint-disable-next-line no-console |
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.
same here
})); | ||
// -- | ||
|
||
// eslint-disable-next-line no-console |
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.
same here
|
||
// eslint-disable-next-line no-console | ||
console.log(Template.fromStack(stack).findResources('AWS::CodePipeline::Pipeline')); | ||
// eslint-disable-next-line no-console |
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.
same here
const awsApiCall1 = integrationTest.assertions.awsApiCall('CodePipeline', 'getPipeline', { name: 'my-pipeline-stage-test' }); | ||
awsApiCall1.assertAtPath('pipeline.name', ExpectedResult.stringLikeRegexp('my-pipeline-stage-test')); | ||
awsApiCall1.assertAtPath('pipeline.stages.0.name', ExpectedResult.stringLikeRegexp('Source')); | ||
awsApiCall1.assertAtPath('pipeline.stages.1.name', ExpectedResult.stringLikeRegexp('Lambda')); | ||
awsApiCall1.assertAtPath('pipeline.stages.1.actions.0.name', ExpectedResult.stringLikeRegexp('Lambda')); | ||
awsApiCall1.assertAtPath('pipeline.stages.1.onSuccess.conditions.0.result', ExpectedResult.stringLikeRegexp('FAIL')); | ||
awsApiCall1.assertAtPath('pipeline.stages.1.onFailure.conditions.0.result', ExpectedResult.stringLikeRegexp('ROLLBACK')); |
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.
Nice, thanks for adding assertions to integ tests!
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.
LGTM, just one more comment
* | ||
* @default - No configuration | ||
*/ | ||
readonly configuration?: any; |
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.
IMO I think we should at least make this a Map/object since the CFN type is JSON.
L2 Construct for stage level condition 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.
Thank you for the contribution and addressing the comments!
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). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
#33511
Reason for this change
Codepipeline launched this feature last years and still missed the update in cdk library.
Description of changes
Support this feature in L2 Construct:https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts-how-it-works-conditions.html
Describe any new or updated permissions being added
No
Description of how you validated changes
Unit test, integ test, and local cdk library deployment(linked to local cdkApp and successfully deploy it)
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license