aboutsummaryrefslogtreecommitdiff
path: root/kokoro
diff options
context:
space:
mode:
authorNathan Gauër <brioche@google.com>2023-04-03 15:27:45 +0200
committerGitHub <noreply@github.com>2023-04-03 15:27:45 +0200
commita2db3fb17b4c2c27381a20b02d192f9737ce09fc (patch)
tree0c5a9475e7e2fea5927a5b727b24c09895a6fa69 /kokoro
parent6b72fe20c5d261f9698a82742ae08d9930375981 (diff)
downloadspirv-tools-a2db3fb17b4c2c27381a20b02d192f9737ce09fc.tar.gz
kokoro: always chown files (#5186)
If the build fails, the artifacts must still be chowned so the CI can pick them up. If they are not, the CI tooling will fail and go into 'aborted' state, which blocks the logs. Signed-off-by: Nathan Gauër <brioche@google.com>
Diffstat (limited to 'kokoro')
-rw-r--r--kokoro/scripts/linux/build.sh27
1 files changed, 17 insertions, 10 deletions
diff --git a/kokoro/scripts/linux/build.sh b/kokoro/scripts/linux/build.sh
index 85d4b61a..688ba793 100644
--- a/kokoro/scripts/linux/build.sh
+++ b/kokoro/scripts/linux/build.sh
@@ -26,6 +26,18 @@ COMPILER=$2
TOOL=$3
BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
+# chown the given directory to the current user, if it exists.
+# Docker creates files with the root user - this can upset the Kokoro artifact copier.
+function chown_dir() {
+ dir=$1
+ if [[ -d "$dir" ]]; then
+ sudo chown -R "$(id -u):$(id -g)" "$dir"
+ fi
+}
+
+set +e
+# Allow build failures
+
# "--privileged" is required to run ptrace in the asan builds.
docker run --rm -i \
--privileged \
@@ -41,16 +53,11 @@ docker run --rm -i \
--env BUILD_SHA="${BUILD_SHA}" \
--entrypoint "${SCRIPT_DIR}/build-docker.sh" \
"gcr.io/shaderc-build/radial-build:latest"
+RESULT=$?
-
-# chown the given directory to the current user, if it exists.
-# Docker creates files with the root user - this can upset the Kokoro artifact copier.
-function chown_dir() {
- dir=$1
- if [[ -d "$dir" ]]; then
- sudo chown -R "$(id -u):$(id -g)" "$dir"
- fi
-}
-
+# This is important. If the permissions are not fixed, kokoro will fail
+# to pull build artifacts, and put the build in tool-failure state, which
+# blocks the logs.
chown_dir "${ROOT_DIR}/build"
chown_dir "${ROOT_DIR}/external"
+exit $RESULT