Skip to content

feat(codebuild): add support for setting a BuildEnvironment Certificate#15738

Merged
mergify[bot] merged 3 commits intoaws:masterfrom
mneil:codebuild-environment-certificate
Jul 27, 2021
Merged

feat(codebuild): add support for setting a BuildEnvironment Certificate#15738
mergify[bot] merged 3 commits intoaws:masterfrom
mneil:codebuild-environment-certificate

Conversation

@mneil
Copy link
Copy Markdown
Contributor

@mneil mneil commented Jul 23, 2021

fixes #15701

Add certificate as optional parameter to codebuild project
Environment. The certificate option supports including an additional
PEM certificate for on-prem DNS / SSL of codebuild projects.


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
Copy Markdown

gitpod-io bot commented Jul 23, 2021


/**
* The ARN of the Amazon S3 bucket, path prefix, and object key that contains the
* PEM-encoded certificate for the build project
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Optional: you could add an example s3 arn.

Example: arn:aws:s3:::bucket_name/key/path/to/ca.pem

rot26
rot26 previously approved these changes Jul 23, 2021
Copy link
Copy Markdown

@rot26 rot26 left a comment

Choose a reason for hiding this comment

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

This is something we need at my job. 👍

@mneil mneil force-pushed the codebuild-environment-certificate branch from 2a72d0e to 64f3735 Compare July 23, 2021 17:05
@skinny85 skinny85 self-assigned this Jul 23, 2021
Copy link
Copy Markdown
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 @mneil! Small suggestion on the design of this new API.

Also, we need to add an example to the module's ReadMe file.

*
* @default - No external certificate is added to the project
*/
readonly certificate?: string;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm wondering whether a string is the best way to model this...? Seems a little looks for my taste.

I see 2 possible alternatives:

  1. Introduce a dedicated interface for this property, something like BuildCertificate, that takes in an s3.IBucket, a string for the key, and maybe an optional version?
  2. Use the existing Location interface from the S3 module. There's a small downside that it takes in a bucketName as just a string, but maybe that's fine - we can show an example in the ReadMe of importing a Bucket by ARN, and then using it to pass the bucketName property as bucket.bucketName.

I'll let you decide which option you like more!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah thanks! I was looking for something better but couldn't find existing classes that met the need and wasn't sure about adding another interface. I like option 2 better since it already exists.

However, arns do not support versions and the BuildEnvironment certificate at the cloudformation level only accepts a string value that is an arn. It seems like there's no way to support a version at the moment for the certificate. Because of this I'll create a new interface that takes in an IBucket and key only so people don't think they can use a version when it's not supported.

Let me know if I'm wrong about the version? If so I'll use the existing interface. Won't be hard to do either way.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, let's go with a new interface here.

@mneil mneil force-pushed the codebuild-environment-certificate branch from 64f3735 to 5abe2bd Compare July 23, 2021 19:31
@mergify mergify bot dismissed skinny85’s stale review July 23, 2021 19:32

Pull request has been modified.

@mneil mneil force-pushed the codebuild-environment-certificate branch 2 times, most recently from d7a1d2c to 76a5717 Compare July 23, 2021 19:34
@mneil
Copy link
Copy Markdown
Contributor Author

mneil commented Jul 26, 2021

@skinny85 Any additional feedback? I've added a new interface and documentation.

@skinny85
Copy link
Copy Markdown
Contributor

I haven't reviewed the latest iteration. Make sure to re-request my review after you're done pushing your changes (there's a button next to my avatar in the top-right corner of the PR page).

@mneil mneil requested a review from skinny85 July 26, 2021 19:40
Copy link
Copy Markdown
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.

Looks great @mneil! A few minor comments.

props: ProjectProps,
projectVars: { [name: string]: BuildEnvironmentVariable } = {}): CfnProject.EnvironmentProperty {

let certificate: string | undefined = undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we inline this variable? I don't think it adds much.

@skinny85 skinny85 changed the title feat(aws-codebuild): Add support for BuildEnvironment Certificate feat(codebuild): add support for BuildEnvironment Certificate Jul 26, 2021
@skinny85 skinny85 changed the title feat(codebuild): add support for BuildEnvironment Certificate feat(codebuild): add support for setting a BuildEnvironment Certificate Jul 26, 2021
Add certificate as optional parameter to codebuild project
Environment. The certificate option supports including an additional
PEM certificate for on-prem DNS / SSL of codebuild projects.
@mneil mneil force-pushed the codebuild-environment-certificate branch from 76a5717 to fc7fb32 Compare July 27, 2021 15:34
@mergify mergify bot dismissed skinny85’s stale review July 27, 2021 15:35

Pull request has been modified.

@mneil
Copy link
Copy Markdown
Contributor Author

mneil commented Jul 27, 2021

I should probably stop force pushing so you can see the changes are resolved :). If there's anymore feedback I'll do that and squash later. I just realized I'm clobbering the diff on your requested changes.

@mneil mneil requested a review from skinny85 July 27, 2021 15:36
skinny85
skinny85 previously approved these changes Jul 27, 2021
Copy link
Copy Markdown
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.

Looks great @mneil, thanks for the contribution!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jul 27, 2021

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
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 99e5fef
  • 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 76fb481 into aws:master Jul 27, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jul 27, 2021

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).

@mneil mneil deleted the codebuild-environment-certificate branch July 28, 2021 15:43
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Aug 3, 2021
…te (aws#15738)

fixes aws#15701

Add certificate as optional parameter to codebuild project
Environment. The certificate option supports including an additional
PEM certificate for on-prem DNS / SSL of codebuild projects.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…te (aws#15738)

fixes aws#15701

Add certificate as optional parameter to codebuild project
Environment. The certificate option supports including an additional
PEM certificate for on-prem DNS / SSL of codebuild projects.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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.

aws-codebuild/Project: BuildEnvironment should support certificate

4 participants