Fix bin/kind-load for pull requests (#4222)

* Fix bin/kind-load for pull requests

Followup to #4212

External PRs were failing because:

1) The image tarballs weren't being loaded from the `images-archives`
directory
2) Concurrent calls to `bin/kind` were attempting to download the KinD
binary simultaneously, resulting in a "text file busy" error. To avoid
that, now we just call `bin/kind` synchronously one time beforehand.
This commit is contained in:
Alejandro Pedraza 2020-04-01 12:04:24 -05:00 committed by GitHub
parent 4429c1a5b1
commit 0c8171d466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -98,7 +98,6 @@ jobs:
! -name docker-retag-all \ ! -name docker-retag-all \
! -name _docker.sh \ ! -name _docker.sh \
! -name fmt \ ! -name fmt \
! -name kind-load \
! -name lint \ ! -name lint \
! -name _log.sh \ ! -name _log.sh \
! -name minikube-start-hyperv.bat \ ! -name minikube-start-hyperv.bat \

View File

@ -19,7 +19,7 @@ do
echo " # Load images from the local docker instance" echo " # Load images from the local docker instance"
echo " bin/kind-load" echo " bin/kind-load"
echo "" echo ""
echo " # Load images from tar files located in the current directory" echo " # Load images from tar files located under the 'image-archives' directory"
echo " bin/kind-load --images" echo " bin/kind-load --images"
echo "" echo ""
echo " # Retrieve images from a remote docker instance and then load them into KinD" echo " # Retrieve images from a remote docker instance and then load them into KinD"
@ -65,13 +65,18 @@ bindir=$( cd "${0%/*}" && pwd )
TAG=${TAG:-$(head_root_tag)} TAG=${TAG:-$(head_root_tag)}
# This is really to load the kind binary synchronously, before
# the parallel executions below attempt doing so
"$bindir"/kind version
rm -f load_fail rm -f load_fail
for img in proxy controller web grafana cli-bin debug cni-plugin ; do for img in proxy controller web grafana cli-bin debug cni-plugin ; do
if [ $images ]; then if [ $images ]; then
if [ "$images_host" ]; then if [ "$images_host" ]; then
DOCKER_HOST=$images_host docker save "$DOCKER_REGISTRY/$img:$TAG" > $img.tar mkdir -p image-archives
DOCKER_HOST=$images_host docker save "$DOCKER_REGISTRY/$img:$TAG" > image-archives/$img.tar
fi fi
cmd=(image-archive "$img.tar") cmd=(image-archive "image-archives/$img.tar")
else else
cmd=(docker-image "$DOCKER_REGISTRY/$img:$TAG") cmd=(docker-image "$DOCKER_REGISTRY/$img:$TAG")
fi fi