T
Task2mo ago
grumpper

Continue on error

Is there a functionality that could make a task continue execution even there is an error ? Context: I am trying taskfile to do CI checks. So I am currently doing python (pylint & bandit) & terraform (tflint & trivy) checks. I migrated the checks for each tech in an included taskfile like this:
includes:
python_tasks:
taskfile: ./tasks/python.yml
terraform_tasks:
taskfile: ./tasks/terraform.yml
includes:
python_tasks:
taskfile: ./tasks/python.yml
terraform_tasks:
taskfile: ./tasks/terraform.yml
So in each of these taskfiles each check is a separate task. For example the pylint checks can be executed as python_tasks:run_pylint, etc. Naturally I setup the default to depend on each check (example with the python taskfile):
default:
run: once
deps:
- run_pylint
- run_bandit
default:
run: once
deps:
- run_pylint
- run_bandit
Now I have the below tasks defined to triger the included ones:
tasks:
python_checks:
run: once
cmds:
- task: python_tasks:default

terraform_checks:
run: once
cmds:
- task: terraform_tasks:default

default:
run: once
deps:
- python_checks
- terraform_checks
tasks:
python_checks:
run: once
cmds:
- task: python_tasks:default

terraform_checks:
run: once
cmds:
- task: terraform_tasks:default

default:
run: once
deps:
- python_checks
- terraform_checks
So when I run the task I want all the checks to happen (regardless if one of them fails). Again example with the python tasks: if the run_pylint check fails because there are pylint findings, the run_bandit one should still execute. And the same logic for the parent taskfile: if the python_checks task fails the terraform_checks one still executes. What I have seen so far is the whole execution halts on error so even on python checks issues, the terraform checks also stop. Which defeats the whole purpose... Now I could work around all that by setting ignore_error: true on every task but then when this is all run in CI/CD everything will just exit with 0 (no matter the findings) so all tests will be marked successful (even if they weren't)... What are my options here? TL;DR: How can I make deps finish even when errors in one of them occurs?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server