yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sek...@apache.org
Subject yetus git commit: YETUS-217. docker fallback mode isn't reliable
Date Thu, 10 Dec 2015 17:01:18 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 76653b4a2 -> f21a7c015


YETUS-217. docker fallback mode isn't reliable

Signed-off-by: Kengo Seki <sekikn@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/f21a7c01
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/f21a7c01
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/f21a7c01

Branch: refs/heads/master
Commit: f21a7c01572528a85d17278b81fdfde987d3c04e
Parents: 76653b4
Author: Allen Wittenauer <aw@apache.org>
Authored: Wed Dec 9 20:42:34 2015 -0800
Committer: Kengo Seki <sekikn@apache.org>
Committed: Fri Dec 11 02:00:16 2015 +0900

----------------------------------------------------------------------
 precommit/core.d/docker.sh | 73 ++++++++++++++++++++++++-----------------
 precommit/test-patch.sh    | 10 ++++++
 2 files changed, 52 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/f21a7c01/precommit/core.d/docker.sh
----------------------------------------------------------------------
diff --git a/precommit/core.d/docker.sh b/precommit/core.d/docker.sh
index 6ef0d1c..0bad245 100755
--- a/precommit/core.d/docker.sh
+++ b/precommit/core.d/docker.sh
@@ -30,6 +30,10 @@ function docker_initialize
     add_footer_table "Docker" "${DOCKER_VERSION}"
   fi
 
+  if [[ "${DOCKERSUPPORT}" != true ]]; then
+    return
+  fi
+
   # turn DOCKERFAIL into a string composed of numbers
   # to ease interpretation:  123, 213, 321, ... whatever
   # some of these combos are non-sensical but that's ok.
@@ -40,36 +44,7 @@ function docker_initialize
   DOCKERFAIL=${DOCKERFAIL//fail/3}
   DOCKERFAIL=${DOCKERFAIL//[[:blank:]]/}
 
-  if [[ "${DOCKERSUPPORT}" != true ]]; then
-    return
-  fi
-
-  if [[ -n "${DOCKERFILE}" ]]; then
-    pushd "${STARTINGDIR}" >/dev/null
-    if [[ -f ${DOCKERFILE} ]]; then
-      DOCKERFILE=$(yetus_abs "${DOCKERFILE}")
-    else
-      if [[ "${DOCKERFAIL}" =~ ^1 ]]; then
-        yetus_error "ERROR: Dockerfile '${DOCKERFILE}' not found, falling back to built-in."
-        add_vote_table 0 docker "Dockerfile '${DOCKERFILE}' not found, falling back to built-in."
-        DOCKERFILE=${DOCKERFILE_DEFAULT}
-      elif [[ "${DOCKERFAIL}" =~ ^2 ]]; then
-        yetus_error "ERROR: Dockerfile '${DOCKERFILE}' not found, disabling docker."
-        add_vote_table 0 docker "Dockerfile '${DOCKERFILE}' not found, disabling docker."
-        DOCKERSUPPORT=false
-      else
-        yetus_error "ERROR: Dockerfile '${DOCKERFILE}' not found."
-        add_vote_table -1 docker "Dockerfile '${DOCKERFILE}' not found."
-        bugsystem_finalreport 1
-        cleanup_and_exit 1
-      fi
-    fi
-    popd >/dev/null
-  else
-    DOCKERFILE=${DOCKERFILE_DEFAULT}
-  fi
-
-  dockerverify
+  docker_exeverify
   if [[ $? != 0 ]]; then
     if [[ "${DOCKERFAIL}" =~ ^12
        || "${DOCKERFAIL}" =~ ^2 ]]; then
@@ -83,13 +58,49 @@ function docker_initialize
   fi
 }
 
+## @description  Verify dockerfile exists
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+## @return       exits on failure if configured
+function docker_fileverify
+{
+  if [[ ${DOCKERMODE} = false &&
+        ${DOCKERSUPPORT} = true ]]; then
+    if [[ -n "${DOCKERFILE}" ]]; then
+      pushd "${STARTINGDIR}" >/dev/null
+      if [[ -f ${DOCKERFILE} ]]; then
+        DOCKERFILE=$(yetus_abs "${DOCKERFILE}")
+      else
+        if [[ "${DOCKERFAIL}" =~ ^1 ]]; then
+          yetus_error "ERROR: Dockerfile '${DOCKERFILE}' not found, falling back to built-in."
+          add_vote_table 0 docker "Dockerfile '${DOCKERFILE}' not found, falling back to
built-in."
+          DOCKERFILE=${DOCKERFILE_DEFAULT}
+        elif [[ "${DOCKERFAIL}" =~ ^2 ]]; then
+          yetus_error "ERROR: Dockerfile '${DOCKERFILE}' not found, disabling docker."
+          add_vote_table 0 docker "Dockerfile '${DOCKERFILE}' not found, disabling docker."
+          DOCKERSUPPORT=false
+        else
+          yetus_error "ERROR: Dockerfile '${DOCKERFILE}' not found."
+          add_vote_table -1 docker "Dockerfile '${DOCKERFILE}' not found."
+          bugsystem_finalreport 1
+          cleanup_and_exit 1
+        fi
+      fi
+      popd >/dev/null
+    else
+      DOCKERFILE=${DOCKERFILE_DEFAULT}
+    fi
+  fi
+}
+
 ## @description  Verify docker exists
 ## @audience     private
 ## @stability    evolving
 ## @replaceable  no
 ## @return       1 if docker is broken
 ## @return       0 if docker is working
-function dockerverify
+function docker_exeverify
 {
   declare pathdocker
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/f21a7c01/precommit/test-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh
index 0733df7..f65f1be 100755
--- a/precommit/test-patch.sh
+++ b/precommit/test-patch.sh
@@ -62,6 +62,7 @@ function setup_defaults
 
   ALLOWSUMMARIES=true
 
+  DOCKERMODE=false
   DOCKERSUPPORT=false
   BUILD_NATIVE=${BUILD_NATIVE:-true}
 
@@ -2524,6 +2525,8 @@ function initialize
   # we need to do this BEFORE plugins initalize
   # because they may change what they do based upon
   # docker support
+  # note that docker support still isn't guaranteed
+  # to be working even after this is executed here!
   if declare -f docker_initialize >/dev/null; then
     docker_initialize
   fi
@@ -2554,6 +2557,13 @@ function initialize
 
   find_changed_files
 
+  # re-verify that our dockerfile is still there (branch switch, etc)
+  # note that there is still a chance that docker mode will be
+  # disabled from here. Plug-ins should plan appropriately!
+  if declare -f docker_fileverify >/dev/null; then
+    docker_fileverify
+  fi
+
   check_reexec
 
   determine_needed_tests


Mime
View raw message