Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion imagebuildah/stage_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2113,12 +2113,19 @@ func (s *StageExecutor) tagExistingImage(ctx context.Context, cacheID, output st
return "", nil, fmt.Errorf("getting source imageReference for %q: %w", cacheID, err)
}
options := cp.Options{
RemoveSignatures: true, // more like "ignore signatures", since they don't get removed when src and dest are the same image
RemoveSignatures: true, // more like "ignore signatures", since they don't get removed when src and dest are the same image
DestinationTimestamp: s.executor.timestamp,
}
manifestBytes, err := cp.Image(ctx, policyContext, dest, src, &options)
if err != nil {
return "", nil, fmt.Errorf("copying image %q: %w", cacheID, err)
}

// If the destination isn't container storage, then we're done and can return early
if dest.Transport().Name() != is.Transport.Name() {
return cacheID, nil, nil
}

manifestDigest, err := manifest.Digest(manifestBytes)
if err != nil {
return "", nil, fmt.Errorf("computing digest of manifest for image %q: %w", cacheID, err)
Expand Down
11 changes: 11 additions & 0 deletions tests/bud.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7856,6 +7856,17 @@ _EOF
diff "${outpath}.b" "${outpath}.c"
}

@test "build-with-timestamp-applies-to-oci-archive-with-base" {
local outpath="${TEST_SCRATCH_DIR}/timestamp-oci.tar"

run_buildah build -f <(echo 'FROM busybox') --tag=oci-archive:${outpath}.a --timestamp 0
sleep 1.1 # sleep at least 1 second, so that timestamps are incremented
run_buildah build -f <(echo 'FROM busybox') --tag=oci-archive:${outpath}.b --timestamp 0

# should be the same
diff "${outpath}.a" "${outpath}.b"
}

@test "bud-source-date-epoch-arg" {
_prefetch busybox
local timestamp=60
Expand Down