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(aws-s3): Add DeployAction for codepipeline #1596

Merged
merged 5 commits into from
Jan 31, 2019
Merged

feat(aws-s3): Add DeployAction for codepipeline #1596

merged 5 commits into from
Jan 31, 2019

Conversation

hoegertn
Copy link
Contributor

@hoegertn hoegertn commented Jan 22, 2019


Pull Request Checklist

  • Testing
    • Unit test added
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
  • Title and Description
    • Change type: title prefixed with fix, feat will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

fixes #1585

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

@hoegertn hoegertn requested a review from a team as a code owner January 22, 2019 21:27
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 @hoegertn!

I have some small comments inline, and 1 large one: can you add an integration test to the aws-codepipeline package, testing this functionality? You can take inspiration from one of the tests already there - they're the one with the integ prefix. We have some docs about how to use them here.

Thanks!

@@ -36,7 +36,7 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi
* Construction properties of the {@link PipelineSourceAction S3 source Action}.
*/
export interface PipelineSourceActionProps extends CommonPipelineSourceActionProps,
codepipeline.CommonActionConstructProps {
codepipeline.CommonActionConstructProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you keep the double indent here? Thanks!

* Construction properties of the {@link PipelineDeployAction S3 deploy Action}.
*/
export interface PipelineDeployActionProps extends codepipeline.CommonActionProps,
codepipeline.CommonActionConstructProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Double indent here, as above.

/**
* The Amazon S3 bucket that is the deploy target
*/
bucket: IBucket;
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be an empty line after each property in this interface, to separate them more clearly.

/**
* The inputArtifact to deploy to Amazon S3
*/
inputArtifact: codepipeline.Artifact;
Copy link
Contributor

Choose a reason for hiding this comment

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

Input artifact can be optional here (inputArtifact?: codepipeline.Artifact). In that case, the CodePipeline Construct will attempt to wire the input automatically.

super(scope, id, {
stage: props.stage,
runOrder: props.runOrder,
owner: 'AWS',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the default value for owner, so feel free to skip providing this parameter.

runOrder: props.runOrder,
owner: 'AWS',
provider: 'S3',
inputArtifact: props.inputArtifact,
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 passing these from props, you can use TypeScript's spread operator:

super(scope, id, {
  provider: 'S3',
  artifactBounds: {
    minInputs: 1,
    maxInputs: 1,
    minOutputs: 0,
    maxOutputs: 0,
  },
  configuration: {
    BucketName: props.bucket.bucketName,
    Extract: props.extract || 'true',
    ObjectKey: props.objectKey,
  },
  ...props,
});

*/
bucket: IBucket;
/**
* Should the deploy action extract the artifact before deploying to Amazon S3. Defaults to true
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the @default JSDoc tag here:

/**
 * Should the deploy Action extract the artifact before deploying to S3.
 *
 * @default true
 */

*/
extract?: boolean;
/**
* The key of the target object. This is required if extract is false.
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great if the construct validated that is true, and throw an error with a nice message if not.

*/
objectKey?: string;
/**
* The inputArtifact to deploy to Amazon S3
Copy link
Contributor

Choose a reason for hiding this comment

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

Missed a period at the end :)

},
configuration: {
BucketName: props.bucket.bucketName,
Extract: props.extract || 'true',
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is a boolean in props, but the || is a String. Do you know which one is it? It might make a difference on the API level.

Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

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

Looks great. Could you add some unit tests as well please?

*/
bucket: IBucket;
/**
* Should the deploy action extract the artifact before deploying to Amazon S3. Defaults to true
Copy link
Contributor

Choose a reason for hiding this comment

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

Document the default as

@default true

*/
extract?: boolean;
/**
* The key of the target object. This is required if extract is false.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

@hoegertn
Copy link
Contributor Author

Thanks for the review. I will fix all the issues soon. Sorry, I did not find the correct place to put the test or to find an example.

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.

LGTM :)

@rix0rrr what's your view?

@skinny85
Copy link
Contributor

@rix0rrr ping

@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 30, 2019

LGTM to me too

@skinny85
Copy link
Contributor

hey @hoegertn , I've updated your PR with a conflict resolution, and I've also updated the test expectation for the integ tests (something changed on master in the meantime).

@RomainMuller RomainMuller merged commit 8f1a5e8 into aws:master Jan 31, 2019
@hoegertn hoegertn deleted the s3-deploy branch September 27, 2019 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support S3 Deploy Action
4 participants