diff --git a/go.mod b/go.mod index 5722b9858..191b39114 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/containerd/platforms v1.0.0-rc.1 github.com/davecgh/go-spew v1.1.1 github.com/distribution/reference v0.6.0 - github.com/docker/buildx v0.28.0-rc1 + github.com/docker/buildx v0.28.0-rc2 github.com/docker/cli v28.3.3+incompatible github.com/docker/cli-docs-tool v0.10.0 github.com/docker/docker v28.3.3+incompatible @@ -28,7 +28,7 @@ require ( github.com/mattn/go-shellwords v1.0.12 github.com/mitchellh/go-ps v1.0.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/moby/buildkit v0.24.0-rc1 + github.com/moby/buildkit v0.24.0-rc2 github.com/moby/go-archive v0.1.0 github.com/moby/patternmatcher v0.6.0 github.com/moby/sys/atomicwriter v0.1.0 diff --git a/go.sum b/go.sum index 537f7dbb7..6450f6443 100644 --- a/go.sum +++ b/go.sum @@ -128,8 +128,8 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfr github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/docker/buildx v0.28.0-rc1 h1:XQ0hwhIB+Jf211iBdts30WtsqIQ8/xY7/QcYDzfDFEY= -github.com/docker/buildx v0.28.0-rc1/go.mod h1:LGGGhqW6EbnC96hK9XSVh4h7kI+G/bwTgJJh/uAuQWo= +github.com/docker/buildx v0.28.0-rc2 h1:UYwiYhk9B0Wkw0cTWjoP7caujfwvsSJfxu41xheXQQ8= +github.com/docker/buildx v0.28.0-rc2/go.mod h1:nhsrcN6qzbyOZWsXHwc/nqr70CdvJ7b6CEOEMQ1/0KY= github.com/docker/cli v28.3.3+incompatible h1:fp9ZHAr1WWPGdIWBM1b3zLtgCF+83gRdVMTJsUeiyAo= github.com/docker/cli v28.3.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli-docs-tool v0.10.0 h1:bOD6mKynPQgojQi3s2jgcUWGp/Ebqy1SeCr9VfKQLLU= @@ -318,8 +318,8 @@ github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/z github.com/mitchellh/mapstructure v0.0.0-20150613213606-2caf8efc9366/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/buildkit v0.24.0-rc1 h1:taA+MPeYWtGyRQ1SGbdTHVk5khWKFR7f9WI2coW/Ggs= -github.com/moby/buildkit v0.24.0-rc1/go.mod h1:4qovICAdR2H4C7+EGMRva5zgHW1gyhT4/flHI7F5F9k= +github.com/moby/buildkit v0.24.0-rc2 h1:1Z9+R162yauf3SYvn8cGjBPnglMDK4bO+00dNlJSgZI= +github.com/moby/buildkit v0.24.0-rc2/go.mod h1:4qovICAdR2H4C7+EGMRva5zgHW1gyhT4/flHI7F5F9k= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= diff --git a/pkg/compose/build_bake.go b/pkg/compose/build_bake.go index 434cf0555..e8c68e380 100644 --- a/pkg/compose/build_bake.go +++ b/pkg/compose/build_bake.go @@ -218,7 +218,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project read = append(read, build.Context) for _, path := range build.AdditionalContexts { - _, err := gitutil.ParseGitRef(path) + _, _, err := gitutil.ParseGitRef(path) if !strings.Contains(path, "://") && err != nil { read = append(read, path) } diff --git a/pkg/remote/git.go b/pkg/remote/git.go index 81da7ffef..5d85345ea 100644 --- a/pkg/remote/git.go +++ b/pkg/remote/git.go @@ -64,7 +64,7 @@ type gitRemoteLoader struct { } func (g gitRemoteLoader) Accept(path string) bool { - _, err := gitutil.ParseGitRef(path) + _, _, err := gitutil.ParseGitRef(path) return err == nil } @@ -79,15 +79,15 @@ func (g gitRemoteLoader) Load(ctx context.Context, path string) (string, error) return "", fmt.Errorf("git remote resource is disabled by %q", GIT_REMOTE_ENABLED) } - ref, err := gitutil.ParseGitRef(path) + ref, _, err := gitutil.ParseGitRef(path) if err != nil { return "", err } local, ok := g.known[path] if !ok { - if ref.Commit == "" { - ref.Commit = "HEAD" // default branch + if ref.Ref == "" { + ref.Ref = "HEAD" // default branch } err = g.resolveGitRef(ctx, path, ref) @@ -100,7 +100,7 @@ func (g gitRemoteLoader) Load(ctx context.Context, path string) (string, error) return "", fmt.Errorf("initializing remote resource cache: %w", err) } - local = filepath.Join(cache, ref.Commit) + local = filepath.Join(cache, ref.Ref) if _, err := os.Stat(local); os.IsNotExist(err) { if g.offline { return "", nil @@ -130,8 +130,8 @@ func (g gitRemoteLoader) Dir(path string) string { } func (g gitRemoteLoader) resolveGitRef(ctx context.Context, path string, ref *gitutil.GitRef) error { - if !commitSHA.MatchString(ref.Commit) { - cmd := exec.CommandContext(ctx, "git", "ls-remote", "--exit-code", ref.Remote, ref.Commit) + if !commitSHA.MatchString(ref.Ref) { + cmd := exec.CommandContext(ctx, "git", "ls-remote", "--exit-code", ref.Remote, ref.Ref) cmd.Env = g.gitCommandEnv() out, err := cmd.CombinedOutput() if err != nil { @@ -147,7 +147,7 @@ func (g gitRemoteLoader) resolveGitRef(ctx context.Context, path string, ref *gi if !commitSHA.MatchString(sha) { return fmt.Errorf("invalid commit sha %q", sha) } - ref.Commit = sha + ref.Ref = sha } return nil } @@ -169,7 +169,7 @@ func (g gitRemoteLoader) checkout(ctx context.Context, path string, ref *gitutil return err } - cmd = exec.CommandContext(ctx, "git", "fetch", "--depth=1", "origin", ref.Commit) + cmd = exec.CommandContext(ctx, "git", "fetch", "--depth=1", "origin", ref.Ref) cmd.Env = g.gitCommandEnv() cmd.Dir = path @@ -178,7 +178,7 @@ func (g gitRemoteLoader) checkout(ctx context.Context, path string, ref *gitutil return err } - cmd = exec.CommandContext(ctx, "git", "checkout", ref.Commit) + cmd = exec.CommandContext(ctx, "git", "checkout", ref.Ref) cmd.Dir = path err = cmd.Run() if err != nil {