There are some cases where task: is called under cmds: and the task needs to be conditionally run. Take the following as an example:
---
version: '3'
tasks:
python:requirements:
deps:
- :install:software:python
run: once
cmds:
- task: python:requirements:poetry
- task: :{{if eq .REPOSITORY_TYPE "ansible"}}common:python:requirements:ansible{{else}}donothing{{end}}
status:
- '[[ "${container:=}" == "docker" ]]'
I'm currently getting around the issue by having a task called donothing that gets called when the task should not run. It would be nice if we could conditionally run tasks somehow. Maybe something like this:
---
version: '3'
tasks:
test:
cmds:
- task: anothertask
when:
sh: '[[ "$CONTAINER" == 'docker' ]]'
There are some cases where
task:is called undercmds:and the task needs to be conditionally run. Take the following as an example:I'm currently getting around the issue by having a task called
donothingthat gets called when the task should not run. It would be nice if we could conditionally run tasks somehow. Maybe something like this: