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

Include relative files in remote Taskfile #2096

Open
MLNW opened this issue Mar 1, 2025 · 2 comments
Open

Include relative files in remote Taskfile #2096

MLNW opened this issue Mar 1, 2025 · 2 comments
Labels
area: remote Changes related to remote taskfiles.

Comments

@MLNW
Copy link

MLNW commented Mar 1, 2025

Description

It would be awesome if a remote taskfile could include remote files as well. My use case would be this: A remote taskfile uses a script to check something. The script is a file in the same repository as the remote taskfile.

The only workarounds I can think of right now would be to either rewrite the script to be part of the taskfile (which is not recommended) or add a task that first downloads the script before executing it. The latter option comes with some complexity I would like to avoid.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Mar 1, 2025
@MLNW MLNW mentioned this issue Mar 1, 2025
16 tasks
@pbitty
Copy link
Contributor

pbitty commented Mar 1, 2025

We also have a similar use-case. We have a bunch of supporting config files and scripts that go along with our remote taskfile.
For the time being, we wrote a separate tool that reads special variables in the include and uses those to download the remote repository contents.

If it helps, I proposed a solution to this in this comment, where the git remote provider downloads the whole directory of the Taskfile instead of just the Taskfile. Then any downloaded files can be accessed relative to {{.TASKFILE_DIR}}.

@pd93 pd93 added area: remote Changes related to remote taskfiles. and removed state: needs triage Waiting to be triaged by a maintainer. labels Mar 1, 2025
@trulede
Copy link
Contributor

trulede commented Mar 1, 2025

We have associated metadata in remote repos, placed alongside a Taskfile, and with that method its possible to have a run_once task which would load that metadata, and then from that metadata have a command to download files from a list. Something with yq and xargs. That kind of thing I've suggested in #1916 ... the metadata, not your particular use case. However, much easier, would be a simple "download task" that uses yq and xargs over a multiline variable.

Much of the problem here I fear, is an underestimation of complexity. "I have a remote Taskfile that runs a script" is a fairly simple scenario to solve as things are (run the script via curl: bash <(curl -s http://mywebsite.example/myscript.txt)), but for many people that kind use case will be far more complex (better solved with a docker image - what we do).

Is Task the right way to solve that kind of problem? I'm a big fan of having the remote Taskfile run docker images defined/build in that same remote location. I can provide example if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: remote Changes related to remote taskfiles.
Projects
None yet
Development

No branches or pull requests

5 participants