diff mbox

[v7,20/20] osstest: save/retrieve the last successfully tested FreeBSD build

Message ID 20170725150032.9225-6-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné July 25, 2017, 3 p.m. UTC
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>
---
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 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

Comments

Ian Jackson July 25, 2017, 3:18 p.m. UTC | #1
Roger Pau Monne writes ("[PATCH v7 20/20] osstest: save/retrieve the last successfully tested FreeBSD build"):
> And use it in order to install the hosts for the next FreeBSD flight.
...
> +case "$branch" in
> +freebsd-*)
> +    IFS=$'\n'

That's quite brave, but I don't object.  I would have piped the output
into `read' or something.

> +    for anointed in \> +        `./mg-anoint list-prepared "freebsd build $freebsd_branch*"`; do
                                                                    ^
I think there is a missing space between $freebsd_branch and * ?

> +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

LGTM apart from the same missing space.

So if you add those spaces:

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Ian.
Roger Pau Monné July 25, 2017, 3:37 p.m. UTC | #2
On Tue, Jul 25, 2017 at 04:18:52PM +0100, Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH v7 20/20] osstest: save/retrieve the last successfully tested FreeBSD build"):
> > And use it in order to install the hosts for the next FreeBSD flight.
> ...
> > +case "$branch" in
> > +freebsd-*)
> > +    IFS=$'\n'
> 
> That's quite brave, but I don't object.  I would have piped the output
> into `read' or something.

Yes, I think that would be better, let me do that as a patch on top of
this afterwards. I'm currently building the new images and I cannot
play freely with osstest ATM.

> > +    for anointed in \> +        `./mg-anoint list-prepared "freebsd build $freebsd_branch*"`; do
>                                                                     ^
> I think there is a missing space between $freebsd_branch and * ?
> 
> > +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
> 
> LGTM apart from the same missing space.
> 
> So if you add those spaces:
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Thanks, I've now pushed this (also with the other acks) to:

git://xenbits.xen.org/people/royger/osstest.git freebsd_v8

Roger.
diff mbox

Patch

diff --git a/cr-daily-branch b/cr-daily-branch
index af17ad20..d74f9c33 100755
--- a/cr-daily-branch
+++ b/cr-daily-branch
@@ -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
@@ -277,6 +305,19 @@  freebsd)
 	;;
 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`"
@@ -476,6 +517,33 @@  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 \
+                           "freebsd build $freebsd_branch $freebsd_arch" \
+                           $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