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

feat: add a deprecation warning when running Taskfiles with a v2 schema #1199

Merged
merged 1 commit into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ name: Bug Report
about: Use this to report bugs and issues
---

> Thanks for your bug report!
>
> Before submitting this issue, please make sure the same problem was
> not already reported by someone else.
>
> Please describe the bug you're facing. Consider pasting example
> Taskfiles showing how to reproduce the problem.
<!--

Thanks for your bug report!

Before submitting this issue, please make sure the same problem was not
already reported by someone else.

Please describe the bug you're facing. Consider pasting example Taskfiles
showing how to reproduce the problem.

-->

- Task version:
- Operating System:
- Operating system:
- Experiments enabled:
16 changes: 10 additions & 6 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ name: Feature Request
about: Use this to make feature requests
---

> Describe in detail what feature do you want to see in Task.
> Give examples if possible.
>
> Please, search if this wasn't proposed before, and if this is more like an idea
> than a strong feature request, consider opening a
> [discussion](https://github.com/go-task/task/discussions) instead.
<!--

Describe in detail what feature do you want to see in Task.
Give examples if possible.

Please, search if this wasn't proposed before, and if this is more like an idea
than a strong feature request, consider opening a
[discussion](https://github.com/go-task/task/discussions) instead.

-->
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#1194 by @deviantintegral).
- Added [experiments documentation](https://taskfile.dev/experiments) to the
website (#1198 by @pd93).
- Deprecated `version: 2` schema. This will be removed in the next major release
(#1197, #1198, #1199 by @pd93).

## v3.25.0 - 2023-05-22

Expand Down
6 changes: 5 additions & 1 deletion setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ func (e *Executor) doVersionChecks() error {
*v = *e.Taskfile.Version

if v.LessThan(taskfile.V2) {
return fmt.Errorf(`task: Taskfile versions prior to v2 are not supported anymore`)
return fmt.Errorf(`task: version 1 schemas are no longer supported`)
}

if v.LessThan(taskfile.V3) {
e.Logger.Errf(logger.Yellow, "task: version 2 schemas are deprecated and will be removed in a future release\nSee https://github.com/go-task/task/issues/1197 for more details\n")
}

// consider as equal to the greater version if round
Expand Down
16 changes: 14 additions & 2 deletions task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1371,15 +1371,27 @@ func TestDynamicVariablesShouldRunOnTheTaskDir(t *testing.T) {
tt.Run(t)
}

func TestDisplaysErrorOnUnsupportedVersion(t *testing.T) {
func TestDisplaysErrorOnVersion1Schema(t *testing.T) {
e := task.Executor{
Dir: "testdata/version/v1",
Stdout: io.Discard,
Stderr: io.Discard,
}
err := e.Setup()
require.Error(t, err)
assert.Equal(t, "task: Taskfile versions prior to v2 are not supported anymore", err.Error())
assert.Equal(t, "task: version 1 schemas are no longer supported", err.Error())
}

func TestDisplaysWarningOnVersion2Schema(t *testing.T) {
var buff bytes.Buffer
e := task.Executor{
Dir: "testdata/version/v2",
Stdout: io.Discard,
Stderr: &buff,
}
err := e.Setup()
require.NoError(t, err)
assert.Equal(t, "task: version 2 schemas are deprecated and will be removed in a future release\nSee https://github.com/go-task/task/issues/1197 for more details\n", buff.String())
}

func TestShortTaskNotation(t *testing.T) {
Expand Down