Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running all tasks even on errors #1853

Open
xremming opened this issue Oct 3, 2024 · 3 comments
Open

Support running all tasks even on errors #1853

xremming opened this issue Oct 3, 2024 · 3 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@xremming
Copy link

xremming commented Oct 3, 2024

So in my use case I'm consolidating all different linters (among other things) to be ran with the Taskfile. See the snippet below for the general structure.

When running linters it would be nice to run all of them always (the same is especially true with the for loop) and once they're all ran to return an error if any of them errored. I could work around this by using longer shell scripts but I would prefer not to.

I'm thinking something like a run_all: always parameter. The default for which could be the current behaviour of stop-on-first-error.

The ignore_error works otherwise but it also ignores the error code, meaning that when the linters are ran in CI it will not cause the run to fail.

tasks:
  lint:
    deps: [lint:terraform:fmt, lint:terraform:tflint]

  lint:terraform:fmt:
    dir: infra
    cmd: "terraform fmt -check -recursive"

  lint:terraform:tflint:
    deps: [install:tflint]
    dir: infra
    vars:
      STACKS:
        sh: "echo stacks/*"
    cmd:
      for:
        var: STACKS
      cmd: "tflint --config=../../.tflint.hcl --chdir={{ .ITEM }}"
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Oct 3, 2024
@andrewimeson
Copy link

This is probably a duplicate of #1246

I posted an earlier iteration of the workaround I use on that issue.

This feature would be really nice.

@xremming
Copy link
Author

xremming commented Nov 6, 2024

The suggestion in #1246 on how to handle it seems better. So a +1 for failfast from me.

@trulede
Copy link

trulede commented Nov 12, 2024

The code suggests that:

  • deps are run in parallel, there does not seem to be any mechanism which is killing tasks, it runs them all in parallel and returns the first failing task (of all the tasks that failed).

    task/task.go

    Line 305 in 6645a1f

    func (e *Executor) runDeps(ctx context.Context, t *ast.Task) error {
  • if you use the -parallel flag and list the tasks at the CLI then those tasks will run in parallel, using the same mechanism as above

    task/task.go

    Line 133 in 6645a1f

    if e.Parallel {

@xremming If you modify your example to something people can easily run (e.g. tasks with cmds exit(0) or exit(1) and some echos) and share the CLI command you use, it might be possible to clarify the behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

4 participants