Skip to content

Commit

Permalink
Specify format to buildah before commit
Browse files Browse the repository at this point in the history
If user specifies commit --format, we were not setting it before
commit, this caused warning messages that made no sense to be
printed that made no sense.

Fixes: containers#17773

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Apr 20, 2023
1 parent e74a408 commit 81621ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions libpod/container_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
PreferredManifestType: options.PreferredManifestType,
}
importBuilder, err := buildah.ImportBuilder(ctx, c.runtime.store, builderOptions)
importBuilder.Format = options.PreferredManifestType
if err != nil {
return nil, err
}
Expand Down
13 changes: 13 additions & 0 deletions test/system/010-images.bats
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,17 @@ Deleted: $pauseID"
is "$output" "" "Should print no output"
}

@test "podman images - commit docker with comment" {
run_podman run --name my-container -itd $IMAGE sleep 1d
run_podman 125 commit -m comment my-container my-test-image
assert "$output" == "Error: messages are only compatible with the docker image format (-f docker)" "podman should fail unless docker format"
run_podman commit my-container --format docker -m comment my-test-image
run_podman commit -q my-container --format docker -m comment my-test-image
assert "$output" =~ "^[0-9a-f]{64}\$" \
"Output is a commit ID, no warnings or other output"

run_podman rmi my-test-image
run_podman rm my-container --force -t 0
}

# vim: filetype=sh

0 comments on commit 81621ce

Please sign in to comment.