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

flags: Add --cache flag for build cache as image #1477

Merged
merged 3 commits into from
Jul 12, 2022

Conversation

imnitishng
Copy link
Contributor

@imnitishng imnitishng commented Jul 3, 2022

Add --cache flag for configuring build and launch cache as image.

pack build --cache 'type=build;format=image;name=<image name/image registry address>'

Summary

Output

Before

After

Documentation

  • Should this change be documented?
    • Yes, see #___
    • No

Related

Resolves #1475
Resolves #1457

@imnitishng imnitishng requested a review from a team as a code owner July 3, 2022 11:55
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Jul 3, 2022
@github-actions github-actions bot added this to the 0.28.0 milestone Jul 3, 2022
@imnitishng imnitishng marked this pull request as draft July 3, 2022 11:55
@imnitishng imnitishng force-pushed the cache-flag/build-image-cache branch from b49c9d2 to 0d389f8 Compare July 3, 2022 17:59
@codecov
Copy link

codecov bot commented Jul 3, 2022

Codecov Report

Merging #1477 (c1deb54) into main (21a3f40) will increase coverage by 0.10%.
The diff coverage is 92.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1477      +/-   ##
==========================================
+ Coverage   81.28%   81.37%   +0.10%     
==========================================
  Files         151      152       +1     
  Lines        9778     9864      +86     
==========================================
+ Hits         7947     8026      +79     
- Misses       1355     1361       +6     
- Partials      476      477       +1     
Flag Coverage Δ
os_linux 80.07% <92.05%> (+0.08%) ⬆️
os_macos 77.58% <92.05%> (+0.13%) ⬆️
os_windows 81.25% <92.05%> (+0.10%) ⬆️
unit 81.37% <92.05%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@dfreilich dfreilich left a comment

Choose a reason for hiding this comment

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

Great start!

internal/cache/cache_opts_test.go Show resolved Hide resolved
@imnitishng imnitishng force-pushed the cache-flag/build-image-cache branch from 5a1ed76 to dc5a9a3 Compare July 4, 2022 17:10
@github-actions github-actions bot added the type/chore Issue that requests non-user facing changes. label Jul 4, 2022
@imnitishng imnitishng force-pushed the cache-flag/build-image-cache branch 2 times, most recently from 4545a12 to 8fe74b3 Compare July 5, 2022 16:32
Copy link
Member

@jromero jromero left a comment

Choose a reason for hiding this comment

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

Agree with @dfreilich. This is looking really good.

I'm assuming that this PR will handle issues #1457 and #1475. If so, should we update the description to reflect that?

internal/build/lifecycle_execution_test.go Outdated Show resolved Hide resolved
internal/build/lifecycle_execution.go Outdated Show resolved Hide resolved
- Add `flag` definition
- Integrate flag options with image cache
- Add tests for flag options

Signed-off-by: Nitish Gupta <imnitish.ng@gmail.com>
- Add unit and acceptance tests

Signed-off-by: Nitish Gupta <imnitish.ng@gmail.com>
@imnitishng imnitishng force-pushed the cache-flag/build-image-cache branch 4 times, most recently from 503888d to 44f55dc Compare July 6, 2022 18:56
@imnitishng imnitishng marked this pull request as ready for review July 6, 2022 19:26
@imnitishng imnitishng force-pushed the cache-flag/build-image-cache branch from 44f55dc to 9cbc4b7 Compare July 6, 2022 20:06
- Gate acceptance tests to work only when pack supports `--cache`
- string constants for cache type and cache format has been moved to enums
- Fix test cases, update acceptance test helper methods
- Add new unit tests

Signed-off-by: Nitish Gupta <imnitish.ng@gmail.com>
@imnitishng imnitishng force-pushed the cache-flag/build-image-cache branch from 9cbc4b7 to c1deb54 Compare July 6, 2022 20:18
@imnitishng imnitishng requested review from jromero and dfreilich July 6, 2022 20:28
@jromero jromero removed the type/chore Issue that requests non-user facing changes. label Jul 12, 2022
@jromero
Copy link
Member

jromero commented Jul 12, 2022

✅ Acceptance

✅ Keep existing --cache-image flag support

Screen Shot 2022-07-12 at 9 20 31 AM

Screen Shot 2022-07-12 at 9 21 25 AM

✅ Warning when no --publish flag is provided

Screen Shot 2022-07-12 at 9 27 04 AM

--cache flag creates cache image

Screen Shot 2022-07-12 at 9 22 47 AM

Screen Shot 2022-07-12 at 9 24 41 AM

✅ Cache image is used with --cache flag

Screen Shot 2022-07-12 at 9 27 54 AM

✅ Launch cache image not supported warns

image

@jromero jromero merged commit 30de289 into buildpacks:main Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[cache-flag] Warn when attempting to configure launch cache image [cache-flag] Support build image cache
3 participants