-
-
Notifications
You must be signed in to change notification settings - Fork 766
feat: remote taskfiles (HTTP) #1152
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c8544f1
feat: remote taskfiles over http
pd93 eb24684
feat: allow insecure connections when --insecure flag is provided
pd93 1485829
feat: better error handling for fetch errors
pd93 47c8a50
fix: ensure cache directory always exists
pd93 394bfbe
fix: setup logger before everything else
pd93 6e26c19
feat: put remote taskfiles behind an experiment
pd93 74fd327
feat: --download and --offline flags for remote taskfiles
pd93 dc32ac9
feat: node.Read accepts a context
pd93 6ca7bfc
feat: experiment docs
pd93 6971bf5
chore: changelog
pd93 2e7acfe
chore: remove unused optional param from Node interface
pd93 8a2c112
chore: tidy up and generalise NewNode function
pd93 a2f2f88
fix: use sha256 in remote checksum
pd93 69871dd
feat: --download by itself will not run a task
pd93 1c93c01
feat: custom error if remote taskfiles experiment is not enabled
pd93 732fe79
refactor: BaseNode functional options and simplified FileNode
pd93 756084c
fix: use hex encoding for checksum instead of b64
pd93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| slug: /experiments/remote-taskfiles/ | ||
| --- | ||
|
|
||
| # Remote Taskfiles | ||
|
|
||
| - Issue: [#1317][remote-taskfiles-experiment] | ||
| - Environment variable: `TASK_X_REMOTE_TASKFILES=1` | ||
|
|
||
| This experiment allows you to specify a remote Taskfile URL when including a | ||
| Taskfile. For example: | ||
|
|
||
| ```yaml | ||
| version: '3' | ||
|
|
||
| include: | ||
| my-remote-namespace: https://raw.githubusercontent.com/my-org/my-repo/main/Taskfile.yml | ||
| ``` | ||
|
|
||
| This works exactly the same way that including a local file does. Any tasks in | ||
| the remote Taskfile will be available to run from your main Taskfile via the | ||
| namespace `my-remote-namespace`. For example, if the remote file contains the | ||
| following: | ||
|
|
||
| ```yaml | ||
| version: '3' | ||
|
|
||
| tasks: | ||
| hello: | ||
| silent: true | ||
| cmds: | ||
| - echo "Hello from the remote Taskfile!" | ||
| ``` | ||
|
|
||
| and you run `task my-remote-namespace:hello`, it will print the text: "Hello | ||
| from the remote Taskfile!" to your console. | ||
|
|
||
| ## Security | ||
|
|
||
| Running commands from sources that you do not control is always a potential | ||
| security risk. For this reason, we have added some checks when using remote | ||
| Taskfiles: | ||
|
|
||
| 1. When running a task from a remote Taskfile for the first time, Task will | ||
| print a warning to the console asking you to check that you are sure that you | ||
| trust the source of the Taskfile. If you do not accept the prompt, then Task | ||
| will exit with code `104` (not trusted) and nothing will run. If you accept | ||
| the prompt, the remote Taskfile will run and further calls to the remote | ||
| Taskfile will not prompt you again. | ||
| 2. Whenever you run a remote Taskfile, Task will create and store a checksum of | ||
| the file that you are running. If the checksum changes, then Task will print | ||
| another warning to the console to inform you that the contents of the remote | ||
| file has changed. If you do not accept the prompt, then Task will exit with | ||
| code `104` (not trusted) and nothing will run. If you accept the prompt, the | ||
| checksum will be updated and the remote Taskfile will run. | ||
|
|
||
| Task currently supports both `http` and `https` URLs. However, the `http` | ||
| requests will not execute by default unless you run the task with the | ||
| `--insecure` flag. This is to protect you from accidentally running a remote | ||
| Taskfile that is hosted on and unencrypted connection. Sources that are not | ||
| protected by TLS are vulnerable to [man-in-the-middle | ||
| attacks][man-in-the-middle-attacks] and should be avoided unless you know what | ||
| you are doing. | ||
|
|
||
| ## Caching & Running Offline | ||
|
|
||
| If for whatever reason, you don't have access to the internet, but you still | ||
| need to be able to run your tasks, you are able to use the `--download` flag to | ||
| store a cached copy of the remote Taskfile. | ||
|
|
||
| <!-- TODO: The following behavior may change --> | ||
|
|
||
| If Task detects that you have a local copy of the remote Taskfile, it will use | ||
| your local copy instead of downloading the remote file. You can force Task to | ||
| work offline by using the `--offline` flag. This will prevent Task from making | ||
| any calls to remote sources. | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
| [remote-taskfiles-experiment]: https://github.com/go-task/task/issues/1317 | ||
| [man-in-the-middle-attacks]: https://en.wikipedia.org/wiki/Man-in-the-middle_attack | ||
| <!-- prettier-ignore-end --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.