Repository navigation
feat: allow http modules - #2275
jcdickinson wants to merge 1 commit into
Conversation
|
lint failure is due to Azure egress limit: https://github.com/dagger/dagger/runs/6132808931?check_suite_focus=true#step:6:384 |
|
Another option here might be to detect Edit: I'm building a PR to prove this out. |
This allows `project update` to download .tar.gz modules from an HTTP server. The module name is derived from the host and path portions of the URL. The fragment portion of the URL is used to define the actual download path. For example, `https://github.com/dagger/dagger#/archive/refs/tags/v0.2.7.tar.gz` results in the `github.com/dagger/dagger` module name and `https://github.com/dagger/dagger/archive/refs/tags/v0.2.7.tar.gz` download URL. Support for providing a _full_ authentication header has also been added. This is done with the `authorization-header` flag. For example, `--authorization-header 'token ghp_...'`. Finally, some of the require_tests were broken. The tests seemed to represent desired behavior, so I updated`parseDaggerRepoName`. Signed-off-by: Jonathan Dickinson <[email protected]>
| }, | ||
| } | ||
|
|
||
| for _, c := range cases { |
There was a problem hiding this comment.
Wouldn't it be better to use https://pkg.go.dev/net/http/httptest and make this a unit test?
| return nil, fmt.Errorf("issue when parsing HTTP repo") | ||
| } | ||
|
|
||
| clone, _ := url.Parse(repoName) |
There was a problem hiding this comment.
isn't it repeated with line above?
TomChv
left a comment
There was a problem hiding this comment.
Thanks for your contribution! Do you have an example of a use case?
I left minor comments and I'll do some test and see how it reacts.
| return &Require{ | ||
| repo: u.Host + u.Path, | ||
| path: "", | ||
| version: "", |
There was a problem hiding this comment.
Version and subpath are not handle?
| } | ||
|
|
||
| func downloadHTTPModule(ctx context.Context, req *Require, tmpPath string) error { | ||
| return download(ctx, req, tmpPath, viper.GetString("authorization-header")) |
There was a problem hiding this comment.
Why you do not directly implement download here? This is what we do with cloneGitModule
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This allows
project updateto download .tar.gz modules from an HTTP server. The module name is derived from the host and path portions of the URL. The fragment portion of the URL is used to define the actual download path. For example,https://github.com/dagger/dagger#/archive/refs/tags/v0.2.7.tar.gzresults in thegithub.com/dagger/daggermodule name andhttps://github.com/dagger/dagger/archive/refs/tags/v0.2.7.tar.gzdownload URL.Support for providing a full authentication header has also been added. This is done with the
--authorization-headerflag. For example,--authorization-header 'token ghp_...'.Finally, some of the require_tests were broken. The tests seemed to represent desired behavior, so I updated
parseDaggerRepoName.Signed-off-by: Jonathan Dickinson