From 2c0d7f07503add0c65a7862a5827c624fe2e087e Mon Sep 17 00:00:00 2001 From: mozamimy Date: Sat, 11 May 2019 16:39:32 +0900 Subject: [PATCH] Combile Docker build and push precedure into a job --- .circleci/config.yml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e548c11..a8393b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,14 +45,7 @@ jobs: - restore_cache: key: 'v1-cargo-lock-{{ checksum "Cargo.lock"}}<<# parameters.release >>-release<>' - run: 'cargo test <<# parameters.release >>--release --locked<>' - build_docker_image: - executor: 'docker' - steps: - - 'checkout' - - setup_remote_docker: - docker_layer_caching: true - - run: 'docker build --tag mozamimy/salmon:latest --tag mozamimy/salmon:${CIRCLE_TAG:1} --tag mozamimy/salmon:${CIRCLE_SHA1} .' - push_docker_image: + build_and_push_docker_image: executor: 'docker' environment: DOCKER_USER: 'mozamimy' @@ -60,6 +53,7 @@ jobs: - 'checkout' - setup_remote_docker: docker_layer_caching: true + - run: 'docker build --tag mozamimy/salmon:latest --tag mozamimy/salmon:${CIRCLE_TAG:1} --tag mozamimy/salmon:${CIRCLE_SHA1} .' - run: 'docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}' - run: 'docker push mozamimy/salmon:latest' - run: 'docker push mozamimy/salmon:${CIRCLE_TAG:1}' @@ -104,12 +98,6 @@ workflows: ignore: '/.*/' tags: only: '/^v\d+\.\d+\.\d+/' - - build_docker_image: - filters: - branches: - ignore: '/.*/' - tags: - only: '/^v\d+\.\d+\.\d+/' - test: release: true requires: @@ -118,10 +106,9 @@ workflows: filters: tags: only: '/^v\d+\.\d+\.\d+/' - - push_docker_image: + - build_and_push_docker_image: requires: - 'test' - - 'build_docker_image' filters: branches: ignore: '/.*/'