#!/bin/bash

set -e

cd ..
make docker-image DOCKER_IMAGE_TAG=$2

docker tag cilium/cilium:$2 $1/cilium/cilium:$2
docker tag cilium/cilium:$2 $1/cilium/cilium-dev:$2
docker tag cilium/operator:$2 $1/cilium/operator:$2

docker push $1/cilium/cilium:$2
docker push $1/cilium/cilium-dev:$2
docker push $1/cilium/operator:$2

cilium_git_version="$(cat GIT_VERSION)"
docker image prune -f --all --filter "label=cilium-sha=${cilium_git_version%% *}"

#!/bin/bash

set -e

cd ..
make docker-image DOCKER_IMAGE_TAG=$2

docker tag cilium/cilium:$2 $1/cilium/cilium:$2
docker tag cilium/cilium:$2 $1/cilium/cilium-dev:$2
docker tag cilium/operator:$2 $1/cilium/operator:$2

docker push $1/cilium/cilium:$2
docker push $1/cilium/cilium-dev:$2
docker push $1/cilium/operator:$2

cilium_git_version="$(cat GIT_VERSION)"

counter=0
until [ $counter -eq 10 ] || docker image prune -f --all --filter "label=cilium-sha=${cilium_git_version%% *}"; do
	((counter++))
	sleep 6
done

Add timeout to docker prune after building images
Add timeout to docker prune after building images

If other build is pruning while current builds starts the prune, prune
will fail and cause the build to fail. This change adds 10 retries in 6
seconds intervals which should be enough to prune correctly

Signed-off-by: Maciej Kwiek <33c1fdf481c8e628d4c6db7ea8dc77f49f2fa5d7@isovalent.com>
