This commit is contained in:
Mike Cooper 2018-08-28 10:02:11 -07:00
Родитель e4723e9e24
Коммит 86c02bd87b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9424CEA6F89AB334
2 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -35,13 +35,13 @@ jobs:
- run:
name: Build
command: docker build -t mozilla/ci-base-<< parameters.imageName >> << parameters.imageName >>/
command: docker build -t << parameters.imageName >> << parameters.imageName >>/
- run:
name: Deploy
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./bin/push-image.sh mozilla/ci-base-<< parameters.imageName >>
./bin/push-image.sh << parameters.imageName >>
fi
workflows:

Просмотреть файл

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eu
image=$1
name=$1
# Usage: retry MAX CMD...
# Retry CMD up to MAX times. If it fails MAX times, returns failure.
@ -20,10 +20,17 @@ function retry() {
return 0
}
echo "$DOCKER_PASS" | docker login --username="$DOCKER_USER" --password-stdin
echo "${DOCKER_PASS}" | docker login --username="${DOCKER_USER}" --password-stdin
versioned="${image}:latest"
docker tag "${image}" "${versioned}" || (echo "Couldn't re-tag ${image} as ${versioned}" && false)
retry 3 docker push "${versioned}" || (echo "Couldn't push ${versioned}" && false)
source_image="${name}"
version="$(date -Idate)" # Format like "2018-08-27"
versioned_image="${DOCKERHUB_REPO}:${name}-${version}"
latest_image="${DOCKERHUB_REPO}:${name}-latest"
echo "Pushed ${versioned}"
docker tag "${source_image}" "${versioned_image}" || (echo "Couldn't re-tag ${image} as ${latest_image}" && false)
retry 3 docker push "${versioned_image}" || (echo "Couldn't push ${versioned_image}" && false)
echo "Pushed ${versioned_image}"
docker tag "${source_image}" "${latest_image}" || (echo "Couldn't re-tag ${image} as ${latest_image}" && false)
retry 3 docker push "${latest_image}" || (echo "Couldn't push ${latest_image}" && false)
echo "Pushed ${latest_image}"