Hi, I have a CircleCI 2.0 config which does the following:
- On git tag
web_1.2.3
it builds a “web” Docker image, tags it1.2.3
and pushes it to Docker. - On git tag
dockerbase_2.3.4
, tags it2.3.4
and pushes it to docker
I’d like to extend it to deploy the web image, but only if the user clicks the “approve” button.
I’m trying to create a workflow for this, but it doesn’t work as a workflow, it just keeps appearing as “build_web” job. It runs the build_web part but then doesn’t ask for deploy approve / hold.
How can I combine git tag based builds with hold/approve workflow?
version: 2
jobs:
build_dockerbase:
docker:
- image: circleci/python:3.7
steps:
- checkout
- setup_remote_docker
- run: echo 'export TAG="${CIRCLE_TAG#dockerbase_}"' >> $BASH_ENV
# .... build dockerbase image
build_web:
docker:
- image: circleci/python:3.7
steps:
- checkout
- setup_remote_docker
- run: echo 'export TAG="${CIRCLE_TAG#web_}"' >> $BASH_ENV
# ... build web image
deploy_web:
docker:
- image: circleci/python:3.7
steps:
- run: echo 'export TAG="${CIRCLE_TAG#web_}"' >> $BASH_ENV
# deploy web
workflows:
version: 2
tagged_dockerbase:
jobs:
- build_dockerbase:
filters:
branches:
ignore: /.*/
tags:
only: /^dockerbase_\d+\.\d+\.\d+$/
build_deploy_web:
jobs:
- build_web:
filters:
branches:
ignore: /.*/
tags:
only: /^web_\d+\.\d+\.\d+$/
- hold_web:
type: approval
requires:
- build_web
- deploy_web:
type: approval
requires:
- hold_web