Orbs are nice and all but it really is not useful if I can not call them with certain conditions.
In CircleCI 2.0 I can do shell commands to have conditional logic, but it seems with reusable Orbs, I can not use any of those conditions since it is all YAML.
Pls take a look at what Ansible did with its when condition and Jinja2 templating code.
I was trying to do some conditions on environment vars but it seems CircleCI 2.1 is just preprocessed code that converts to 2.0 code so something like
parameters:
circle-pull-request:
description: The URL of the associated pull request. If there are multiple associated pull requests, one URL is randomly chosen.
type: string
default: $CIRCLE_PULL_REQUEST
circle-tag:
description: The name of the git tag, if the current build is tagged.
type: string
default: $CIRCLE_TAG
steps:
- checkout
- when:
condition: << parameters.circle-pull-request >>
steps:
- run: |
echo "when parameters.circle-pull-request: << parameters.circle-pull-request >>"
- unless:
condition: << parameters.circle-pull-request >>
steps:
- run: |
echo "unless parameters.circle-pull-request: << parameters.circle-pull-request >>"
- when:
condition: << parameters.circle-tag >>
steps:
- run: |
echo "when parameters.circle-tag: << parameters.circle-tag >>"
- unless:
condition: << parameters.circle-tag >>
steps:
- run: |
echo "unless parameters.circle-tag: << parameters.circle-tag >>"
Will not work at all and I will always get the When conditions. This is quite sad because If I want to do something as simple as use the Slack Orb to send a notification based upon something at runtime, I have to literally copy paste the Slack Orb code into my config (which is what CircleCI processing does anyway).
CCI-I-721