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

feat: add git remote task provider #4233

Merged
merged 31 commits into from
Feb 8, 2025
Merged

Conversation

acesyde
Copy link
Contributor

@acesyde acesyde commented Jan 26, 2025

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

@acesyde
Copy link
Contributor Author

acesyde commented Jan 26, 2025

@jdx do you know how i can add some unit tests for this part ?

image

Currently, we can't mock git:: and file::

@jdx
Copy link
Owner

jdx commented Jan 26, 2025

I would use e2e tests for this

@acesyde
Copy link
Contributor Author

acesyde commented Jan 26, 2025

@jdx if you want to do a first review, all the code is done, I just have to do the e2e tests

@acesyde acesyde marked this pull request as ready for review February 1, 2025 15:48
@acesyde
Copy link
Contributor Author

acesyde commented Feb 1, 2025

@jdx All the code is finished and I'm trying to add some e2e tests but I'm having trouble with them 😅 if you have an idea how to implement them correcly

@jdx
Copy link
Owner

jdx commented Feb 2, 2025

hmm I don't know what it means:

Message:  called `Result::unwrap()` on an `Err` value: MietteDiagnostic { message: "git failed: Cmd([\"git\", \"-C\", \"/tmp/test_task_remote_git_https.EmQQUm/home/.cache/mise/remote-git-tasks-cache/791bacd406835a949d44cc2ac1106e0e4475d131ccc56b2540846d661bf5ff5c\", \"-c\", \"safe.directory=/tmp/test_task_remote_git_https.EmQQUm/home/.cache/mise/remote-git-tasks-cache/791bacd406835a949d44cc2ac1106e0e4475d131ccc56b2540846d661bf5ff5c\", \"fetch\", \"--prune\", \"--update-head-ok\", \"origin\", \"v2025.1.17:v2025.1.17\"]) error: cannot update ref 'refs/heads/v2025.1.17': trying to write non-commit object faa3b33c4b1d9a6efda1c7ade1c0b35e7146e1a8 to branch 'refs/heads/v2025.1.17'\nFrom [https://github.com/jdx/mise\n](https://github.com/jdx/mise/n) ! [new tag]           v2025.1.17 -> v2025.1.17  (unable to update local ref)\n * [new tag]           v2025.1.17 -> v2025.1.17\n", code: None, severity: None, help: None, url: None, labels: None }

it might be a bug in the git code that isn't correctly creating the repo or something. If I get some time next week I'll see if I can dive in but I don't think this is a test issue so much as an issue with the code.

@acesyde
Copy link
Contributor Author

acesyde commented Feb 2, 2025

Dont worry I found why, that why I want to add the clone options behavior to your git library, when it will be merged on main I will fix the issue in my pr 👍

@acesyde
Copy link
Contributor Author

acesyde commented Feb 2, 2025

@jdx should i use the crate::git or https://github.com/jdx/xx to clone repositories in this PR ?

@acesyde
Copy link
Contributor Author

acesyde commented Feb 7, 2025

@jdx i have fixed all the tests but to be able to pass e2e ssh tests with github action i need to add a ssh key

This block of code cannot works because RTX_SSH_KEY doesn't exist for the test pipeline

      - uses: shimataro/ssh-key-action@v2
        with:
          key: ${{ secrets.RTX_SSH_KEY }}

Can you do something for me ?

@jdx
Copy link
Owner

jdx commented Feb 7, 2025

you won't be able to use secrets in CI at all, is it possible to create one just for the test runs?

@acesyde
Copy link
Contributor Author

acesyde commented Feb 7, 2025

@jdx I tried to create a temporary ssh key (latest commit) but it can't work properly because the key is not saved to any account :(

@hverlin
Copy link
Contributor

hverlin commented Feb 8, 2025

Should we indicate the #MISE comments are not supported for file properties in mise toml files? (#USAGE is supported, however.)

I wonder if things like #MISE description=... or #MISE sources=... should be used as default if not specified in mise.toml? (I can start a discussion about it if this makes sense)

@jdx jdx merged commit 1bf4a0f into jdx:main Feb 8, 2025
19 checks passed
@jdx
Copy link
Owner

jdx commented Feb 8, 2025

I think long term you should be able to use the #MISE comments and I don't see we wouldn't be able to do that—though it makes sense why it doesn't work today since these tasks are an extension to toml tasks. Not sure if it makes more sense to document this gap or just make it work.

jdx pushed a commit that referenced this pull request Feb 8, 2025
### 🚀 Features

- **(registry)** add jd by [@risu729](https://github.com/risu729) in
[#4318](#4318)
- **(registry)** add jc by [@risu729](https://github.com/risu729) in
[#4317](#4317)
- **(registry)** Add qsv cli by [@vjda](https://github.com/vjda) in
[#4334](#4334)
- add support for idiomatic go.mod file by
[@roele](https://github.com/roele) in
[#4312](#4312)
- add -g short version for unuse cmd by
[@kimle](https://github.com/kimle) in
[#4330](#4330)
- add git remote task provider by [@acesyde](https://github.com/acesyde)
in [#4233](#4233)
- set usage arguments and flags as environment variables for toml tasks
by [@gturi](https://github.com/gturi) in
[#4159](#4159)

### 🐛 Bug Fixes

- **(aqua)** trim prefix before comparing versions by
[@risu729](https://github.com/risu729) in
[#4340](#4340)
- wrong config file type for rust-toolchain.toml files by
[@roele](https://github.com/roele) in
[#4321](#4321)

### 🚜 Refactor

- **(registry)** use aqua for yq by [@scop](https://github.com/scop) in
[#4326](#4326)

### 📚 Documentation

- **(schema)** fix description of task.dir default by
[@risu729](https://github.com/risu729) in
[#4324](#4324)
- Add PowerShell example by [@jahanson](https://github.com/jahanson) in
[#3857](#3857)
- Include "A Mise guide for Swift developers" by
[@pepicrft](https://github.com/pepicrft) in
[#4329](#4329)
- Update documentation for core tools by
[@hverlin](https://github.com/hverlin) in
[#4341](#4341)
- Update vitepress to fix search by
[@hverlin](https://github.com/hverlin) in
[#4342](#4342)

### Chore

- **(bun.lock)** migrate bun lockfiles to text-based by
[@risu729](https://github.com/risu729) in
[#4319](#4319)

### New Contributors

- @vjda made their first contribution in
[#4334](#4334)
- @kimle made their first contribution in
[#4330](#4330)
- @pepicrft made their first contribution in
[#4329](#4329)
- @jahanson made their first contribution in
[#3857](#3857)
@acesyde acesyde deleted the feature/git_remote_task branch February 8, 2025 15:47
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

Successfully merging this pull request may close these issues.

3 participants