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(stepfunctions-tasks): support overriding all properties of CodeBuild StartBuild integration #10356

Merged
merged 2 commits into from
Nov 12, 2020

Conversation

zxkane
Copy link
Contributor

@zxkane zxkane commented Sep 15, 2020

closes #10302


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

Copy link
Contributor

@shivlaks shivlaks 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 getting this started @zxkane - I think rather than directly translate out all of the potential overrides, we should strive to reuse and simplify wherever we can. take a look at some of my initial observations (I did not dive super deep into this one yet) and let me know what you think.

Also adding @skinny85 as a reviewer as he will have additional insights/feedback on how to structure overrides as the owner of the codebuild module

@zxkane zxkane force-pushed the stepfunctions-codebuild-startbuild branch from f603627 to 45cc7d5 Compare September 30, 2020 10:30
@mergify mergify bot dismissed shivlaks’s stale review September 30, 2020 10:31

Pull request has been modified.

@zxkane zxkane force-pushed the stepfunctions-codebuild-startbuild branch from 45cc7d5 to 903fe69 Compare September 30, 2020 11:43
@zxkane
Copy link
Contributor Author

zxkane commented Oct 8, 2020

@shivlaks @skinny85 any thought for latest changes?

@zxkane zxkane requested a review from shivlaks October 13, 2020 07:42
@zxkane
Copy link
Contributor Author

zxkane commented Oct 13, 2020

@shivlaks @skinny85 any update for the recent changes?

@zxkane
Copy link
Contributor Author

zxkane commented Oct 16, 2020

@shivlaks @skinny85 any feedback for the changes of this PR?

@zxkane
Copy link
Contributor Author

zxkane commented Oct 20, 2020

@shivlaks @SomayaB any feedback for the latest changes?

@shivlaks
Copy link
Contributor

@zxkane I have not had a chance to look at the proposed changes. I will likely only be able to take a pass towards the end of the week. stay tuned!

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 @zxkane ! This is a very difficult feature, as it involves a very heavy integration with a different module.

I think the main problem here is the duplication between the CodeBuild and StepFunctions-Tasks modules. Here's my proposed solution to this problem.

Extract a (public) interface in @aws-cdk/aws-codebuild that will contain the property that can be overridden in the StartBuild call, let's call it StartBuildOptions. Make the existing ProjectProps and PipelineProjectProps extend that interface (you might do some interface dance because of CommonProjectProps, but I trust you to figure it out - ping me if you can't).

Then, in the @aws-cdk/aws-stepfunctions-tasks module, you create an interface that contains all those things that you can set for StartBuild, but you can't set when creating the Project:

export interface OverrideProjectProps extends codebuild.StartBuildOptions {
  readonly idempotencyToken?: string;

  // ... other properties that you can set in StartBuild,
  // but can't set when creating a Project
}

Then, in CodeBuildStartBuildProps, you add:

  readonly overrides?: OverrideProjectProps;

And the implementation is basically the same as you currently have.

@zxkane zxkane force-pushed the stepfunctions-codebuild-startbuild branch from 903fe69 to b87f930 Compare November 5, 2020 06:56
@gitpod-io
Copy link

gitpod-io bot commented Nov 5, 2020

@mergify mergify bot dismissed skinny85’s stale review November 5, 2020 06:57

Pull request has been modified.

@zxkane zxkane force-pushed the stepfunctions-codebuild-startbuild branch 2 times, most recently from 2076882 to c8b27d3 Compare November 5, 2020 08:05
@zxkane
Copy link
Contributor Author

zxkane commented Nov 5, 2020

Thanks for the contribution @zxkane ! This is a very difficult feature, as it involves a very heavy integration with a different module.

I think the main problem here is the duplication between the CodeBuild and StepFunctions-Tasks modules. Here's my proposed solution to this problem.

Extract a (public) interface in @aws-cdk/aws-codebuild that will contain the property that can be overridden in the StartBuild call, let's call it StartBuildOptions. Make the existing ProjectProps and PipelineProjectProps extend that interface (you might do some interface dance because of CommonProjectProps, but I trust you to figure it out - ping me if you can't).

Then, in the @aws-cdk/aws-stepfunctions-tasks module, you create an interface that contains all those things that you can set for StartBuild, but you can't set when creating the Project:

export interface OverrideProjectProps extends codebuild.StartBuildOptions {
  readonly idempotencyToken?: string;

