Skip to content

Commit

Permalink
Fix docker push until success
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Jan 11, 2019
1 parent 847ea4e commit a128aa3
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,41 +99,41 @@ script:
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin &&
if [ "${TRAVIS_BRANCH}" == "master" ]; then
echo "Pushing latest";
docker push "${IMAGE}:${PHP}-base";
docker push "${IMAGE}:${PHP}-mods";
docker push "${IMAGE}:${PHP}-prod";
docker push "${IMAGE}:${PHP}-work";
until docker push "${IMAGE}:${PHP}-base"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-mods"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-prod"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-work"; do sleep 1; done;
elif [[ ${TRAVIS_BRANCH} =~ ^(release-[.0-9]+)$ ]]; then
echo "Pushing branch ${TRAVIS_BRANCH}";
docker tag "${IMAGE}:${PHP}-base" "${IMAGE}:${PHP}-base-${TRAVIS_BRANCH}" &&
docker tag "${IMAGE}:${PHP}-mods" "${IMAGE}:${PHP}-mods-${TRAVIS_BRANCH}" &&
docker tag "${IMAGE}:${PHP}-prod" "${IMAGE}:${PHP}-prod-${TRAVIS_BRANCH}" &&
docker tag "${IMAGE}:${PHP}-work" "${IMAGE}:${PHP}-work-${TRAVIS_BRANCH}" &&
docker push "${IMAGE}:${PHP}-base-${TRAVIS_BRANCH}";
docker push "${IMAGE}:${PHP}-mods-${TRAVIS_BRANCH}";
docker push "${IMAGE}:${PHP}-prod-${TRAVIS_BRANCH}";
docker push "${IMAGE}:${PHP}-work-${TRAVIS_BRANCH}";
until docker push "${IMAGE}:${PHP}-base-${TRAVIS_BRANCH}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-mods-${TRAVIS_BRANCH}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-prod-${TRAVIS_BRANCH}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-work-${TRAVIS_BRANCH}"; do sleep 1; done;
elif [ -n "${TRAVIS_TAG}" ]; then
echo "Pushing tag ${TRAVIS_TAG}";
docker tag "${IMAGE}:${PHP}-base" "${IMAGE}:${PHP}-base-${TRAVIS_TAG}" &&
docker tag "${IMAGE}:${PHP}-mods" "${IMAGE}:${PHP}-mods-${TRAVIS_TAG}" &&
docker tag "${IMAGE}:${PHP}-prod" "${IMAGE}:${PHP}-prod-${TRAVIS_TAG}" &&
docker tag "${IMAGE}:${PHP}-work" "${IMAGE}:${PHP}-work-${TRAVIS_TAG}" &&
docker push "${IMAGE}:${PHP}-base-${TRAVIS_TAG}";
docker push "${IMAGE}:${PHP}-mods-${TRAVIS_TAG}";
docker push "${IMAGE}:${PHP}-prod-${TRAVIS_TAG}";
docker push "${IMAGE}:${PHP}-work-${TRAVIS_TAG}";
until docker push "${IMAGE}:${PHP}-base-${TRAVIS_TAG}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-mods-${TRAVIS_TAG}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-prod-${TRAVIS_TAG}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-work-${TRAVIS_TAG}"; do sleep 1; done;
elif [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
if MY_TAG="$( git describe --exact-match "$(git rev-parse HEAD)" 2>/dev/null )"; then
echo "Pushing cron tag ${MY_TAG}";
docker tag "${IMAGE}:${PHP}-base" "${IMAGE}:${PHP}-base-${MY_TAG}" &&
docker tag "${IMAGE}:${PHP}-mods" "${IMAGE}:${PHP}-mods-${MY_TAG}" &&
docker tag "${IMAGE}:${PHP}-prod" "${IMAGE}:${PHP}-prod-${MY_TAG}" &&
docker tag "${IMAGE}:${PHP}-work" "${IMAGE}:${PHP}-work-${MY_TAG}" &&
docker push "${IMAGE}:${PHP}-base-${MY_TAG}";
docker push "${IMAGE}:${PHP}-mods-${MY_TAG}";
docker push "${IMAGE}:${PHP}-prod-${MY_TAG}";
docker push "${IMAGE}:${PHP}-work-${MY_TAG}";
until docker push "${IMAGE}:${PHP}-base-${MY_TAG}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-mods-${MY_TAG}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-prod-${MY_TAG}"; do sleep 1; done;
until docker push "${IMAGE}:${PHP}-work-${MY_TAG}"; do sleep 1; done;
fi
else
echo "Skipping push to dockerhub on normal branches";
Expand Down

0 comments on commit a128aa3

Please sign in to comment.