]> git.ipfire.org Git - people/ms/nightly-builds.git/commitdiff
build.sh: Retry the build when source could not be loaded
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Apr 2020 14:53:01 +0000 (14:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Apr 2020 14:53:01 +0000 (14:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
build.sh

index 701652d837df4755669717e96a37ea818519ec3f..db8b738c59aaaedb4340fd78d06cf67b8366ba70 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -111,9 +111,12 @@ build() {
                branch=$(git branch -r | awk -F/ '{ print $NF }' | grep ^core | sort --version-sort | tail -n1)
        fi
 
-       # If the branch was not updated, we won't build
        local commit_new="$(git rev-parse origin/${branch})"
-       [ "${commit_old}" = "${commit_new}" ] && return 2
+
+       # If the branch was not updated, we won't build
+       if [ ! -e "${dir}/.force-build" ] && [ "${commit_old}" = "${commit_new}" ]; then
+               return 2
+       fi
 
        local current_branch="$(git rev-parse --abbrev-ref HEAD)"
        if [ "${current_branch}" != "${branch}" ]; then
@@ -134,14 +137,13 @@ build() {
                local build="${build_path}/${target}"
                local status="failed"
 
-               # Ready for build
-               ./make.sh --target="${target}" clean
-
-               # Download the toolchain if required
-               ./make.sh --target="${target}" gettoolchain || continue
-
-               # Download all sources
-               ./make.sh --target="${target}" downloadsrc || continue
+               # Ready for build: Download toolchain and sources
+               for action in clean gettoolchain downloadsrc; do
+                       if ! ./make.sh --target="${target}" "${action}"; then
+                               touch "${dir}/.force-build"
+                               continue
+                       fi
+               done
 
                # Execute the build
                mkdir -p "${build}"
@@ -162,14 +164,14 @@ build() {
                fi
                mv -v log/ "${build}"
 
-               # Cleanup the build environment
-               ./make.sh --target="${target}" clean
-
                # Upload the result
                sync
 
                # Send an email notification
                send_email "${status}" "${target}" "${branch}" "${commit_new}" "${build}"
+
+               # Cleanup the build environment
+               ./make.sh --target="${target}" clean
        done
 
        popd