From a89ee54171af060c9e061a8c7f922113c4cb6b5c Mon Sep 17 00:00:00 2001 From: intlabs Date: Mon, 23 Oct 2017 12:23:17 -0500 Subject: [PATCH] Images: add pull all images to makefile This PS adds a `pull-all-images` target to the makefile, which requires yq to operate. Change-Id: I58b871b99f48cbd636b3db66db812be3dfc1a204 --- Makefile | 3 +++ tools/gate/funcs/common.sh | 1 + tools/gate/setup_gate.sh | 1 + tools/pull-images.sh | 9 +++++++++ 4 files changed, 14 insertions(+) create mode 100755 tools/pull-images.sh diff --git a/Makefile b/Makefile index 7800e891cf..5296ca6b9c 100644 --- a/Makefile +++ b/Makefile @@ -44,4 +44,7 @@ clean: rm -f */requirements.lock -rmdir -p */charts +pull-all-images: + @./tools/pull-images.sh + .PHONY: $(EXCLUDES) $(CHARTS) diff --git a/tools/gate/funcs/common.sh b/tools/gate/funcs/common.sh index 11162c1ee7..c68769fd93 100644 --- a/tools/gate/funcs/common.sh +++ b/tools/gate/funcs/common.sh @@ -65,6 +65,7 @@ function base_install { sudo -H pip install --upgrade pip sudo -H pip install --upgrade setuptools sudo -H pip install pyyaml + sudo -H pip install yq if [ "x$SDN_PLUGIN" == "xlinuxbridge" ]; then sdn_lb_support_install diff --git a/tools/gate/setup_gate.sh b/tools/gate/setup_gate.sh index e423884d6b..b3e0aaae6d 100755 --- a/tools/gate/setup_gate.sh +++ b/tools/gate/setup_gate.sh @@ -60,6 +60,7 @@ if [ "x$INTEGRATION_TYPE" == "xlinter" ]; then helm_plugin_template_install helm_template_run else + cd ${WORK_DIR}; make pull-all-images # Setup the K8s Cluster if [ "x$INTEGRATION" == "xaio" ]; then bash ${WORK_DIR}/tools/gate/kubeadm_aio.sh diff --git a/tools/pull-images.sh b/tools/pull-images.sh new file mode 100755 index 0000000000..49aa6d9571 --- /dev/null +++ b/tools/pull-images.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -x +for CHART_DIR in ./*/ ; do + if [ -e ${CHART_DIR}values.yaml ]; then + for IMAGE in $(cat ${CHART_DIR}values.yaml | yq '.images.tags | map(.) | join(" ")' | tr -d '"'); do + docker inspect $IMAGE >/dev/null|| docker pull $IMAGE + done + fi +done