]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
osstest: save/retrieve the last successfully tested FreeBSD build
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 23 Oct 2017 13:13:30 +0000 (14:13 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 24 Oct 2017 11:04:31 +0000 (12:04 +0100)
And use it in order to install the hosts for the next FreeBSD flight.

Note that the anoints are done after the push, but there's a recovery
mechanism in case osstest manages to do a successful push, but the
artifacts are not anointed for some reason. Osstest will continue to
create flights until the revision of the anointed artifacts matches
the one pushed to the repository (even if that means running flights
with OLD_REVISION == NEW_REVISION).

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Changes since v7:
 - Add space between $freebsd_branch and * in list-prepared.

Changes since v6:
 - Use just the branch name for anoint (instead of freebsd-$branch).
 - Force the creation of flights if the revision of the current
   anoints don't match OLD_VERSION.
 - Iterate over the list of current anoints instead of open-coding the
   arches.
 - Split the retrieve/anoint code blocks into it's own sections.

Changes since v5:
 - New in this version.

cr-daily-branch

index cf00db8b4c81ebde8cd5e75ac6ae7469465e675f..d05d953a96f5b804c0ecd070197bbf9e387c2443 100755 (executable)
@@ -126,6 +126,34 @@ elif [ "x$OSSTEST_NO_BASELINE" != xy ] ; then
        fi
 fi
 
+# For convenience set a global variable with the FreeBSD branch
+# under test, so that we don't need to repeat this in several
+# places
+case "$branch" in
+freebsd-*) freebsd_branch=${branch#freebsd-} ;;
+*) freebsd_branch=master ;;
+esac
+
+case "$branch" in
+freebsd-*)
+    IFS=$'\n'
+    for anointed in \
+        `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`; do
+        # Check if the anointed version matches OLD_VERSION,
+        # or else force a new flight, even if OLD_REVISION matches
+        # NEW_REVISION.
+        flight_job=`./mg-anoint retrieve "$anointed"`
+        anointed_revision=`check_tested --flight=${flight_job%% *} \
+                                        --print-revision=$tree`
+        if [ "x$anointed_revision" != "x$OLD_REVISION" ]; then
+            skipidentical=false
+            break
+        fi
+    done
+    unset IFS
+    ;;
+esac
+
 if [ "x$REVISION_XEN" = x ]; then
         REVISION_XEN="`fetch_version $xenbranch`"
         export REVISION_XEN
@@ -261,6 +289,19 @@ ovmf)
        ;;
 esac
 
+IFS=$'\n'
+for anointed in \
+    `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`; do
+    # Retrieve previous successful FreeBSD build for each arch.
+    freebsd_arch=${anointed##* }
+    freebsd_envvar="FREEBSD_${freebsd_arch^^}_BUILDJOB"
+    if [ "x${!freebsd_envvar}" = "x" ]; then
+        flight_job=`./mg-anoint retrieve "$anointed"`
+        export ${freebsd_envvar}=${flight_job/ /.}
+    fi
+done
+unset IFS
+
 if [ "x$OLD_REVISION" = xdetermine-late ]; then
        OLD_REVISION="`\
  $AP_FETCH_PFX ./ap-fetch-version-baseline-late $branch $NEW_REVISION`"
@@ -459,6 +500,32 @@ else
         echo
 fi
 
+# Do the anoints after the push: if for some reason this fails,
+# and osstest ends up with a pushed revision that doesn't match
+# the latest anointed artifact a new flight will be run regardless
+# of whether OLD_REVISION == NEW_REVISION.
+case "$branch" in
+freebsd-*)
+    if grep '^tolerable$' $mrof >/dev/null 2>&1 && $OSSTEST_ANOINT &&
+       [ "x$OSSTEST_BLESSING" == "xreal" ]; then
+        IFS=$'\n'
+        for anointed in `./mg-anoint list-prepared \
+                                     "freebsd build $freebsd_branch *"`; do
+            # Update anointed versions
+            # NB: failure to update an anointed build for a specific arch
+            # should not be fatal, and it's not an issue if one of the
+            # arches gets slightly out of sync with the other ones.
+            freebsd_arch=${anointed##* }
+            if ./mg-anoint anoint "$anointed" \
+                           $flight build-$freebsd_arch-freebsd; then
+                echo "Anointed artifacts from build-$freebsd_arch-freebsd"
+            fi
+        done
+        unset IFS
+    fi
+    ;;
+esac
+
 if [ -f $revlog ]; then
     revlog_lines=`wc -l <$revlog`
     if [ $revlog_lines -lt 300 ]; then