I have a workflow which consists of 2 manual jobs. they represent different paths that the wokflow will take. one rolls changes forward and the other backward. however when one is selected the whole workflow should continue and finally mark the whole build as successful. right now its being placed on hold which causes alerts in our systems. so my question is how would I use conditions or whatever other way is possible to make sure choosing any of the manual routes would finally cause the whole workflow to succeed.
I have even tried to use regex in the done job requires statement so that it will run on either rolling-forward or rolling-backward jobs success.ie,
- done:
context:
- phdv-aws
requires:
- rolling-*
example code would be appreciated for the solution.
version: 2.1
orbs:
node-service: phdv/node-service@2.1.0
aws-cli: circleci/aws-cli@2.0.0
parameters:
terraform_version:
type: string
default: 0.12.24
executors:
node:
docker:
- image: circleci/node:12
auth:
username: $DOCKER_HUB_USERNAME
password: $DOCKER_HUB_PASSWORD
jobs:
cool-down :
executor: node
steps:
- aws-cli/install
- run: |
git clone https://github.com/farhad-taran/aws-lambda-scripts.git
- save_cache:
key: aws-lambda-scripts-v1
paths:
- aws-lambda-scripts
rolling-backward :
executor: node
steps:
- aws-cli/install
- restore_cache:
keys:
- aws-lambda-scripts-v1
- run: |
ls -l
sh ./aws-lambda-scripts/scripts/set-previous-to-full-traffic.sh FUNCTION=lambda-test ALIAS=LATEST PREVIOUS_VERSION=$(./aws-lambda-scripts/scripts/get-previous-version.sh FUNCTION=lambda-test)
rolling-forward :
executor: node
steps:
- aws-cli/install
- restore_cache:
keys:
- aws-lambda-scripts-v1
- run: |
ls -l
sh ./aws-lambda-scripts/scripts/set-latest-to-full-traffic.sh FUNCTION=lambda-test ALIAS=LATEST
done:
executor: node
steps:
- aws-cli/install
- restore_cache:
keys:
- aws-lambda-scripts-v1
- run: |
ls -l
sh ./aws-lambda-scripts/scripts/list-aliases.sh FUNCTION=lambda-test
workflows:
version: 2
all:
jobs:
- cool-down
- roll-backward:
type: approval
requires:
- cool-down
- roll-forward:
type: approval
requires:
- cool-down
- rolling-backward:
context:
- phdv-aws
requires:
- roll-backward
- rolling-forward:
context:
- phdv-aws
requires:
- roll-forward
- done:
context:
- phdv-aws
requires:
- rolling-backward
- rolling-forward