Skip to content
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

Don't log EOF error when using podman --remote build with an empty context directory. #19419

Merged
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
5 changes: 3 additions & 2 deletions pkg/bindings/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,10 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
}
defer p.Close()
_, err = p.Readdir(1)
if err != io.EOF {
if err == nil {
return nil // non empty root dir, need to return
} else if err != nil {
}
if err != io.EOF {
logrus.Errorf("While reading directory %v: %v", path, err)
}
}
Expand Down
12 changes: 12 additions & 0 deletions test/system/070-build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,18 @@ EOF
run_podman rmi -f build_test
}

@test "podman build empty context dir" {
buildcontextdir=$PODMAN_TMPDIR/emptydir
mkdir -p $buildcontextdir
containerfile=$PODMAN_TMPDIR/Containerfile
echo FROM scratch >$containerfile

run_podman build -t build_test -f $containerfile $buildcontextdir
assert "$output" !~ "EOF" "output should not contain EOF error"

run_podman rmi -f build_test
}

function teardown() {
# A timeout or other error in 'build' can leave behind stale images
# that podman can't even see and which will cascade into subsequent
Expand Down