I use golang's template conditions in cmds like this:
task1:
cmds:
- cmd: "{{if .RUN_TASK1}}echo Running Task 1{{end}}"
RUN_TASK1is a environment variable
If RUN_TASK1 is not set I will get following message:
task: Failed to run task "task1": task: Task "" not found
So it might be useful to give out a warning about empty tasks, or skip them directly?
For completeness:
The current workaround is using this syntax:
task1:
cmds:
- cmd: "{{if .RUN_TASK1}}echo Running Task 1{{else}}true{{end}}"
FYI, there is another workaround as well:
task1:
cmds:
- |
set -e
{{if .RUN_TASK1}}echo Running Task 1{{end}}
Hi @Eun, and thanks for reporting this.
Yeah, I think it makes sense to skip empty commands. Fixed.
Most helpful comment
Hi @Eun, and thanks for reporting this.
Yeah, I think it makes sense to skip empty commands. Fixed.