Merge pull request #8810 from hshiina/logfile
Fix podman build --logfile
This commit is contained in:
commit
06a6fd9f22
|
@ -221,7 +221,8 @@ func build(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
var logfile *os.File
|
var logfile *os.File
|
||||||
if cmd.Flag("logfile").Changed {
|
if cmd.Flag("logfile").Changed {
|
||||||
logfile, err := os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)
|
var err error
|
||||||
|
logfile, err = os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,23 @@ EOF
|
||||||
run_podman rmi -a --force
|
run_podman rmi -a --force
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman build --logfile test" {
|
||||||
|
tmpdir=$PODMAN_TMPDIR/build-test
|
||||||
|
mkdir -p $tmpdir
|
||||||
|
tmpbuilddir=$tmpdir/build
|
||||||
|
mkdir -p $tmpbuilddir
|
||||||
|
dockerfile=$tmpbuilddir/Dockerfile
|
||||||
|
cat >$dockerfile <<EOF
|
||||||
|
FROM $IMAGE
|
||||||
|
EOF
|
||||||
|
|
||||||
|
run_podman build -t build_test --format=docker --logfile=$tmpdir/logfile $tmpbuilddir
|
||||||
|
run cat $tmpdir/logfile
|
||||||
|
is "$output" ".*STEP 2: COMMIT" "COMMIT seen in log"
|
||||||
|
|
||||||
|
run_podman rmi -f build_test
|
||||||
|
}
|
||||||
|
|
||||||
function teardown() {
|
function teardown() {
|
||||||
# A timeout or other error in 'build' can leave behind stale images
|
# A timeout or other error in 'build' can leave behind stale images
|
||||||
# that podman can't even see and which will cascade into subsequent
|
# that podman can't even see and which will cascade into subsequent
|
||||||
|
|
Loading…
Reference in New Issue