Don't remove and rebuild images based on creation date #193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
(No references, this is self-contained)
What does this implement/fix? Explain your changes.
The current behavior of the SWEB harness is to rebuild images if the instance/env image's creation date is older than the env/base image's creation date. This sounds like a sensible and helpful feature, except if you consider the following workflow:
On my team we find it useful to share images with each other, for example it is useful to build once and upload env or instance images to Dockerhub, so that others can skip the build step completely and just download an image with 100% guarantee that the environment is identical. In this setup, the downloaded images have a creation date that may be some weeks old, while I might have a base image on my local machine which was built more recently. But the base image in this case is irrelevant, and I just want to use the image I've downloaded. In this scenario, if I try to run the harness, the creation date feature blocks me from being able to use my downloaded image, and the harness always forces a rebuild.
Furthermore, this print statement even tells the user
Found {len(existing_images)} existing instance images. Will reuse them.
, but it might later still silently rebuild the images without the user knowing. This has caused some confusion more than once!Overall, I think it would be cleaner to remove this behavior which makes it harder to reason about rebuilds and caching images. We can leave it to the user's responsibility to make sure their images are up-to-date.
So this PR is both an ask and a proposed implementation to remove the "rebuild if image is older" feature.
Any other comments?
If there is a strong preference to keep the feature, I think we should at least fix the part where this happens silently - the user should know if their images are being skipped and rebuilt.
Thank you!