-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix content not found with push=true,rewrite-timestamp=true
#5008
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6882,6 +6882,7 @@ func testReproSourceDateEpoch(t *testing.T, sb integration.Sandbox) { | |
dockerfile string | ||
files []fstest.Applier | ||
expectedDigest string | ||
noCacheExport bool | ||
} | ||
testCases := []testCase{ | ||
{ | ||
|
@@ -6909,6 +6910,14 @@ COPY --link foo foo | |
files: []fstest.Applier{fstest.CreateFile("foo", []byte("foo"), 0600)}, | ||
expectedDigest: "sha256:9f75e4bdbf3d825acb36bb603ddef4a25742afb8ccb674763ffc611ae047d8a6", | ||
}, | ||
{ | ||
// https://github.com/moby/buildkit/issues/4793 | ||
name: "NoAdditionalLayer", | ||
dockerfile: `FROM amd64/debian:bullseye-20230109-slim | ||
`, | ||
expectedDigest: "sha256:eeba8ef81dec46359d099c5d674009da54e088fa8f29945d4d7fb3a7a88c450e", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we get these digests computed with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't know the manifest digest until building it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, you need to know the contents of the manifest if you know its digest here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is not specific to this PR and can be revisited in a separate issue/PR? |
||
noCacheExport: true, // "skipping cache export for empty result" | ||
}, | ||
} | ||
|
||
// https://explore.ggcr.dev/?image=amd64%2Fdebian%3Abullseye-20230109-slim | ||
|
@@ -6968,7 +6977,10 @@ COPY --link foo foo | |
require.NoError(t, err) | ||
|
||
desc, manifest, img := readImage(t, ctx, target) | ||
_, cacheManifest, _ := readImage(t, ctx, target+"-cache") | ||
var cacheManifest ocispecs.Manifest | ||
if !tc.noCacheExport { | ||
_, cacheManifest, _ = readImage(t, ctx, target+"-cache") | ||
} | ||
t.Log("The digest may change depending on the BuildKit version, the snapshotter configuration, etc.") | ||
require.Equal(t, tc.expectedDigest, desc.Digest.String()) | ||
|
||
|
@@ -6986,9 +6998,11 @@ COPY --link foo foo | |
require.Equal(t, fmt.Sprintf("%d", tm.Unix()), l.Annotations["buildkit/rewritten-timestamp"]) | ||
} | ||
} | ||
// Cache layers must *not* have rewritten-timestamp | ||
for _, l := range cacheManifest.Layers { | ||
require.Empty(t, l.Annotations["buildkit/rewritten-timestamp"]) | ||
if !tc.noCacheExport { | ||
// Cache layers must *not* have rewritten-timestamp | ||
for _, l := range cacheManifest.Layers { | ||
require.Empty(t, l.Annotations["buildkit/rewritten-timestamp"]) | ||
} | ||
} | ||
|
||
// Build again, after pruning the base image layer cache. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the context behind removing this condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment seems outdated and the CI has no complaint on removing the code