diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 9a1811bd87..ffa174d584 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -1023,6 +1023,7 @@ func (ic *ContainerEngine) getImageAndLabelInfo(ctx context.Context, cwd string, buildOpts.CommonBuildOpts = commonOpts buildOpts.Output = container.Image buildOpts.ContextDirectory = filepath.Dir(buildFile) + buildOpts.ReportWriter = writer if _, _, err := ic.Libpod.Build(ctx, *buildOpts, []string{buildFile}...); err != nil { return nil, nil, err } diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go index 7e18fcb7c5..fbd9f799b2 100644 --- a/test/e2e/play_build_test.go +++ b/test/e2e/play_build_test.go @@ -12,6 +12,7 @@ import ( . "github.com/containers/podman/v4/test/utils" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gexec" ) var _ = Describe("Podman play kube with build", func() { @@ -85,7 +86,10 @@ LABEL marge=mom session := podmanTest.Podman([]string{"kube", "play", "top.yaml"}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) + stdErrString := session.ErrorToString() + Expect(stdErrString).To(ContainSubstring("Getting image source signatures")) + Expect(stdErrString).To(ContainSubstring("Writing manifest to image destination")) exists := podmanTest.Podman([]string{"image", "exists", "foobar"}) exists.WaitWithDefaultTimeout() @@ -122,7 +126,10 @@ LABEL marge=mom session := podmanTest.Podman([]string{"kube", "play", "top.yaml"}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) + stdErrString := session.ErrorToString() + Expect(stdErrString).To(ContainSubstring("Getting image source signatures")) + Expect(stdErrString).To(ContainSubstring("Writing manifest to image destination")) exists := podmanTest.Podman([]string{"image", "exists", "foobar"}) exists.WaitWithDefaultTimeout() @@ -266,7 +273,10 @@ LABEL marge=mom session := podmanTest.Podman([]string{"kube", "play", "--build", "top.yaml"}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) + stdErrString := session.ErrorToString() + Expect(stdErrString).To(ContainSubstring("Getting image source signatures")) + Expect(stdErrString).To(ContainSubstring("Writing manifest to image destination")) inspect := podmanTest.Podman([]string{"container", "inspect", "top_pod-foobar"}) inspect.WaitWithDefaultTimeout() @@ -351,7 +361,10 @@ echo GOT-HERE session := podmanTest.Podman([]string{"kube", "play", "echo.yaml"}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) + stdErrString := session.ErrorToString() + Expect(stdErrString).To(ContainSubstring("Getting image source signatures")) + Expect(stdErrString).To(ContainSubstring("Writing manifest to image destination")) cid := "echo_pod-foobar" wait := podmanTest.Podman([]string{"wait", cid}) diff --git a/test/system/252-quadlet.bats b/test/system/252-quadlet.bats index 2b57e58edd..87ae039d4b 100644 --- a/test/system/252-quadlet.bats +++ b/test/system/252-quadlet.bats @@ -1412,4 +1412,70 @@ EOF run_podman rmi --ignore $(pause_image) } +# This test reproduces https://github.com/containers/podman/issues/20432 +# In order to reproduce the issue, the image in the FROM must no be available locally +# and must not have a tag. The first forces Pull and the second the resolution where the crash occurs +# Using a local registry does not work since kube play does not pass the autofile and tls-verify flags to the build +@test "quadlet - kube build from unavailable image with no tag" { + local quadlet_tmpdir=$PODMAN_TMPDIR/quadlets + + local untagged_image=quay.io/libpod/busybox + local built_image=test_image + local yaml_dir=$quadlet_tmpdir/$built_image + local build_dir=$yaml_dir/$built_image + + # Use the same directory for all quadlet files to make sure later steps access previous ones + mkdir -p $build_dir + + container_file_path=$build_dir/Containerfile + cat >$container_file_path << EOF +FROM $untagged_image +EOF + + # Create the YAMl file + pod_name="test_pod" + container_name="test" + yaml_source="$yaml_dir/build_$(random_string).yaml" + cat >$yaml_source < $quadlet_file <