Task: Skip / warn about empty tasks

Created on 22 Jun 2018  路  2Comments  路  Source: go-task/task

I use golang's template conditions in cmds like this:

 task1:
    cmds:
      - cmd: "{{if .RUN_TASK1}}echo Running Task 1{{end}}"

RUN_TASK1 is 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}}"
bug

Most helpful comment

Hi @Eun, and thanks for reporting this.

Yeah, I think it makes sense to skip empty commands. Fixed.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moritzheiber picture moritzheiber  路  3Comments

testautomation picture testautomation  路  4Comments

andreynering picture andreynering  路  7Comments

tommyalatalo picture tommyalatalo  路  7Comments

shrink picture shrink  路  4Comments