Deploy under a single repo
This commit is contained in:
Родитель
e4723e9e24
Коммит
86c02bd87b
|
@ -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}"
|
||||
|
|
Загрузка…
Ссылка в новой задаче