-
Notifications
You must be signed in to change notification settings - Fork 287
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
Add support for a pull policy that only pulls new images periodically #1368
Comments
I like this ideal of configurable intervals, but something as simple as the following might solve the 90% case:
|
I like keeping this simpler - those names sound great to me.
I'm presuming there is no way to find out when a specific image was last pulled from Docker (even ignoring alternative implementations), since:
As such, Pack CLI will have to track the state somewhere itself, which leads to the following questions:
I'm presuming this would be implemented around here: Lines 74 to 89 in 3e1f522
|
Personally, I'm all for adding new pull policies. Preferably those defined by Joe. I'm a little more hesitant with "Make this new pull policy the default.". I think we should discuss the potential of unexpected behavior for end-users. If we limit this issue and its PR to simply adding new pull policies, that's a big 👍 from me.
Agree with some other file in I wonder if it's worth considering using a proper file-based db like sqlite or if that would be overkill. (Partly trying to look forward at other features that we've thought about that might also require persistence like storing OCI annotations associated to images on the daemon).
If we had sqlite, this purging would also be trivial. :) |
@dfreilich I set this to status discussion-needed but if you have some thoughts that make this implementable please feel free to change it accordingly. |
Since it: 1. Saves ~2 seconds per integration test re-pulling an image that's already up to date. 2. Helps prevent hitting Docker Hub or ECR rate limits from duplicate (and redundant) image pulling (that counts agains the rate limit even when it's a no-op). Longer term, if Pack CLI supports a periodic pulling mode (buildpacks/pack#1368), we can switch to that, however for now this is the lesser of two evils - and in most cases Pack usage outside of `libcnb-test` will ensure that newer builder images are pulled from time to time. Fixes #306.
Since it: 1. Saves ~2 seconds per integration test re-pulling an image that's already up to date. 2. Helps prevent hitting Docker Hub or ECR rate limits from duplicate (and redundant) image pulling (that counts agains the rate limit even when it's a no-op). Longer term, if Pack CLI supports a periodic pulling mode (buildpacks/pack#1368), we can switch to that, however for now this is the lesser of two evils - and in most cases Pack usage outside of `libcnb-test` will ensure that newer builder images are pulled from time to time. See #306 for more details. See also: https://buildpacks.io/docs/tools/pack/cli/pack_config_pull-policy/ Fixes #306. GUS-W-10799284.
I think this will be a great feature to be included into pack but because of the complexity and effort of what is asking for, I will put this issues as good for mentorship and we can propose it to GSoC or LFX program in the future or if someone else from the community want to work on this we will be more than happy to guide them. |
Hi everyone, @jjbustamante @edmorley @jkutner I want to work on this issue, will need some guidance from you guys. |
Hi @Parthiba-Hazra, I was taking a look in your code but I am going to put my thoughts here first. Note 🧵 with some discussion can be found here From the slack thread
I think that if we were not supposed to pull, because we haven't reached the amount of time after the last pull, and we expect to fetch the image from the daemon, but it is not there, because the end-user deleted.
|
yeah got it. |
Description
Pack's default pull policy is
always
, which means that on everypack build
, it attempts to pull images even if they exist locally (eg the builder image, run image and any buildpacks specified viadocker://
URNs).This is great for ensuring users don't accidentally build against outdated images, however:
pack build
(even for a no-op when images are up to date)These issues are particularly problematic when running integration tests, where
pack build
will be run many times.Using the
if-not-present
pull policy (either via Pack global config, or by passing--pull-policy if-not-present
topack build
), prevents these issues, however:if-not-present
, which can mean much slower integration tests (which can be hard to spot, given the Pack stdout mentioning pulling would typically be hidden in the test runner output unless the test fails).Proposed solution
always
andif-not-present
options), that only pulls new images if the time since last pull of those images is greater than N hours/days.always
. This would (a) mean users get the performance benefit locally without having to know that the pull policy option exists, (b) reduce the boilerplate needed (and chance of forgetting to set it) in CI configs.Open questions
interval=1d
--pull-policy interval=1d
--pull-policy if-not-recent
--pull-policy if-not-pulled-recently
Describe alternatives you've considered
--pull-policy if-not-present
topack build
both locally and in CI:pack build
manually from time to time, which would pull). Doesn't help speed up manual repeatpack build
s locally when developing.--pull-policy if-not-present
topack build
only in CI:pack build
s locally when developing. Means having to add vendor-specific CI checks (eg known env vars) in integration test runners.if-not-present
:pack build
s locally when developing. Easy to forget to configure (particularly when the end user projects are owned by different users to the test runner, so less familiar with best practices).Additional context
The text was updated successfully, but these errors were encountered: