Skip to content

Commit 730da37

Browse files
committed
fix: don't try to tag oci-archive destinations
This stops an error when building simple `FROM xxx` images. Signed-off-by: Adam Eijdenberg <[email protected]>
1 parent f79243a commit 730da37

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

imagebuildah/stage_executor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,6 +2119,12 @@ func (s *StageExecutor) tagExistingImage(ctx context.Context, cacheID, output st
21192119
if err != nil {
21202120
return "", nil, fmt.Errorf("copying image %q: %w", cacheID, err)
21212121
}
2122+
2123+
// If the destination isn't container storage, then we're done and can return early
2124+
if dest.Transport().Name() != is.Transport.Name() {
2125+
return cacheID, nil, nil
2126+
}
2127+
21222128
manifestDigest, err := manifest.Digest(manifestBytes)
21232129
if err != nil {
21242130
return "", nil, fmt.Errorf("computing digest of manifest for image %q: %w", cacheID, err)

tests/bud.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8479,3 +8479,12 @@ _EOF
84798479
run_buildah build --layers -f $BUDFILES/from-scratch/Containerfile2 $BUDFILES/from-scratch/
84808480
assert "$output" !~ "Using cache"
84818481
}
8482+
8483+
@test "build-to-oci-archive-succeeds-with-simple-from-build-file" {
8484+
local out_file=${TEST_SCRATCH_DIR}/simple-busybox-oci.tar
8485+
8486+
run_buildah build -f <(echo 'FROM busybox') --tag=oci-archive:"${out_file}"
8487+
8488+
# confirm tar is written
8489+
stat "${out_file}"
8490+
}

0 commit comments

Comments
 (0)