refactor(ci): print hook logs into the build.log
Hooks build a surprising amount of stuff but their output is not
recorded. This frequently leads to situations where the build failed
after the main `make` command but while still technically building. So
append hooks output to the build.log. Sadly, the hooks can fail the
build so when this happen the caller needs to fail the build too. This
leads to a bit of duplication but is better than a silent exit.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I00c9f38326e27b1783413f5d374d38a54398408f
diff --git a/script/build_package.sh b/script/build_package.sh
index 645a916..d2220fd 100755
--- a/script/build_package.sh
+++ b/script/build_package.sh
@@ -114,7 +114,7 @@
[ -z "$func" ] && return 0
- echo "=== Calling hooks: $1 ==="
+ echo "=== Calling hooks: $1 ===" &>>"$build_log"
: >"$hook_env_file"
@@ -123,7 +123,7 @@
(
source "$ci_root/run_config/$config_fragment"
call_func "$func" "$config_fragment"
- )
+ ) &>>"$build_log" || fail_build
done
fi
@@ -132,7 +132,7 @@
(
source "$ci_root/run_config_tfut/$config_fragment"
call_func "$func" "$config_fragment"
- )
+ ) &>>"$build_log" || fail_build
done
fi
@@ -146,7 +146,7 @@
# Have any variables set take effect
source "$hook_env_file"
- echo "=== End calling hooks: $1 ==="
+ echo "=== End calling hooks: $1 ===" &>>"$build_log"
}
# Set a variable from within a hook