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

fix(codebuild): API cleanup #2745

Merged
merged 1 commit into from
Jun 18, 2019

Conversation

skinny85
Copy link
Contributor

@skinny85 skinny85 commented Jun 4, 2019

Change the names of the source classes to be more consistent with other integrations. Make the abstract Source classes package-private. Add static factory methods to Source.

Change the names of artifacts classes to be more consistent with other integrations. Add static factory methods to Artifacts.

Make CodePipelineSource, CodePipelineArtifacts, NoSource, and NoArtifacts package-private.

Get rid of the SourceType enum.

BREAKING CHANGE:

  • codebuild: rename BuildSource to Source, S3BucketSource to S3Source, BuildArtifacts to Artifacts, S3BucketBuildArtifacts to S3Artifacts
  • codebuild: the classes CodePipelineBuildSource, CodePipelineBuildArtifacts, NoBuildSource, and NoBuildArtifacts have been removed
  • codebuild: rename buildScriptAsset and buildScriptAssetEntrypoint to buildScript and buildScriptEntrypoint, respectively

Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
    • Design: For significant features, design document added to design folder
  • Title and Description
    • Change type: title prefixed with fix, feat and module name in parens, which 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)

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

@skinny85 skinny85 requested a review from a team as a code owner June 4, 2019 21:43
@skinny85 skinny85 self-assigned this Jun 4, 2019
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.

Does it make sense to put artifacts and sources in separate packages? Wouldn't a single package for both be just as effective (and less overhead)?

packages/@aws-cdk/aws-codebuild-artifacts/lib/artifacts.ts Outdated Show resolved Hide resolved
@rix0rrr
Copy link
Contributor

rix0rrr commented Jun 5, 2019

Also, I would be fine with names a la S3Source, S3Artifacts.

In effect, service + integration type. This is what we've been settling on for most of the integration classes (except the SFN tasks one, where it's an action verb, WriteToBucket or similar).

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

+1 on merging artifacts into -sources (or leaving in @aws-cdk/codebuild).

packages/@aws-cdk/aws-codebuild-artifacts/lib/artifacts.ts Outdated Show resolved Hide resolved
@skinny85
Copy link
Contributor Author

+1 on merging artifacts into -sources (or leaving in @aws-cdk/codebuild).

Just so I understand - for the second option, are you saying to leave just Artifacts in @aws-cdk/aws-codebuild, but still extract Sources into @aws-cdk/aws-codebuild-sources, or are you saying that you'd rather leave both Sources and Artifacts in @aws-cdk/aws-codebuild?

@eladb
Copy link
Contributor

eladb commented Jun 11, 2019

+1 for leaving sources in codebuild

@skinny85
Copy link
Contributor Author

Any justification why do we want to make CodeBuild inconsistent with our other integration packages?

@eladb
Copy link
Contributor

eladb commented Jun 11, 2019

Are you asking about the sources? It seems to be codebuild sources are not really “integrations”, but if you feel strongly about it, I don’t have a strong opinion.

@skinny85
Copy link
Contributor Author

skinny85 commented Jun 11, 2019

Whatever then.

Let's change this PR to finalize the names, in that case (and do small cleanups, like removing the SourceType enum, making the intermediate Source classes package-private, etc.).

Currently, the names are:

  • Sources:
    • BuildSource
    • NoSource
    • S3BucketSource
    • CodePipelineSource
    • CodeCommitSource
    • GitHubSource
    • GitHubEnterpriseSource
    • BitBucketSource
  • Artifacts:
    • BuildArtifacts
    • NoBuildArtifacts
    • S3BucketBuildArtifacts
    • CodePipelineBuildArtifacts

I'm thinking of removing the Build prefix, so leaving it just as Source / Artifacts. So:

  • Sources:
    • Source
    • S3Source
    • CodePipelineSource
    • CodeCommitSource
    • GitHubSource
    • GitHubEnterpriseSource
    • BitBucketSource
  • Artifacts:
    • Artifacts
    • S3Artifacts
    • CodePipelineArtifacts

I think I would also like to get rid of the NoSource / NoArtifacts classes (make them package-private). I don't see a reason why would a customer ever want to use them.

@eladb
Copy link
Contributor

eladb commented Jun 11, 2019

Names look good. Not sure why you think NoSource and NoArtifacts are not useful. It’s actually a very common use case in the CDK’s ops app (all our canaries are codebuild projects without a source)

@skinny85
Copy link
Contributor Author

Because NoSource / NoArtifacts is the default.

@eladb
Copy link
Contributor

eladb commented Jun 11, 2019

got it. Yeah I guess as long as users can use these features I guess you can hide those.

@skinny85 skinny85 force-pushed the refactor/codebuild-integrations branch from d1b5f7d to a39a748 Compare June 12, 2019 23:16
@skinny85
Copy link
Contributor Author

I've re-purposed the PR for general changes in the CodeBuild modules (see description).

@skinny85 skinny85 changed the title refactor(codebuild): move sources and artifacts into their own separa… fix(codebuild): API cleanup Jun 12, 2019
@skinny85 skinny85 force-pushed the refactor/codebuild-integrations branch from a39a748 to f88d482 Compare June 16, 2019 22:19
@skinny85
Copy link
Contributor Author

Please re-review when you have a chance @eladb @rix0rrr .

@skinny85 skinny85 force-pushed the refactor/codebuild-integrations branch from f88d482 to e753892 Compare June 17, 2019 19:29
@skinny85
Copy link
Contributor Author

Changes taking into account the comments from the previous revision.

@skinny85 skinny85 force-pushed the refactor/codebuild-integrations branch from e753892 to d76083f Compare June 17, 2019 20:01
Change the names of the source classes to be more consistent with other integrations.
Introduce an ISource interface. Make all Source subclasses package-private,
and use static factory methods on Source (renamed from BuildSource) instead.

Change the names of artifacts classes to be more consistent with other integrations.
Introduce the IArtifacts interface. Make all Artifacts subclasses package-private,
and use static factory methods on Artifacts (renamed from BuildArtifacts) instead.

Get rid of the SourceType enum.

Remove the buildScriptAsset and buildScriptAssetEntrypoint properties.

Make Project implements ec2.IConnectable instead of exposing secuirtyGroups directly.

BREAKING CHANGE:
* codebuild: rename BuildSource to Source, BuildArtifacts to Artifacts
* codebuild: all Source and Artifacts classes can only be created through static factory methods instead of constructors
* codebuild: the construction properties buildScriptAsset and buildScriptAssetEntrypoint were removed
* codebuild: the Projet.securityGroups property has been removed; Project now implements ec2.IConnectable instead
@skinny85
Copy link
Contributor Author

Latest batch of changes.

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

See some comments for future improvements.

@eladb eladb merged commit c3667d7 into aws:master Jun 18, 2019
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 2019
This was referenced Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants