1
0
mirror of https://github.com/go-task/task.git synced 2026-04-24 19:54:16 +02:00
Commit Graph

323 Commits

Author SHA1 Message Date
Valentin Maerten b8abadb4f0 🐛 fix(output): wrap gitlab sections at task level (#2806)
Previously the gitlab output wrapped each command individually, causing
two visible bugs in real GitLab pipelines:

- every section displayed a duration of 00:00, because start and end
  markers were emitted microseconds apart for instant commands
- the `task: [NAME] CMD` announcement lines were rendered outside the
  sections, because Logger.Errf bypassed the cmd-level wrapper

Fix by wrapping output at the task level via a new optional
[output.TaskWrapper] interface that GitLab implements. Task-scoped
writers are threaded via ctx so nested `task:` invocations produce
properly nested sections (GitLab supports this natively), and deps
running in parallel each get their own buffer with mutex-protected
flushes into the parent's buffer.

- `internal/output/output.go`: add TaskWrapper interface
- `internal/output/gitlab.go`: logic moved from WrapWriter to WrapTask;
  WrapWriter becomes passthrough; sync.Mutex around the buffer for
  concurrent flushes from parallel sub-task sections
- `task_output.go` (new): ctx plumbing + helpers kept out of task.go
- `task.go`: 7 lines of surgical edits — name the lambda's error
  return, wrap before the cmd loop, defer the closer with the final
  error, and swap the cmd announcement to `printCmdAnnouncement` which
  writes into the task-scoped stderr
2026-04-22 17:22:54 +02:00
Valentin Maerten f09f31c6d5 fix: skip prompting for vars when task if condition fails
Move the prompt for required variables AFTER the if condition check.
This avoids asking the user for input when the task won't run anyway.

The order in RunTask() is now:
1. FastCompiledTask
2. Check required vars early (non-interactive mode only)
3. CompiledTask (resolve dynamic vars)
4. Check if condition → exit early if false
5. Prompt for missing vars (only if task will run)
6. Validate required vars
2026-01-26 09:21:09 -03:00
Valentin Maerten 5a78808caa fix: evaluate task-level if condition after resolving dynamic variables 2026-01-26 09:21:09 -03:00
Timothy Rule f6720760b4 fix(includes): propagate silent mode from included Taskfiles to tasks (#2640) 2026-01-25 16:33:52 +01:00
Valentin Maerten 6dedcafd7d feat(vars): add interactive prompting for required variables (#2579) 2026-01-22 21:20:45 +01:00
Valentin Maerten 9bc1efbc47 feat: add conditional execution for tasks and commands (#2564) 2026-01-21 23:05:40 +01:00
Valentin Maerten 618cd8956f feat: wildcard match aliases (#2234) 2026-01-18 19:05:29 +01:00
Timothy Rule d5f071c096 fix: print prefix when task is up-to-date and output-style is prefixed (#2633) 2026-01-18 08:42:18 -03:00
Timothy Rule ea933bcc55 fix: support error_ignore for a task call (#2552) 2025-12-12 22:28:20 +01:00
Timothy Rule 89b6140166 fix: always run a watch task regardless of run setting (#2566) 2025-12-12 21:09:35 +01:00
Valentin Maerten a40ddd4949 refactor: optimize fuzzy matching with lazy initialization (#2523) 2025-12-07 21:43:26 +01:00
Andrey Nering 9b99866224 feat: add --failfast and failtest: true to control dependencies (#2525) 2025-12-07 17:23:08 -03:00
Andrey Nering 7901cce831 chore: run gofumpt 2025-11-22 18:09:50 -03:00
Andrey Nering c7b4f26900 chore: run modernize 2025-11-22 17:30:30 -03:00
Graham Dennis 94f82cbc5a fix: make task failure errors include stack of running tasks (#2286)
Previously if a task was run as a dependency of another task,
the error message simply reported something like:

    exit status 1

It is desirable instead to name the root task and all child tasks in the tree
to the failing task.

After this PR, the error message will read:

    task: Failed to run task "root": task: Failed to run task "failing-task": exit status 1
2025-11-11 16:40:40 -03:00
Timothy Rule 0052ad2309 fix: do not re-evaluate variables for defer: (#2418) 2025-11-11 15:50:01 -03:00
Valentin Maerten 15b7e3c69a refactor: VeryFastCompile for Task list (#2053) 2025-11-02 17:25:07 +01:00
Valentin Maerten 48039be12c feat: improve fingerprint, run and output with wildcard (#1808) 2025-09-11 19:33:53 +02:00
Andrey Nering 8a43ca5d8f chore: move away from deprecated func 2025-07-07 10:14:50 -03:00
Pete Davison 13daa6dc35 feat: formatting with golangci-lint and gci 2025-04-27 22:28:42 +00:00
Valentin Maerten 7169bf6434 fix: interpolate vars in defer (#2173) 2025-04-21 13:43:20 -03:00
Pete Davison dd8daa68cd feat: allow wildcards to match multiple tasks (#2121)
* feat: allow wildcards to match multiple tasks

* docs: improved wildcard section
2025-03-26 22:17:27 +00:00
Pete Davison ffeb3bcc3f refactor: executor functional options (#2085)
* refactor: executor functional options

* refactor: minor tidy up of list code

* fix: WithVersionCheck missing from call to NewExecutor

* feat: docstrings for structs with functional options

* refactor: prefix the functional options with the name of the struct they belong to
2025-03-10 20:38:25 +00:00
Pete Davison 60c8ee0ce6 refactor: ast.Call should be in main task package (#2084) 2025-02-23 18:30:42 +00:00
Pete Davison daf39a04bf feat: iterators (#1798)
* feat: update to github.com/elliotchance/orderedmap/v3

* refactor: better sort package

* feat: iterators

* chore: remove unnecessary code
2025-02-22 16:22:03 +00:00
Valentin Maerten 80f96d67da fix: requires allowed values works with dynamic var (#2033) 2025-02-08 17:29:36 +01:00
Lea Anthony 69f5714e45 fix: disable version check for use as an external library
Closes #1938
2025-01-18 10:26:58 -03:00
Andrey Nering 43f3dcea05 chore(requires): skip unneeded variable evaluation for requires (#1976) 2024-12-30 18:27:16 -03:00
Pete Davison 2965841eb7 feat: use external package for ordered maps (#1797) 2024-12-30 17:54:36 +00:00
Valentin Maerten d64df3f9d7 fix: evaluate requires before compiled task (#1962) 2024-12-30 10:15:17 +01:00
Matheus Mina 5581954fb1 feat: allow providing single or multi prompts (#1866)
* Add new type to handle single or multi prompts

* update docs

* apply review
2024-10-29 13:37:03 +00:00
Valentin Maerten 5eaf0b2dcd fix: interpolate dynamic vars in defer (#1818) 2024-09-19 08:22:39 -04:00
Valentin Maerten 1bf850592c fix: interpolate vars in defer (#1814)
Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>
2024-09-18 22:17:53 -03:00
Andrey Nering b259edeb65 feat(defer): expose EXIT_CODE special variable to defer: (#1762)
Co-authored-by: Dor Sahar <dorsahar@icloud.com>
2024-08-14 22:53:14 -03:00
Pete Davison 5e9851f42f Update minimum go version (#1758)
* feat: update minimum version to 1.22

* refactor: use int range iterator

* refactor: loop variables

* refactor: replace slicesext.FirstNonZero with cmp.Or

* refactor: use slices.Concat instead of append

* fix: unused param

* fix: linting
2024-08-14 08:37:05 -05:00
Valentin Maerten 830b745112 feat(remote): global tempDir when the path is absolute (#1661)
* feat(remote): global tempDir is the path is absolute

* --wip-- [skip ci]

* fix lint

* rename checksum to fingerprint

* chore: Empty-Commit to trigger CI

* feat: add TASK_REMOTE_DIR

* handle relative path for TASK_REMOTE_DIR

* Remove unneedded extra blank lines

Co-authored-by: Andrey Nering <andrey@nering.com.br>

* add docs about TASK_REMOTE_DIR

---------

Co-authored-by: Andrey Nering <andrey@nering.com.br>
2024-06-28 17:01:11 +01:00
Pete Davison 7535467f45 fix: prompt check shouldn't run if dry flag is true 2024-05-15 21:32:33 -03:00
Pete Davison 3e5cd6cdfd fix: prompt check should come after preconditions and fingerprinting 2024-05-15 21:32:33 -03:00
Pete Davison 08a888dc8a feat: parse templates in collection-type variables (#1526)
* refactor: replacer

* feat: move traverser to deepcopy package

* feat: nested map variable templating

* refactor: ReplaceVar function

* feat: test cases

* fix: TraverseStringsFunc copy value instead of pointer
2024-03-10 17:11:07 +00:00
Pete Davison d30539c17e refactor: move flags into their own package (#1521)
* feat: move flags to their own package

* refactor: move flag validation into flags package
2024-02-29 00:12:19 +00:00
Pete Davison 38a06dad8e feat: error when multiple wildcard matches are found 2024-02-22 14:58:24 -06:00
Pete Davison 1ef5cf71d0 feat: pass ast.Call by reference 2024-02-22 14:58:24 -06:00
Pete Davison 8d0754af4d feat: go 1.21 2024-02-17 23:29:49 -03:00
Pete Davison 42af0fc791 feat: invert call.Direct (#1459) 2024-01-10 21:32:49 -03:00
Pete Davison 247c2586c2 refactor: taskfile/ast package (#1450)
* refactor: ast package

* feat: read -> taskfile

* refactor: taskfile.Taskfile -> taskfile.Read

* refactor: move merge function back into taskfile package

* refactor: rename taskfile.go to read.go
2023-12-29 20:32:03 +00:00
Pete Davison 2b67d05b9d feat: remove v2 support (#1447)
* feat: remove v2 support

* docs: update v2 schema docs
2023-12-29 20:26:02 +00:00
Pete Davison 7feceeae87 fix: handle errors when sh is used in Taskfiles with the any variables experiment enabled 2023-12-20 19:55:25 -06:00
Pete Davison 546a4d7e46 feat: prefer remote taskfiles over cached ones (#1345)
* feat: prefer remote taskfiles over cached ones

* feat: implemented cache on network timeout

* feat: --download always downloads, but never executes tasks

* feat: --timeout flag

* fix: bug with timeout error handling

* chore: changelog
2023-11-17 14:51:10 -06:00
Andrey Nering b681ef9868 fix(platforms): do not run dynamic vars for other platforms (#1377) 2023-10-22 00:42:26 +00:00
Juan Ignacio Donoso 05755f3a52 fix: templates on task descriptions (#1343) 2023-10-07 18:57:14 -03:00