yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [yetus] branch master updated: YETUS-919. Support extra Docker build-args
Date Sat, 19 Oct 2019 17:50:07 GMT
This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/master by this push:
     new 775a961  YETUS-919. Support extra Docker build-args
775a961 is described below

commit 775a9611ddd7343662fb6034a2642fbfd94d7112
Author: Clay Baenziger <cbaenziger@bloomberg.net>
AuthorDate: Fri Oct 11 18:51:49 2019 -0400

    YETUS-919. Support extra Docker build-args
    
    Signed-off-by: Allen Wittenauer <aw@apache.org>
---
 precommit/src/main/shell/core.d/docker.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/precommit/src/main/shell/core.d/docker.sh b/precommit/src/main/shell/core.d/docker.sh
index 92515b7..e47cea4 100755
--- a/precommit/src/main/shell/core.d/docker.sh
+++ b/precommit/src/main/shell/core.d/docker.sh
@@ -31,6 +31,7 @@ DOCKER_SOCKET_GID=-1
 DOCKER_WORK_DIR="/precommit"
 
 declare -a DOCKER_EXTRAARGS
+declare -a DOCKER_EXTRABUILDARGS
 declare -a DOCKER_VERSION
 
 DOCKER_EXTRAENVS+=("JAVA_HOME")
@@ -569,6 +570,23 @@ function docker_version
   echo "${val}"
 }
 
+## @description  Queue Docker build-args to add to the docker build
+## @audience     public
+## @stability    stable
+## @replaceable  yes
+## @param        envname
+## @param        value
+function add_docker_build_arg
+{
+  declare key="$1"
+  declare value="$2"
+  if [[ -z "${value}" ]]; then
+    DOCKER_EXTRABUILDARGS+=("--build-arg" "${key}")
+  else
+    DOCKER_EXTRABUILDARGS+=("--build-arg" "${key}=${value}")
+  fi
+}
+
 ## @description  Queue env vars to add to the docker env
 ## @audience     public
 ## @stability    stable
@@ -702,6 +720,7 @@ function docker_run_image
           --label org.apache.yetus=\"\" \
           --label org.apache.yetus.testpatch.project="${PROJECT_NAME}" \
           --tag "${baseimagename}" \
+          "${DOCKER_EXTRABUILDARGS[@]}" \
           -f "${buildfile}" \
           "${dockerdir}"; then
       popd >/dev/null || return 1
@@ -744,6 +763,7 @@ function docker_run_image
     --build-arg USER_NAME="${USER_NAME}" \
     --build-arg DOCKER_SOCKET_GID="${DOCKER_SOCKET_GID}" \
     --build-arg DOCKER_WORK_DIR="${DOCKER_WORK_DIR}" \
+    "${DOCKER_EXTRABUILDARGS[@]}" \
     --label org.apache.yetus=\"\" \
     --label org.apache.yetus.testpatch.patch="tp-${DOCKER_ID}" \
     --label org.apache.yetus.testpatch.project="${PROJECT_NAME}" \


Mime
View raw message