Improve rebuild experience, don't fail after upgrading db
authorSam <sam.saffron@gmail.com>
Thu, 26 May 2016 07:07:13 +0000 (17:07 +1000)
committerSam <sam.saffron@gmail.com>
Thu, 26 May 2016 07:07:13 +0000 (17:07 +1000)
launcher
templates/postgres.template.yml

index 36754cf5b954cdad281c110c2d5254bb9b31584d..d1f6b7846fbbb2fc9b8a7c5aff797290f94c976f 100755 (executable)
--- a/launcher
+++ b/launcher
@@ -495,9 +495,17 @@ run_bootstrap() {
 
   echo $run_command
 
-  unset FAILED
+  unset ERR
   (exec echo "$input" | $docker_path run $user_args $links "${env[@]}" -e DOCKER_HOST_IP=$docker_ip --cidfile $cidbootstrap -i -a stdin -a stdout -a stderr $volumes $image \
-     /bin/bash -c "$run_command") || FAILED="TRUE"
+    /bin/bash -c "$run_command") || ERR=$?
+
+  unset FAILED
+  # magic exit code that indicates a retry
+  if [[ "$ERR" == 77 ]]; then
+    exit 77
+  else
+    FAILED=TRUE
+  fi
 
   if [[ $FAILED = "TRUE" ]]; then
     if [[ ! -z "$DEBUG" ]]; then
index 692ceb5883863c30ab05a3e0e4ac1b2ea368810d..84d323bda69e9c9fc0ddc805911dabe8ed72301e 100644 (file)
@@ -77,12 +77,12 @@ run:
 
            if [ "$PG_MAJOR_OLD" = "9.2" ]; then
              echo Add the line: 'base_image: "samsaffron/discourse:0.1.1"'
-             echo Change: "templates/postgres.template.yml TO templates/postgres.9.2.template.yml"
+             echo 'In containers/app.yml: Change "templates/postgres.template.yml" TO "templates/postgres.9.2.template.yml"'
              echo
            fi
 
            if [ "$PG_MAJOR_OLD" = "9.3" ]; then
-             echo Change: "templates/postgres.template.yml TO templates/postgres.9.3.template.yml"
+             echo 'In containers/app.yml: Change "templates/postgres.template.yml" TO "templates/postgres.9.3.template.yml"'
              echo
            fi
 
@@ -118,7 +118,8 @@ run:
          echo
          echo Please run "./launcher bootstrap" again
          echo -------------------------------------------------------------------------------------
-         exit 1
+         # Magic exit status to denote no failure
+         exit 77
        fi
   - exec:
       cmd: