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

[cache-flag] Support build image cache #1457

Closed
3 tasks done
Tracked by #1077
jromero opened this issue Jun 15, 2022 · 2 comments · Fixed by #1477
Closed
3 tasks done
Tracked by #1077

[cache-flag] Support build image cache #1457

jromero opened this issue Jun 15, 2022 · 2 comments · Fixed by #1477
Assignees

Comments

@jromero
Copy link
Member

jromero commented Jun 15, 2022

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

Build cache as an image is currently only supports using cache as an image from registry which requires the final app image to be pushed to registry (The --cache-image and --publish flags need to be used together).

To add complete support for build cache as an image,
Support for scenarios will be implement -

  1. Cache image used from registry when exporting app image to docker daemon.

Support for scenarios already exists, might require a bit of modification -

  1. Cache image used from registry when exporting app image to a registry.
    • If an image is used as build cache, then it is fetched from and exported to a registry by default

Support for scenarios does not seem feasible from previous discussions, need confirmation for next steps on these -

  1. Cache image used from local docker daemon while exporting app image to registry
  2. Cache image used from local docker daemon while exporting app image to docker daemon
  • Implement the flag support based on acceptance criteria defined below

Acceptance Criteria

Image is pushed to the registry

Given the current working directory contains source code
And configured builder can build source code
When user executes 'pack build myorg/myapp:latest --cache "type=build;format=image;name=myorg/myimage:cache" --publish'
And build finishes successfully
Then 'myorg/myapp:cache' should existing in registry
And 'myorg/myapp:cache' image should contain the cached build layers

Image build cache should require --publish flag

Given the current working directory contains source code
And configured builder can build source code
When user executes 'pack build myorg/myapp:latest --cache "type=build;format=image;name=myorg/myimage:cache"'
Then the build should fail
And an error containing the following should be present:
"""
invalid cache definition: 'image' format is only acceptable with '--publish' flag.
"""
@jromero
Copy link
Member Author

jromero commented Jun 27, 2022

Add support for this kind of export to the lifecycle's export phase

Could you elaborate on this? AFAIK, we'd be leveraging the existing lifecycle functionality.

@jromero jromero changed the title Build cache as image support [cache-flag] Support build image cache Jun 27, 2022
@jromero
Copy link
Member Author

jromero commented Jun 27, 2022

Decouple --cache-image and --publish flags from pack

I think this is a little out of scope if we consider trying to solve #1024.

Could you explain the reasoning for this?

Repository owner moved this from Todo to Done in GSoC 2022: Nitish Gupta Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants