Image caching fix for locally built images #1518
Merged
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.
Fixes #1516
In the scenario where this issue was discovered, it was the runtime image whose base runtime-deps image was being inspected to determine whether it had changed. So it was querying the registry the runtime-deps digest instead of accounting for the new locally built version of runtime-deps. Since runtime-deps was rebuilt then runtime should also be rebuilt. But since it had the digest from the registry and that matched what was in the image info, then it just used the cached image for runtime.
This fixes the logic by accounting for two different scenarios. In the build scenario, all base images will have either been built locally (if they are .NET base images) or pre-emptively pulled. Prior to this fix, the logic was not accounting for a locally built image at all and would always query the registry. So for build, it should check for the local image. But for the matrix generation command, there are no builds happening so it must query the registry all the time to get the digest.
Related: #1517