From c8e1c948563eb1215c2e9cf24326b60801e5122e Mon Sep 17 00:00:00 2001 From: Ashish Amarnath Date: Mon, 8 Jul 2019 19:02:39 -0700 Subject: [PATCH 1/3] add verify-docker-build to pre-submit tests Signed-off-by: Ashish Amarnath --- hack/verify-all.sh | 6 ++++++ hack/verify-docker-build.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 hack/verify-docker-build.sh diff --git a/hack/verify-all.sh b/hack/verify-all.sh index 1bd5a11d4f92..87bad47d9958 100755 --- a/hack/verify-all.sh +++ b/hack/verify-all.sh @@ -83,6 +83,12 @@ if [[ "${VERIFY_BUILD:-true}" == "true" ]]; then cd "${REPO_PATH}" fi +if [[ "${VERIFY_DOCKER_BUILD:-true}" == "true" ]]; then + echo "[*] Verifying capd-manager docker image build..." + hack/verify-docker-build.sh || res=1 + cd "${REPO_PATH}" +fi + # exit based on verify scripts if [[ "${res}" = 0 ]]; then echo "" diff --git a/hack/verify-docker-build.sh b/hack/verify-docker-build.sh new file mode 100755 index 000000000000..48657482d7b0 --- /dev/null +++ b/hack/verify-docker-build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +# shellcheck source=/dev/null +source "$(dirname "$0")/utils.sh" + +# check if manager docker image builds +cd_root_path + +docker build --file Dockerfile -t capd-manager:pr-verify . From 03e8b1c6864bcf24b245a0beea9b575549827004 Mon Sep 17 00:00:00 2001 From: Ashish Amarnath Date: Mon, 8 Jul 2019 19:37:01 -0700 Subject: [PATCH 2/3] debug --- hack/verify-docker-build.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hack/verify-docker-build.sh b/hack/verify-docker-build.sh index 48657482d7b0..1d3fb60f338c 100755 --- a/hack/verify-docker-build.sh +++ b/hack/verify-docker-build.sh @@ -23,4 +23,23 @@ source "$(dirname "$0")/utils.sh" # check if manager docker image builds cd_root_path +# DEBUG CODE BEGIN +service docker start +# the service can be started but the docker socket not ready, wait for ready +WAIT_N=0 +MAX_WAIT=5 +while true; do + # docker ps -q should only work if the daemon is ready + docker ps -q > /dev/null 2>&1 && break + if [[ ${WAIT_N} -lt ${MAX_WAIT} ]]; then + WAIT_N=$((WAIT_N+1)) + echo "Waiting for docker to be ready, sleeping for ${WAIT_N} seconds." + sleep ${WAIT_N} + else + echo "Reached maximum attempts, not waiting any longer..." + break + fi +done +# DEBUG CODE END + docker build --file Dockerfile -t capd-manager:pr-verify . From 8d71b835e2cdfa865bcb00544141558fee745602 Mon Sep 17 00:00:00 2001 From: Ashish Amarnath Date: Wed, 10 Jul 2019 10:56:02 -0700 Subject: [PATCH 3/3] revert debug code Signed-off-by: Ashish Amarnath --- hack/verify-docker-build.sh | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/hack/verify-docker-build.sh b/hack/verify-docker-build.sh index 1d3fb60f338c..48657482d7b0 100755 --- a/hack/verify-docker-build.sh +++ b/hack/verify-docker-build.sh @@ -23,23 +23,4 @@ source "$(dirname "$0")/utils.sh" # check if manager docker image builds cd_root_path -# DEBUG CODE BEGIN -service docker start -# the service can be started but the docker socket not ready, wait for ready -WAIT_N=0 -MAX_WAIT=5 -while true; do - # docker ps -q should only work if the daemon is ready - docker ps -q > /dev/null 2>&1 && break - if [[ ${WAIT_N} -lt ${MAX_WAIT} ]]; then - WAIT_N=$((WAIT_N+1)) - echo "Waiting for docker to be ready, sleeping for ${WAIT_N} seconds." - sleep ${WAIT_N} - else - echo "Reached maximum attempts, not waiting any longer..." - break - fi -done -# DEBUG CODE END - docker build --file Dockerfile -t capd-manager:pr-verify .