Support querystring form Git URLs#6172
Conversation
Fix issue 4905, but the syntax differs from the original proposal. The document will be added to https://github.com/docker/docs/blob/main/content/manuals/build/concepts/context.md#url-fragments Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| // By default the git repository is cloned with `--depth=1` to reduce the amount of data downloaded. | ||
| // Additionally the ".git" directory is removed after the clone, you can keep ith with the [KeepGitDir] [GitOption]. | ||
| func Git(url, ref string, opts ...GitOption) State { | ||
| func Git(url, fragment string, opts ...GitOption) State { |
There was a problem hiding this comment.
Note that there is no functional change in here. The previous var was incorrectly named; it was actually a ref:substring pair.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
51a677f to
1ef2851
Compare
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
|
|
||
| tcases := []tcase{ | ||
| { | ||
| // if this commit is already cached then this will work and ignore tag atm because tag name has no influence to the output |
There was a problem hiding this comment.
@AkihiroSuda Bit unexpected, but I don't think there is another way. This is not any new behavior from querystring but same for --checksum.
| } | ||
| gf.SubDir = v[0] | ||
| case "checksum", "commit": | ||
| gf.Checksum = v[0] |
There was a problem hiding this comment.
This is a weird word to use for a commit hash 🤔 it is technically a checksum, but I don't think there's really any prior art for calling one of them "checksum" is there?
There was a problem hiding this comment.
ADD --checksum is the flag for the current version of this behavior (since DF 1.16 for Git). Note that this is not what is used to check out the reference, but for the validation of the ref/tag/branch.
| case "tag": | ||
| tag = v[0] | ||
| case "branch": | ||
| branch = v[0] |
There was a problem hiding this comment.
I guess #4905 (comment) wasn't convincing enough to drop branch and tag in favor of just ref? 😅
There was a problem hiding this comment.
You can use ref and you can set it to refs/tags/* or refs/heads/* manually. tag and branch are added for convenience.
<!--Delete sections as needed --> ## Description <!-- Tell us what you did and why --> BuildKit v0.24 introduces URL like `https://github.com/example/example.git?tag=v0.0.1&checksum=deadbeef` ## Related issues or tickets <!-- Related issues, pull requests, or Jira tickets --> - moby/buildkit#6172 - moby/buildkit#6173 ## Reviews <!-- Notes for reviewers here --> <!-- List applicable reviews (optionally @tag reviewers) --> - [X] Technical review - [X] Editorial review - [ ] Product review --------- Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp> Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> Co-authored-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com>
supersedes #5974
fixes #4905