Add when on_fail support to commands
J
Jason Pickens
I have a custom command which looks something like:
commands: diagnose_kubernetes_failure: steps: - run: minikube status - run: kubectl get namespace - run: kubectl get pods -n "${NAMESPACE}" - run: kubectl get events -n "${NAMESPACE}" - run: kubectl get pods -n "${NAMESPACE}" --field-selector=status.phase!=Running -o name | xargs -I {} kubectl logs -n "${NAMESPACE}" "{}"
I would really like to be able to do this:
jobs: test: - run: do_something - diagnose_kubernetes_failure: when: on_fail
Clearly this doesn't work and instead I have to add the when: on_fail to every step in the command.
This has also been asked on https://discuss.circleci.com/t/conditional-commands/30682.
CCI-I-1193