Skip to content

Commit

Permalink
Squashed 'tools/' changes from 74dc626b..35679ee5
Browse files Browse the repository at this point in the history
35679ee5 Merge pull request #110 from weaveworks/parallel-push-errors
3ae41b6f Remove unneeded if block
51ff31a5 Exit on first error
0faad9f7 Check for errors when pushing images in parallel

git-subtree-dir: tools
git-subtree-split: 35679ee5ff17c4edf864b7c43dc70a40337fcd80
  • Loading branch information
Marcus Cobden committed Jul 28, 2017
1 parent 1eeb4d0 commit d7a8c40
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions push-images
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,28 @@ while [ $# -gt 0 ]; do
esac
done

push_image() {
local image="$1"
docker push "${image}:${IMAGE_TAG}"
}

pids=""
for image in ${IMAGES}; do
if [[ "$image" == *"build"* ]]; then
continue
fi
echo "Will push ${image}:${IMAGE_TAG}"
push_image "${image}" &
docker push "${image}:${IMAGE_TAG}" &
pids="$pids $!"

if [ -z "$NO_DOCKER_HUB" ]; then
# remove the quey prefix and push to docker hub
docker_hub_image=${image#$QUAY_PREFIX}
docker tag "${image}:${IMAGE_TAG}" "${docker_hub_image}:${IMAGE_TAG}"
echo "Will push ${docker_hub_image}:${IMAGE_TAG}"
docker push "${docker_hub_image}:${IMAGE_TAG}"
docker push "${docker_hub_image}:${IMAGE_TAG}" &
pids="$pids $!"
fi
done

# Wait individually for tasks so we fail-exit on any non-zero return code
for p in $pids; do
wait $p
done

wait

0 comments on commit d7a8c40

Please # to comment.