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(toolkit): add '--reuse-asset' option #1918

Merged
merged 2 commits into from
Mar 6, 2019
Merged

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Mar 1, 2019

Reusing assets avoids rebuilding an asset and just reuses the currently
deployed one. Especially helpful for Docker containers that take a long
time to build.

Fixes #1916


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

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

Reusing assets avoids rebuilding an asset and just reuses the currently
deployed one. Especially helpful for Docker containers that take a long
time to build.

Fixes #1916
@rix0rrr rix0rrr requested a review from RomainMuller March 1, 2019 13:21
@rix0rrr rix0rrr requested a review from a team as a code owner March 1, 2019 13:21
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.

Maybe this should just be --no-build. @sam-goodwin is planning to add a distinct "build" command to the toolkit, so I envision deploy --no-build to have the effect you want with less ugliness...

@rix0rrr
Copy link
Contributor Author

rix0rrr commented Mar 4, 2019

I actually had --no-build, but yargs forces interpretation of the --no- prefix to make the thing boolean. So I had to change the name.

And ultimately, I prefer the name to be positive, so you don't have the problem with double negatives.

@eladb
Copy link
Contributor

eladb commented Mar 4, 2019

you just specify build as a boolean option with a default true. it is also common to indicate in the description to use --no-build to disable.

--build and --no-build feel much more forward looking and less a hack than the current approach.

@rix0rrr
Copy link
Contributor Author

rix0rrr commented Mar 4, 2019

So you propose to either build all assets or no assets?

Wouldn't have helped me in my case though, where I did want to update a Lambda but did not want to rebuild the Docker image.

I explicitly chose for selective control over which asset gets reused.

@rix0rrr
Copy link
Contributor Author

rix0rrr commented Mar 4, 2019

And I agree with the "hack" terminology insofar as that the id is unpredictable. What I actually wanted was to reuse/not reuse by construct path, including glob support; but the metadata didn't have the construct path and I wanted to get a fix to the pipeline out, so I opted for selecting by the identifier that was already there.

@eladb
Copy link
Contributor

eladb commented Mar 4, 2019

got it. So how about --build-exclude instead of reuse-assets? I really think the terminology should be around "build".

@rix0rrr rix0rrr merged commit 1767b61 into master Mar 6, 2019
@rix0rrr rix0rrr deleted the huijbers/reuse-assets branch March 6, 2019 10:03
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 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.

toolkit: need a way to avoid building assets
3 participants