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

Proposal: Ability to run a task / included taskfile, as a distinct user #2037

Open
hugo-ricateau opened this issue Feb 3, 2025 · 1 comment

Comments

@hugo-ricateau
Copy link

hugo-ricateau commented Feb 3, 2025

Description

It would be convenient to be able to run a specific task / included taskfile, as a distinct user: e.g. when using Homebrew in a multi-user environment, it must be invoked with its "owning" user, that definitely is distinct from the current one (according to the Homebrew's recommendation in this context).
I didn't find any previous request for such feature; I hope I didn't miss it.

This can already be achieved through

version: 3

vars:
  USER:
    sh: echo ${USER:-$(whoami)}

tasks:
  target:
    cmds:
      - sudo --login --user={{.USER}} command0
      - ...
      - sudo --login --user={{.USER}} commandN

but rapidly becomes cumbersome with lots of tasks / commands; such a syntax would be of a great help for readability and maintainability:

tasks:
  target:
    as: {{.USER}}
    cmds:
      - command0
      - ...
      - commandN
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Feb 3, 2025
@pd93 pd93 removed the state: needs triage Waiting to be triaged by a maintainer. label Feb 3, 2025
@MathieM
Copy link

MathieM commented Feb 13, 2025

Would be a great feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants