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(codepipeline): add support for CloudFormation StackSet actions #14225

Merged
merged 33 commits into from
Feb 15, 2022

Conversation

ndchelsea
Copy link
Contributor

Adds support for CloudFormationStackSet CodePipeline actions.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Apr 16, 2021

@ndchelsea
Copy link
Contributor Author

ndchelsea commented Apr 16, 2021

Which README am I supposed to update?

Edit: omg I can't believe I missed the big glaring README in aws-codepipeline-actions. Will update :)

@skinny85
Copy link
Contributor

Thanks for the contribution @ndchelsea!

Which README am I supposed to update?

The ReadMe of the module you're changing - in this case, it should be the @aws-cdk/aws-codepipeline module ReadMe.

@ndchelsea
Copy link
Contributor Author

Thanks for the contribution @ndchelsea!

Which README am I supposed to update?

The ReadMe of the module you're changing - in this case, it should be the @aws-cdk/aws-codepipeline module ReadMe.

It should actually be codepipelineactions I think.

I'll reword my commits - but I am wondering should I squash them or leave them separate?

@skinny85
Copy link
Contributor

Thanks for the contribution @ndchelsea!

Which README am I supposed to update?

The ReadMe of the module you're changing - in this case, it should be the @aws-cdk/aws-codepipeline module ReadMe.

It should actually be codepipelineactions I think.

I'll reword my commits - but I am wondering should I squash them or leave them separate?

Yes, you're right, it should be codepipeline-actions (my link lead to the correct one).

As for the commits, it doesn't matter (they will all be squashed anyway when this is merged), so do whatever you prefer.

@ndchelsea ndchelsea force-pushed the codepipeline_stacksetaction branch from d49b064 to f607d47 Compare April 17, 2021 00:23
@ndchelsea
Copy link
Contributor Author

As for the commits, it doesn't matter (they will all be squashed anyway when this is merged), so do whatever you prefer.

Sounds good - I fixed it. Should be all good now.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @ndchelsea!

This is a very complicated feature. Right now, I'm not super happy with the customer-facing API for this. It's a maze of inter-dependent properties that is pretty much a direct translation of the CloudFormation schema. In the CDK, we really strive to make things easier to use, and harder to misuse. I think we need to introduce a few helper classes that will make it easier to use the CloudFormationStackSetAction. I've given you an example in the comments below, hopefully it's clear enough what I mean.

Let me know if you need any help with the details of the design of the API!

Thanks,
Adam

@@ -997,3 +997,31 @@ pipeline.addStage({

See [the AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-StepFunctions.html)
for information on Action structure reference.

### AWS Stack Sets
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does the updated one work? I got rid of the example since most things under cfn don't have examples.

* SELF_MANAGED permissions model, you can only provide accounts.
*
* Note
* When this parameter is selected, you must also select Regions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, this constraint means we are missing a higher-level concept here that probably deserves its own class, and the deploymentTargets and regions properties should be merged.

* "ou-examplerootid222-exampleouid222"
* ]
*
* One of deploymentTargets or deploymentTargetsPath is required, but not both.
Copy link
Contributor

Choose a reason for hiding this comment

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

Again - this means this should be one required property with a new type.

Comment on lines 931 to 936
singletonPolicy.grantPassRole(cdk.Stack.of(scope).formatArn({
region: '',
service: 'iam',
resource: 'role',
resourceName: 'AWSCloudFormationStackSetAdministrationRole',
}));
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of this, just use Role.fromRoleName(). This will also save you changing the signature of grantPassRole() below.

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 was originally going to do that (well, fromRoleArn) - no issue creating a construct within the bound method?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope.

@mergify mergify bot dismissed skinny85’s stale review April 21, 2021 22:04

Pull request has been modified.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Putting this in 'Request changes' to clear it from my ToDo list, @ndchelsea please re-request my review (there's a button in the top-right of the PR window, next to my avatar) when you're ready with the last changes!

@dannyburke1
Copy link

Happy to help with any of this to get it merged in as we'd love to use this functionality. Anything I can do to help?

Thanks for your efforts so far.

@skinny85 skinny85 removed their assignment Jun 22, 2021
@skinny85 skinny85 added effort/medium Medium work item – several days of effort p1 labels Jun 22, 2021
@skinny85
Copy link
Contributor

skinny85 commented Feb 3, 2022

@ndchelsea just checking in - were you planning on picking this up again?

@dannyburke1 are you still interested in picking this up?

@dannyburke1
Copy link

@skinny85 yes, happy to help! Forgot about this, we still need the functionality.

@rix0rrr rix0rrr requested a review from skinny85 February 11, 2022 14:05
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 11, 2022

I think I have everything

@skinny85 skinny85 added the pr/do-not-merge This PR should not be merged at this time. label Feb 11, 2022
skinny85
skinny85 previously approved these changes Feb 11, 2022
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Thanks for extracting that common interface for the props - I think that was the right direction, and it made the code of the actions so much smaller and easier to understand.

My only comment is that I still think the CloudFormationDeployStackInstancesAction class should have the word "StackSets" in it. I just think it's confusing without it. I understand you hate long names, and want to make them shorter, but this name is already long, and adding 3 more characters doesn't really change that.

So, my only ask is to rename CloudFormationDeployStackInstancesAction to CloudFormationDeployStackSetInstancesAction.

* set. Then all instance statuses are set to OUTDATED until the changes are
* deployed to that instance.
*/
export class CloudFormationDeployStackInstancesAction extends Action {
Copy link
Contributor

Choose a reason for hiding this comment

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

I still think this action should contain the word "StackSet" in it, otherwise it's a little misleading.

I would ask for it to be renamed to CloudFormationDeployStackSetInstancesAction. I understand you hate long names, but I think those 3 characters here are really worth it.


const instancesResult = this.props.stackInstances?._bind(scope);

if ((this.actionProperties.inputs || []).length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

|| -> ???

/**
* Properties for the CloudFormationDeployStackInstancesAction
*/
export interface CloudFormationStackInstancesActionProps extends codepipeline.CommonAwsActionProps, CommonCloudFormationStackSetOptions {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be called CloudFormationDeployStackInstancesActionProps.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh whoops. Good catch.

@skinny85 skinny85 changed the title feat(codepipeline): support for CloudFormationStackSet actions feat(codepipeline): add support for CloudFormation StackSet actions Feb 11, 2022
* Options in common between both StackSet actions
*/
export interface CommonCloudFormationStackSetOptions {

Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this one?

Suggested change

@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 14, 2022

So, my only ask is to rename CloudFormationDeployStackInstancesAction to CloudFormationDeployStackSetInstancesAction.

Well. I am somewhat opposed to that, given that this is the term CloudFormation uses. In all existing material, they are not called "stack set instances", they are called "stack instances".

image

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html

I'm not sure it's worth deviating from existing terminology here.

@rix0rrr rix0rrr requested a review from skinny85 February 14, 2022 09:50
@skinny85
Copy link
Contributor

In my opinion, it is. I don't think calling them "stack set instances" is in any way confusing or unclear. When using the CDK, you don't see the CloudFormation docs, you see the names we chose, and having "stack set" in the name clearly distinguishes these two classes from the existing 4 classes that deal with individual stacks.

But I don't care that much, and I've already approved the PR, so the final call is up to you (although you probably want to address this comment: #14225 (comment) before merging the PR).

@mergify mergify bot dismissed skinny85’s stale review February 15, 2022 09:09

Pull request has been modified.

@rix0rrr rix0rrr removed the pr/do-not-merge This PR should not be merged at this time. label Feb 15, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 15, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: c64f039
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit d8bc0d0 into aws:master Feb 15, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 15, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…ws#14225)

Adds support for CloudFormationStackSet CodePipeline actions.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@curquhart
Copy link
Contributor

Hey just wanted to say thanks for finishing up this PR for me! I left the job I was at while this was up in the air and forgot about it in all the excitement. (I don't have access to ndchelsea anymore as it was on my work email)... anyway thanks again :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants