Open Kale-Ko opened 4 days ago
It looks like there is a bug in both this specific server and also in the buildkit's caching logic.
curl -X GET "https://api.adoptium.net/v3/assets/latest/8/hotspot?os=linux&architecture=x64&image_type=jdk" -H "Accept-Encoding: gzip" -v
< HTTP/2 200
< date: Sat, 23 Nov 2024 07:26:11 GMT
< content-type: application/json;charset=UTF-8
< content-length: 533
< strict-transport-security: max-age=63072000; includeSubDomains; preload
< x-content-type-options: nosniff
< x-frame-options: DENY
< cache-control: public, max-age=14400, no-transform, s-maxage=120
< etag: ce64aed9b43d2797c1129bfda324731c
< last-modified: Fri, 22 Nov 2024 15:30:28 GMT
curl -X GET "https://api.adoptium.net/v3/assets/latest/21/hotspot?os=linux&architecture=x64&image_type=jdk" -H "Accept-Encoding: gzip" -v
< HTTP/2 200
< date: Sat, 23 Nov 2024 07:26:23 GMT
< content-type: application/json;charset=UTF-8
< content-length: 552
< strict-transport-security: max-age=63072000; includeSubDomains; preload
< x-content-type-options: nosniff
< x-frame-options: DENY
< cache-control: public, max-age=14400, no-transform, s-maxage=120
< etag: ce64aed9b43d2797c1129bfda324731c
< last-modified: Fri, 22 Nov 2024 15:30:28 GMT
Note that the Etag returned by the server is exactly the same. Etag should uniquely identify the resource. HEAD
request also returns the same Etag.
From buildkit side the question is why would buildkit even compare the etag if the URL itself has a difference. Atm the full URL is not used, but only the filename component. I think this is not ideal and even if server works correctly it could just make the more potential cache lookups that are unlikely to match. Looking at this debug output, I think we could also compare content-length to detect more cases where servers are behaving incorrectly.
I checked out the source for api.adoptium.net and it is set to return the checksum of the entire "update" for every page that is cached, whatever that may be. Not sure if I should open an issue there or not.
I checked out the source for api.adoptium.net and it is set to return the checksum of the entire "update" for every page that is cached, whatever that may be.
I'm not sure what "entire update" means in here, but different etag should be returned for different content.
I checked out the source for api.adoptium.net and it is set to return the checksum of the entire "update" for every page that is cached, whatever that may be.
I'm not sure what "entire update" means in here, but different etag should be returned for different content.
Me neither, it's just pulled from some database.
Contributing guidelines
I've found a bug and checked that ...
Description
After fetching the url
https://api.adoptium.net/v3/assets/latest/8/hotspot?os=linux&architecture=x64&image_type=jdk
usingADD
in a Dockerfile, if in another Dockerfilehttps://api.adoptium.net/v3/assets/latest/21/hotspot?os=linux&architecture=x64&image_type=jdk
is fetched it will return the data from the previous url instead of from this url.Also see notes
Expected behaviour
The second ADD instruction properly fetches the second url.
Actual behaviour
The second ADD instruction incorrectly fetches the first url from cache.
Buildx version
github.com/docker/buildx v0.18.0 fa4461b9a1ec45c23d1b9e32dee0d0a8ed29900b, github.com/docker/buildx v0.17.1 257815a
Docker info
GitHub Actions:
My Comp:
Builders list
GitHub Actions:
My Comp:
Configuration
https://github.com/Kale-Ko/docker-bug-demo
Run
script.sh
Build logs
https://github.com/Kale-Ko/docker-bug-demo/commit/de76b1db5c538dd81a050e1bad8ad5ae44b72657/checks/33289867223/logs
Additional info
No response