Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
circle: fix pushing latest docker
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Jun 10, 2020
1 parent ef36aaf commit fc4bac4
Showing 1 changed file with 38 additions and 15 deletions.
53 changes: 38 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ workflows:
requires:
- build_binary_for_conformance
- build_docker:
latest: true
name: build_docker_main
requires:
- test
- conformance
Expand All @@ -59,6 +59,7 @@ workflows:
branches:
ignore: /.*/
- build_docker:
name: build_docker_alpine
version: ${CIRCLE_TAG/v/''}-alpine
dockerfile: Dockerfile.alpine-linux-amd64
requires:
Expand All @@ -71,6 +72,7 @@ workflows:
branches:
ignore: /.*/
- build_docker:
name: build_docker_mrb
version: ${CIRCLE_TAG/v/''}-mrb
mruby: true
dockerfile: Dockerfile.mrb-linux-amd64
Expand All @@ -84,6 +86,7 @@ workflows:
branches:
ignore: /.*/
- build_docker:
name: build_docker_edge
version: "edge"
requires:
- test
Expand All @@ -93,6 +96,7 @@ workflows:
branches:
only: "master"
- build_docker:
name: build_docker_edge_mrb
version: "edge-mrb"
mruby: true
dockerfile: Dockerfile.mrb-linux-amd64
Expand All @@ -103,6 +107,16 @@ workflows:
filters:
branches:
only: "master"
- push_latest_docker:
requires:
- build_docker_main
- build_docker_alpine
- build_docker_mrb
filters:
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
branches:
ignore: /.*/
- github_release:
requires:
- test
Expand Down Expand Up @@ -400,9 +414,6 @@ jobs:
mruby:
type: boolean
default: false
latest:
type: boolean
default: false
executor: docker
steps:
- setup_remote_docker:
Expand Down Expand Up @@ -435,18 +446,30 @@ jobs:
- run:
name: Push Docker image
command: docker push anycable/anycable-go:<<parameters.version>>
- when:
condition: <<parameters.latest>>
steps:
- run:
name: Push the latest Docker image
command: |
if [[ "${CIRCLE_TAG}" == "$(cat latest-tag.log)" ]] && [[ "${CIRCLE_BRANCH}" == "master" ]]
then
docker tag anycable/anycable-go:${CIRCLE_TAG/v/''} anycable/anycable-go:latest
docker push anycable/anycable-go:latest
fi

push_latest_docker:
executor: docker
steps:
- setup_remote_docker:
version: 18.06.0-ce
- run:
name: Login to Docker registry
command: docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
- run:
name: Pull base Docker images
command: |
docker pull anycable/anycable-go:${CIRCLE_TAG/v/''}
docker pull anycable/anycable-go:${CIRCLE_TAG/v/''}-mrb
docker pull anycable/anycable-go:${CIRCLE_TAG/v/''}-alpine
- run:
name: Pushs latest Docker image
command: |
docker tag anycable/anycable-go:${CIRCLE_TAG/v/''} anycable/anycable-go:latest
docker push anycable/anycable-go:latest
docker tag anycable/anycable-go:${CIRCLE_TAG/v/''}-mrb anycable/anycable-go:latest-mrb
docker push anycable/anycable-go:latest-mrb
docker tag anycable/anycable-go:${CIRCLE_TAG/v/''}-alpine anycable/anycable-go:latest-alpine
docker push anycable/anycable-go:latest-alpine
github_release:
executor: golang
working_directory: /tmp/dist/
Expand Down

0 comments on commit fc4bac4

Please sign in to comment.