-
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
refactor(codepipeline): introduce IAction and unify the Action.bind() signature #3012
Conversation
@@ -12,3 +12,4 @@ export * from './lambda/invoke-action'; | |||
export * from './manual-approval-action'; | |||
export * from './s3/deploy-action'; | |||
export * from './s3/source-action'; | |||
export * from './action'; // for some reason, JSII fails building the module without exporting this class |
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 actually don't want to export this class - but if I don't, JSII fails building with an error. Any ideas how to sidestep that...?
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.
Corrected in the newest revision.
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.
My mistake - it is not in fact resolved. When I marked the class as @internal
, the build for @aws-codepipeline
succeeded, but then @app-delivery
failed saying the CloudFormation Actions don't implement the IAction
interface. So I reverted the change, and I'm back to exporting the class.
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.
Let's mark it as @experimental for now and we'll figure it out
f2b481f
to
123cd8f
Compare
…oduce the IAction interface.
123cd8f
to
43d5a0f
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.
Some minor comments that we should address after merge
/** | ||
* Low-level class for generic CodePipeline Actions. | ||
*/ | ||
export abstract class Action implements codepipeline.IAction { |
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.
Minor: probably should be called ActionBase
protected abstract bound(scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): | ||
codepipeline.ActionConfig; | ||
|
||
private get pipeline(): codepipeline.IPipeline { |
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.
Minor: seems like these are only used in onStateChange
so I'd just move this code in there, and simplify (it's probably sufficient to check if this._pipeline
is undefined).
|
||
/** | ||
* Low-level class for generic CodePipeline Actions. | ||
*/ |
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.
Minor: this is internal right? We are settling on a convention where the file name of internal classes will begin with _
return this.bound(scope, stage, options); | ||
} | ||
|
||
public onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps) { |
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.
Something tells me onStateChange
should not be here. Without it, we basically don't need ActionBase
and it will greatly simplify things. But that's okay... Not that important.
@@ -218,27 +236,12 @@ interface CloudFormationDeployActionProps extends CloudFormationActionProps { | |||
*/ | |||
abstract class CloudFormationDeployAction extends CloudFormationAction { |
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.
Add a Base
suffix (should be the convention for abstract base classes)
@@ -12,3 +12,4 @@ export * from './lambda/invoke-action'; | |||
export * from './manual-approval-action'; | |||
export * from './s3/deploy-action'; | |||
export * from './s3/source-action'; | |||
export * from './action'; // for some reason, JSII fails building the module without exporting this class |
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.
Let's mark it as @experimental for now and we'll figure it out
This brings the Action
bind()
API in line with our conventions.It also introduces an
IAction
interface for those who want to work with the low-level Action interface.The Action class has been moved from the aws-codepipeline to the aws-codepipeline-actions module.
This API is much more flexible, and I show the capabilities by changing the implementation of the
PipelineDeployStackAction
from@app-delivery
.BREAKING CHANGE:
PipelineDeployStackAction
is now acodepipeline.IAction
instead of a Construct.Please read the contribution guidelines and follow the pull-request checklist.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license