From 54db83eef8096cb269ad985ac0e90d01c1f56ff9 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Fri, 29 Jan 2021 11:14:15 +0100 Subject: [PATCH] Make image build logs verbose if necessary The `-q` flag is not implemented by `docker buildx`, which results in an output: ``` WARN[0000] quiet currently not implemented. ``` In the same way, the build output is not logged to `stdout` (but `stderr`). This means we now dump the whole build process to a file and if the `docker buildx` command fails, then we output those logs by printing the contents of that file. This will also reduce the overall verbosity and aligns to the original `docker build` behavior. Signed-off-by: Sascha Grunert --- build/lib/release.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build/lib/release.sh b/build/lib/release.sh index 4b2855623de..8e5422d503c 100644 --- a/build/lib/release.sh +++ b/build/lib/release.sh @@ -383,12 +383,16 @@ EOF echo "COPY nsswitch.conf /etc/" >> "${docker_file_path}" fi - DOCKER_CLI_EXPERIMENTAL=enabled "${DOCKER[@]}" buildx build \ + local build_log="${docker_build_path}/build.log" + if ! DOCKER_CLI_EXPERIMENTAL=enabled "${DOCKER[@]}" buildx build \ --platform linux/"${arch}" \ --load ${docker_build_opts:+"${docker_build_opts}"} \ - -q \ -t "${docker_image_tag}" \ - "${docker_build_path}" >/dev/null + "${docker_build_path}" >"${build_log}" 2>&1; then + cat "${build_log}" + exit 1 + fi + rm "${build_log}" # If we are building an official/alpha/beta release we want to keep # docker images and tag them appropriately.