File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,28 @@ def pull_command:
53
53
end
54
54
;
55
55
# input: "build" object (with "buildId" top level key)
56
+ # output: string "giturl" ("https://github.com/docker-library/golang.git#commit:directory), used for "docker buildx build giturl"
57
+ def git_build_url :
58
+ .source.entry
59
+ | (
60
+ .GitRepo
61
+ | if (endswith (".git" ) | not ) then
62
+ if test ("^https?://github.com/" ) then
63
+ # without ".git" in the url "docker buildx build url" fails and tries to build the html repo page as a Dockerfile
64
+ # https://github.com/moby/buildkit/blob/0e1e36ba9eb8142968b2c5cfa2f12549bf9246d9/util/gitutil/git_ref.go#L81-L87
65
+ # https://github.com/docker/cli/issues/1738
66
+ . + ".git"
67
+ else
68
+ error ("\( . ) does not end in '.git' so build will fail to recognize it as a Git URL" )
69
+ end
70
+ else . end
71
+ ) + "#" + .GitCommit + ":" + .Directory
72
+ ;
73
+ # input: "build" object (with "buildId" top level key)
56
74
# output: string "build command" ("docker buildx build ..."), may be multiple lines, expects to run in Bash with "set -Eeuo pipefail"
57
75
def build_command :
58
76
normalized_builder as $builder
59
- | ( .source.entry.GitRepo + "#" + .source.entry.GitCommit + ":" + .source.entry.Directory ) as $buildUrl
77
+ | git_build_url as $buildUrl
60
78
| if $builder == "buildkit" then
61
79
[
62
80
(
You can’t perform that action at this time.
0 commit comments