  // ... other properties that you can set in StartBuild,
  // but can't set when creating a Project
}

Then, in CodeBuildStartBuildProps, you add:

  readonly overrides?: OverrideProjectProps;

And the implementation is basically the same as you currently have.

@skinny85 Adam, thanks for your comments. There are few properties not supported by CodeBuild L2 construct yet, I leave them not supported in overriding properties as well. I think they should be supported in a separated PR. Let me know what you think.

@zxkane zxkane requested a review from skinny85 November 5, 2020 08:38
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.

I absolutely love this! Great job @zxkane !

A few minor comments, mainly stylistic ones. @shivlaks please review as well!

@zxkane zxkane force-pushed the stepfunctions-codebuild-startbuild branch 2 times, most recently from 0b5faa9 to 2072874 Compare November 6, 2020 15:31
Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

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

@zxkane nice work!!

I think we're missing a few tests for error scenarios added on the overrides in stepfunctions-tasks. otherwise, made some minor suggestions.

@zxkane zxkane requested a review from skinny85 November 10, 2020 01:00
@zxkane
Copy link
Contributor Author

zxkane commented Nov 11, 2020

@shivlaks @skinny85 could you give your feedback for latest changes?

@shivlaks shivlaks added the pr/do-not-merge This PR should not be merged at this time. label Nov 12, 2020
Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

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

@zxkane thanks for all the work on this PR!! looks good to me.

I added a do-not-merge so @skinny85 can also weigh in before merging it.

@shivlaks shivlaks changed the title feat(stepfunctions-tasks): support complete overridings of start buil… feat(stepfunctions-tasks): support complete overridings of start build of codebuild Nov 12, 2020
@shivlaks
Copy link
Contributor

@zxkane - thanks again!! confirmed with @skinny85 that we're good to merge this one in!!

@shivlaks shivlaks removed the pr/do-not-merge This PR should not be merged at this time. label Nov 12, 2020
@mergify
Copy link
Contributor

mergify bot commented Nov 12, 2020

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

@shivlaks shivlaks changed the title feat(stepfunctions-tasks): support complete overridings of start build of codebuild feat(stepfunctions-tasks): support overriding all properties of CodeBuild StartBuild integration Nov 12, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: e004b3a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Nov 12, 2020

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

@mergify mergify bot merged commit 58efbad into aws:master Nov 12, 2020
shivlaks added a commit that referenced this pull request Nov 12, 2020
… of CodeBuild StartBuild integration (#10356)"

This reverts commit 58efbad.
mergify bot pushed a commit that referenced this pull request Nov 13, 2020
… of CodeBuild StartBuild integration (#10356)" (#11448)

This reverts commit 58efbad.

We have a latent issue which fails on generating the `Java` code with:
> ProjectProps.java:[10,8] interface software.amazon.awscdk.services.codebuild.ProjectProps
inherits unrelated defaults for getTimeout() from types software.amazon.awscdk.services.codebuild.StartBuildOptions
and software.amazon.awscdk.services.codebuild.CommonProjectProps

Reverting for now so we can sort the issue out and then we can re-introduce it.

----

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

simboel commented Nov 30, 2020

Thanks for the contribution @zxkane. I was about to ask if this feature could be implemented 👍

It seems like this Pull Request has been reverted by @shivlaks because of the issue in aws/jsii#2256. Will this Pull Request merged back into master after that issue has been resolved? We are eager to use the new overrides.

@shivlaks
Copy link
Contributor

@siduenho - we're working on it! the idea is to get it merged back in. we're still sorting out whether this can be resolved at the jsii level. if it cannot, I have an alternative in mind to break up the diamond dependency (probably by adding another interface). stay tuned!

@simboel
Copy link

simboel commented Jan 14, 2021

Hi @shivlaks, do you have any updates on this topic?

@shivlaks
Copy link
Contributor

@siduenho since we cannot use diamond dependencies as per the related isssue, we'll pick this back up. It will likely need another interface that doesn't duplicate any properties and to break up the diamond.

@simboel
Copy link

simboel commented Apr 16, 2021

@shivlaks are there any updates regarding this issue?

We are currently resorting to multiple CodeBuild job instances in order to compensate the missing attributes. Thus adding quite some complexity and manual work to our workflow.

@jesterhazy
Copy link
Contributor

are there any updates on this issue?

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.

[stepfunctions-tasks] complete codebuild parameters support
6 participants