Makefile: Allow pulling of all images for a targeted chart

This PS brings the OSH-Infra Make inline with OSH and allows images
to be pulled on a per chart basis to the local machine.

Change-Id: Ieda89adf97140a2ad3824ff36e969bd016ccdf00
This commit is contained in:
portdirect 2017-12-12 19:05:59 -05:00
parent 1c66ca1c12
commit 64f6e66cb3
2 changed files with 16 additions and 5 deletions

View File

@ -52,6 +52,9 @@ clean:
pull-all-images:
@./tools/pull-images.sh
pull-images:
@./tools/pull-images.sh $(filter-out $@,$(MAKECMDGOALS))
dev-deploy:
@./tools/gate/devel/start.sh $(filter-out $@,$(MAKECMDGOALS))

View File

@ -15,9 +15,17 @@
# limitations under the License.
set -x
ALL_IMAGES="$(./tools/image-repo-overides.sh | \
python -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout)' | \
jq '.bootstrap.preload_images |map(.) | join(" ")' | tr -d '"')"
for IMAGE in ${ALL_IMAGES}; do
sudo -H docker inspect $IMAGE > /dev/null || sudo -H docker pull $IMAGE
if [ "x$1" == "x" ]; then
CHART_DIRS="$(echo ./*/)"
else
CHART_DIRS="$(echo ./$1/)"
fi
for CHART_DIR in ${CHART_DIRS} ; do
if [ -e ${CHART_DIR}values.yaml ]; then
for IMAGE in $(cat ${CHART_DIR}values.yaml | yq '.images.tags | map(.) | join(" ")' | tr -d '"'); do
sudo docker inspect $IMAGE >/dev/null|| sudo docker pull $IMAGE
done
fi
done