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
Adds a new `gitlab` output style that wraps each task's output in GitLab
CI collapsible section markers. Section IDs are generated automatically
so that start and end markers always match and stay unique per
invocation — even when the same task runs multiple times in one job.
Options: `collapsed` (maps to GitLab's native `[collapsed=true]`) and
`error_only` (Task-level behavior, identical to `group.error_only`).
Also introduces `output-ci-auto` (taskrc + TASK_OUTPUT_CI_AUTO env var)
that auto-selects a CI-aware output style when a supported CI runner is
detected (currently `GITLAB_CI=true` → gitlab) and no output style is
explicitly configured. Keeps the Taskfile neutral so local devs are not
forced into CI-shaped output.
Refs #2806.
* feat: Colorize tasks in prefixed output
* chore: comment and style changes
* fix code tag has spaces in api reference
* fix: migrate to use logger for colors
* fix: Add bright colors to the color sequence
* fix: make colorized prefix logger standard
* refactor: move deepcopy into its own package
* feat: add generic orderedmap implementation
* refactor: implement tasks with orderedmap
* feat: implement sort flag for all task outputs
* refactor: implement vars with orderedmap
* chore: docs
* fix: linting issues
* fix: non deterministic behavior in tests
This seems to fix some of the bugs reported by issues like #114 and #190.
Seems that the standard library's os/exec package has some black magic to
detect if a writer is an actual *os.File, and some stuff are handled
differently, then.
Fixes#114Fixes#190