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

Specify minimum required task verison. #872

Closed
sdemura opened this issue Sep 27, 2022 · 6 comments · Fixed by #1663
Closed

Specify minimum required task verison. #872

sdemura opened this issue Sep 27, 2022 · 6 comments · Fixed by #1663
Labels
type: bug Something not working as intended.

Comments

@sdemura
Copy link

sdemura commented Sep 27, 2022

While the version: key is nice to specify the Taskfile schema version, it would be nice to have some option to define a minimum required task version to run a task.

For example, a recent change introduced .ROOT_DIR, which is incredibly handy for how I leverage task for my team, but many of my devs are stumbling over that as they haven't bothered to upgrade task yet.

I propopse that in in taskfiles, the version: key be expanded to check for minimum task version.

Example:

version: 3

would be compatible with all 3.x taskfile releases, but...

version: 3.15.2

would cause task to exit non-zero if the task version isn't at least 3.15.2.

@q0rban
Copy link
Contributor

q0rban commented Aug 1, 2023

I came here looking for this feature as well.

I have a workaround that works for my use case, but it's not the prettiest:

# Specify your desired major version
version: 3

vars:
    TASK_MINOR_VERSION:
        # Store the current minor version of task in an environment variable
        sh: echo "{{.TASK_VERSION}}" | awk -F. '{print $2}'

tasks:
    default:
        preconditions:
            # Ensure we have at least version 3.28
            - sh: 'test {{.TASK_MINOR_VERSION}} -ge 28'

@q0rban
Copy link
Contributor

q0rban commented Aug 1, 2023

Note, that if you try this:

version: 3.28

You get this error:

task: Taskfile versions greater than v3.8 not implemented in the version of Task

@q0rban
Copy link
Contributor

q0rban commented Aug 9, 2023

Is this a duplicate of #796 ?

@vmaerten vmaerten added the type: bug Something not working as intended. label May 19, 2024
@q0rban
Copy link
Contributor

q0rban commented May 20, 2024

Since #796 is closed, I'd just like to note that this issue is still not fixed.

@vmaerten
Copy link
Collaborator

Hello @q0rban,
Thanks for your comment. Yes we know, I've made a PR to fix it : #1663

It'll most likely fixed in the next version

@q0rban
Copy link
Contributor

q0rban commented May 20, 2024

wonderful, thank you @vmaerten !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something not working as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants