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 misses from differing commit hash leading to unnecessary builds #1018

Open
mthalman opened this issue Apr 24, 2024 · 1 comment
Open

Comments

@mthalman
Copy link
Member

There are a few Dockerfiles which are not being recognized as a cache hit to an already published version of the image.

From the build log (internal link):

Image info's Dockerfile commit: https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/507c1c3291de8f64d9592f72ae92f8f9f0b45353/src/ubuntu/22.04/coredeps/Dockerfile
Latest Dockerfile commit: https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/70a3638e31ff3f7f69a9373b0b4c06773f5eaee6/src/ubuntu/22.04/coredeps/Dockerfile
Dockerfile commits match: False
CACHE MISS
Image info's Dockerfile commit: https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/3fc5553956a6e28906d81758fc2852c6a1fd93cc/src/ubuntu/18.04/crossdeps/Dockerfile
Latest Dockerfile commit: https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/70a3638e31ff3f7f69a9373b0b4c06773f5eaee6/src/ubuntu/18.04/crossdeps/Dockerfile
Dockerfile commits match: False
CACHE MISS
Image info's Dockerfile commit: https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/507c1c3291de8f64d9592f72ae92f8f9f0b45353/src/ubuntu/22.04/coredeps/Dockerfile
Latest Dockerfile commit: https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/70a3638e31ff3f7f69a9373b0b4c06773f5eaee6/src/ubuntu/22.04/coredeps/Dockerfile
Dockerfile commits match: False
CACHE MISS

These are being detected as being different commit hashes than what Dockerfile was last used to publish. But that's false because the different commit hashes are actually pointing to the same version of the Dockerfile. For example, with that first one (https://github.com/dotnet/dotnet-buildtools-prereqs-docker/blob/70a3638e31ff3f7f69a9373b0b4c06773f5eaee6/src/ubuntu/22.04/coredeps/Dockerfile), if you go to the URL in your browser, you'll see the webpage refer to that version using the short hash of the equivalent hash:

image

It's not clear why there are differences in the values, nor why the publishing process doesn't update the image info JSON content with the value that we're detecting the file to have.

@lbussell
Copy link
Contributor

[Triage] My suspicion is that something is up with this command:
https://github.com/dotnet/docker-tools/blob/8fa03e26afbf7676865f2335c0b2f78baf5dbfe9/src/Microsoft.DotNet.ImageBuilder/src/GitHelper.cs#L43

Something must be causing it to retrieve the wrong commit. In the commit it returned, 70a3638, there were no changes to the coredeps Dockerfile.

@lbussell lbussell self-assigned this Apr 25, 2024
@lbussell lbussell removed their assignment Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Current Release
Development

No branches or pull requests

2 participants