-
-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add git remote task provider (#4233)
## Description Add a git remote task provider This provider handle ssh and https generic format Specific patterns like github or bitbucket are not translated because the ROI is too low and add useless complex code. User must define a generic url with path --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ba43871
commit 1bf4a0f
Showing
15 changed files
with
633 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -334,13 +334,47 @@ file = 'scripts/release.sh' # execute an external script | |
|
||
### Remote tasks | ||
|
||
Task files can be fetched via http: | ||
Task files can be fetched remotely with multiple protocols: | ||
|
||
#### HTTP | ||
|
||
```toml | ||
[tasks.build] | ||
file = "https://example.com/build.sh" | ||
``` | ||
|
||
Please note that the file will be downloaded and executed. Make sure you trust the source. | ||
|
||
#### Git <Badge type="warning" text="experimental" /> | ||
|
||
::: code-group | ||
|
||
```toml [ssh] | ||
[tasks.build] | ||
file = "git::ssh://[email protected]:myorg/example.git//myfile?ref=v1.0.0" | ||
``` | ||
|
||
```toml [https] | ||
[tasks.build] | ||
file = "git::https://github.com/myorg/example.git//myfile?ref=v1.0.0" | ||
``` | ||
|
||
::: | ||
|
||
Url format must follow these patterns `git::<protocol>://<url>//<path>?<ref>` | ||
|
||
Required fields: | ||
|
||
- `protocol`: The git repository URL. | ||
- `url`: The git repository URL. | ||
- `path`: The path to the file in the repository. | ||
|
||
Optional fields: | ||
|
||
- `ref`: The git reference (branch, tag, commit). | ||
|
||
#### Cache | ||
|
||
Each task file is cached in the `MISE_CACHE_DIR` directory. If the file is updated, it will not be re-downloaded unless the cache is cleared. | ||
|
||
:::tip | ||
|
This file contains 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 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,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
cargo init --name hello_cargo | ||
|
||
################################################################################# | ||
# Test remote tasks with no ref | ||
################################################################################# | ||
|
||
cat <<EOF >mise.toml | ||
[tasks.remote_lint_https_latest] | ||
file = "git::https://github.com/jdx/mise.git//xtasks/lint/clippy" | ||
EOF | ||
|
||
assert_contains "mise tasks" "remote_lint_https_latest" | ||
assert_succeed "mise run remote_lint_https_latest" # Remote task should be downloaded | ||
|
||
mise cache clear # Clear cache to force redownload | ||
|
||
assert_succeed "MISE_TASK_REMOTE_NO_CACHE=true mise run remote_lint_https_latest" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_https_latest --no-cache" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_https_latest" # Cache should be used | ||
|
||
################################################################################# | ||
# Test remote tasks with with ref | ||
################################################################################# | ||
|
||
cat <<EOF >mise.toml | ||
[tasks.remote_lint_https_ref] | ||
file = "git::https://github.com/jdx/mise.git//xtasks/lint/clippy?ref=v2025.1.17" | ||
EOF | ||
|
||
assert_contains "mise tasks" "remote_lint_https_ref" | ||
assert_succeed "mise run remote_lint_https_ref" # Remote task should be downloaded | ||
|
||
mise cache clear # Clear cache to force redownload | ||
|
||
assert_succeed "MISE_TASK_REMOTE_NO_CACHE=true mise run remote_lint_https_ref" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_https_ref --no-cache" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_https_ref" # Cache should be used |
This file contains 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,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ -n "$EXCLUDE_FROM_CI" ]; then | ||
echo "This test is not supported in CI, because it requires a SSH key to be added to the GitHub account" | ||
exit 0 | ||
fi | ||
|
||
cargo init --name hello_cargo | ||
|
||
################################################################################# | ||
# Test remote tasks with no ref | ||
################################################################################# | ||
|
||
cat <<EOF >mise.toml | ||
[tasks.remote_lint_ssh_latest] | ||
file = "git::ssh://[email protected]:jdx/mise.git//xtasks/lint/clippy" | ||
EOF | ||
|
||
assert_contains "mise tasks" "remote_lint_ssh_latest" | ||
assert_succeed "mise run remote_lint_ssh_latest" # Remote task should be downloaded | ||
|
||
mise cache clear # Clear cache to force redownload | ||
|
||
assert_succeed "MISE_TASK_REMOTE_NO_CACHE=true mise run remote_lint_ssh_latest" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_ssh_latest --no-cache" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_ssh_latest" # Cache should be used | ||
|
||
################################################################################# | ||
# Test remote tasks with with ref | ||
################################################################################# | ||
|
||
cat <<EOF >mise.toml | ||
[tasks.remote_lint_ssh_ref] | ||
file = "git::ssh://[email protected]:jdx/mise.git//xtasks/lint/clippy?ref=v2025.1.17" | ||
EOF | ||
|
||
assert_contains "mise tasks" "remote_lint_ssh_ref" | ||
assert_succeed "mise run remote_lint_ssh_ref" # Remote task should be downloaded | ||
|
||
mise cache clear # Clear cache to force redownload | ||
|
||
assert_succeed "MISE_TASK_REMOTE_NO_CACHE=true mise run remote_lint_ssh_ref" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_ssh_ref --no-cache" # Remote task should be redownloaded | ||
|
||
assert_succeed "mise run remote_lint_ssh_ref" # Cache should be used |
This file contains 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 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 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 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 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 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 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 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.