mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-08-15 00:05:57 +08:00
Compare commits
9 Commits
v0.17.0-rc
...
v0.15
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1c1dbb2e4c | ||
![]() |
d677edae32 | ||
![]() |
0b0ed6ede9 | ||
![]() |
18fb636e2f | ||
![]() |
fe728e7780 | ||
![]() |
2375e88b06 | ||
![]() |
22d3d058f3 | ||
![]() |
03f3b35667 | ||
![]() |
49e562cf06 |
@@ -37,8 +37,10 @@ linters-settings:
|
||||
rules:
|
||||
main:
|
||||
deny:
|
||||
# The io/ioutil package has been deprecated.
|
||||
# https://go.dev/doc/go1.16#ioutil
|
||||
- pkg: "github.com/containerd/containerd/errdefs"
|
||||
desc: The containerd errdefs package was migrated to a separate module. Use github.com/containerd/errdefs instead.
|
||||
- pkg: "github.com/containerd/containerd/log"
|
||||
desc: The containerd log package was migrated to a separate module. Use github.com/containerd/log instead.
|
||||
- pkg: "io/ioutil"
|
||||
desc: The io/ioutil package has been deprecated.
|
||||
forbidigo:
|
||||
|
@@ -4,7 +4,7 @@ ARG GO_VERSION=1.21
|
||||
ARG XX_VERSION=1.4.0
|
||||
|
||||
# for testing
|
||||
ARG DOCKER_VERSION=26.0.0
|
||||
ARG DOCKER_VERSION=26.1.4
|
||||
ARG GOTESTSUM_VERSION=v1.9.0
|
||||
ARG REGISTRY_VERSION=2.8.0
|
||||
ARG BUILDKIT_VERSION=v0.13.1
|
||||
|
@@ -53,7 +53,7 @@ var (
|
||||
|
||||
const (
|
||||
printFallbackImage = "docker/dockerfile:1.5@sha256:dbbd5e059e8a07ff7ea6233b213b36aa516b4c53c645f1817a4dd18b83cbea56"
|
||||
printLintFallbackImage = "docker.io/docker/dockerfile-upstream:1.8.0@sha256:d6d396f3780b1dd56a3acbc975f57bd2fc501989b50164c41387c42d04e780d0"
|
||||
printLintFallbackImage = "docker.io/docker/dockerfile-upstream:1.8.1@sha256:e87caa74dcb7d46cd820352bfea12591f3dba3ddc4285e19c7dcd13359f7cefd"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
|
@@ -866,7 +866,34 @@ func printResult(f *controllerapi.PrintFunc, res map[string]string) error {
|
||||
case "subrequests.describe":
|
||||
return printValue(subrequests.PrintDescribe, subrequests.SubrequestsDescribeDefinition.Version, f.Format, res)
|
||||
case "lint":
|
||||
return printValue(lint.PrintLintViolations, lint.SubrequestLintDefinition.Version, f.Format, res)
|
||||
err := printValue(lint.PrintLintViolations, lint.SubrequestLintDefinition.Version, f.Format, res)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
lintResults := lint.LintResults{}
|
||||
if result, ok := res["result.json"]; ok {
|
||||
if err := json.Unmarshal([]byte(result), &lintResults); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if lintResults.Error != nil {
|
||||
// Print the error message and the source
|
||||
// Normally, we would use `errdefs.WithSource` to attach the source to the
|
||||
// error and let the error be printed by the handling that's already in place,
|
||||
// but here we want to print the error in a way that's consistent with how
|
||||
// the lint warnings are printed via the `lint.PrintLintViolations` function,
|
||||
// which differs from the default error printing.
|
||||
fmt.Println()
|
||||
lintBuf := bytes.NewBuffer([]byte(lintResults.Error.Message + "\n"))
|
||||
sourceInfo := lintResults.Sources[lintResults.Error.Location.SourceIndex]
|
||||
source := errdefs.Source{
|
||||
Info: sourceInfo,
|
||||
Ranges: lintResults.Error.Location.Ranges,
|
||||
}
|
||||
source.Print(lintBuf)
|
||||
return errors.New(lintBuf.String())
|
||||
}
|
||||
default:
|
||||
if dt, ok := res["result.json"]; ok && f.Format == "json" {
|
||||
fmt.Println(dt)
|
||||
|
4
go.mod
4
go.mod
@@ -10,6 +10,7 @@ require (
|
||||
github.com/containerd/console v1.0.4
|
||||
github.com/containerd/containerd v1.7.18
|
||||
github.com/containerd/continuity v0.4.3
|
||||
github.com/containerd/errdefs v0.1.0
|
||||
github.com/containerd/log v0.1.0
|
||||
github.com/containerd/typeurl/v2 v2.1.1
|
||||
github.com/creack/pty v1.1.21
|
||||
@@ -26,7 +27,7 @@ require (
|
||||
github.com/hashicorp/go-cty-funcs v0.0.0-20230405223818-a090f58aa992
|
||||
github.com/hashicorp/hcl/v2 v2.20.1
|
||||
github.com/in-toto/in-toto-golang v0.5.0
|
||||
github.com/moby/buildkit v0.14.0
|
||||
github.com/moby/buildkit v0.14.1
|
||||
github.com/moby/sys/mountinfo v0.7.1
|
||||
github.com/moby/sys/signal v0.7.0
|
||||
github.com/morikuni/aec v1.0.0
|
||||
@@ -80,7 +81,6 @@ require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/containerd/errdefs v0.1.0 // indirect
|
||||
github.com/containerd/ttrpc v1.2.4 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/docker/distribution v2.8.2+incompatible // indirect
|
||||
|
4
go.sum
4
go.sum
@@ -302,8 +302,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/moby/buildkit v0.14.0 h1:mHv2lFS8znLDRc4SMyM2B9tPjxWh2blMvr0H7ARquNM=
|
||||
github.com/moby/buildkit v0.14.0/go.mod h1:1XssG7cAqv5Bz1xcGMxJL123iCv5TYN4Z/qf647gfuk=
|
||||
github.com/moby/buildkit v0.14.1 h1:2epLCZTkn4CikdImtsLtIa++7DzCimrrZCT1sway+oI=
|
||||
github.com/moby/buildkit v0.14.1/go.mod h1:1XssG7cAqv5Bz1xcGMxJL123iCv5TYN4Z/qf647gfuk=
|
||||
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/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
|
||||
|
@@ -821,7 +821,7 @@ COPy --from=base \
|
||||
stderr := bytes.Buffer{}
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
require.NoError(t, cmd.Run(), stdout.String(), stderr.String())
|
||||
require.Error(t, cmd.Run(), stdout.String(), stderr.String())
|
||||
|
||||
var res lint.LintResults
|
||||
require.NoError(t, json.Unmarshal(stdout.Bytes(), &res))
|
||||
|
@@ -9,10 +9,10 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/buildx/util/buildflags"
|
||||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||
|
116
vendor/github.com/containerd/containerd/errdefs/errdefs_deprecated.go
generated
vendored
116
vendor/github.com/containerd/containerd/errdefs/errdefs_deprecated.go
generated
vendored
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package errdefs defines the common errors used throughout containerd
|
||||
// packages.
|
||||
//
|
||||
// Use with fmt.Errorf to add context to an error.
|
||||
//
|
||||
// To detect an error class, use the IsXXX functions to tell whether an error
|
||||
// is of a certain type.
|
||||
//
|
||||
// The functions ToGRPC and FromGRPC can be used to map server-side and
|
||||
// client-side errors to the correct types.
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"github.com/containerd/errdefs"
|
||||
)
|
||||
|
||||
// Definitions of common error types used throughout containerd. All containerd
|
||||
// errors returned by most packages will map into one of these errors classes.
|
||||
// Packages should return errors of these types when they want to instruct a
|
||||
// client to take a particular action.
|
||||
//
|
||||
// For the most part, we just try to provide local grpc errors. Most conditions
|
||||
// map very well to those defined by grpc.
|
||||
var (
|
||||
ErrUnknown = errdefs.ErrUnknown
|
||||
ErrInvalidArgument = errdefs.ErrInvalidArgument
|
||||
ErrNotFound = errdefs.ErrNotFound
|
||||
ErrAlreadyExists = errdefs.ErrAlreadyExists
|
||||
ErrFailedPrecondition = errdefs.ErrFailedPrecondition
|
||||
ErrUnavailable = errdefs.ErrUnavailable
|
||||
ErrNotImplemented = errdefs.ErrNotImplemented
|
||||
)
|
||||
|
||||
// IsInvalidArgument returns true if the error is due to an invalid argument
|
||||
func IsInvalidArgument(err error) bool {
|
||||
return errdefs.IsInvalidArgument(err)
|
||||
}
|
||||
|
||||
// IsNotFound returns true if the error is due to a missing object
|
||||
func IsNotFound(err error) bool {
|
||||
return errdefs.IsNotFound(err)
|
||||
}
|
||||
|
||||
// IsAlreadyExists returns true if the error is due to an already existing
|
||||
// metadata item
|
||||
func IsAlreadyExists(err error) bool {
|
||||
return errdefs.IsAlreadyExists(err)
|
||||
}
|
||||
|
||||
// IsFailedPrecondition returns true if an operation could not proceed to the
|
||||
// lack of a particular condition
|
||||
func IsFailedPrecondition(err error) bool {
|
||||
return errdefs.IsFailedPrecondition(err)
|
||||
}
|
||||
|
||||
// IsUnavailable returns true if the error is due to a resource being unavailable
|
||||
func IsUnavailable(err error) bool {
|
||||
return errdefs.IsUnavailable(err)
|
||||
}
|
||||
|
||||
// IsNotImplemented returns true if the error is due to not being implemented
|
||||
func IsNotImplemented(err error) bool {
|
||||
return errdefs.IsNotImplemented(err)
|
||||
}
|
||||
|
||||
// IsCanceled returns true if the error is due to `context.Canceled`.
|
||||
func IsCanceled(err error) bool {
|
||||
return errdefs.IsCanceled(err)
|
||||
}
|
||||
|
||||
// IsDeadlineExceeded returns true if the error is due to
|
||||
// `context.DeadlineExceeded`.
|
||||
func IsDeadlineExceeded(err error) bool {
|
||||
return errdefs.IsDeadlineExceeded(err)
|
||||
}
|
||||
|
||||
// ToGRPC will attempt to map the backend containerd error into a grpc error,
|
||||
// using the original error message as a description.
|
||||
//
|
||||
// Further information may be extracted from certain errors depending on their
|
||||
// type.
|
||||
//
|
||||
// If the error is unmapped, the original error will be returned to be handled
|
||||
// by the regular grpc error handling stack.
|
||||
func ToGRPC(err error) error {
|
||||
return errdefs.ToGRPC(err)
|
||||
}
|
||||
|
||||
// ToGRPCf maps the error to grpc error codes, assembling the formatting string
|
||||
// and combining it with the target error string.
|
||||
//
|
||||
// This is equivalent to errdefs.ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err))
|
||||
func ToGRPCf(err error, format string, args ...interface{}) error {
|
||||
return errdefs.ToGRPCf(err, format, args...)
|
||||
}
|
||||
|
||||
// FromGRPC returns the underlying error from a grpc service based on the grpc error code
|
||||
func FromGRPC(err error) error {
|
||||
return errdefs.FromGRPC(err)
|
||||
}
|
3
vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go
generated
vendored
3
vendor/github.com/moby/buildkit/frontend/dockerfile/shell/lex.go
generated
vendored
@@ -429,7 +429,8 @@ func (sw *shellWord) processDollar() (string, error) {
|
||||
case '%', '#':
|
||||
// %/# matches the shortest pattern expansion, %%/## the longest
|
||||
greedy := false
|
||||
if word[0] == byte(ch) {
|
||||
|
||||
if len(word) > 0 && word[0] == byte(ch) {
|
||||
greedy = true
|
||||
word = word[1:]
|
||||
}
|
||||
|
8
vendor/github.com/moby/buildkit/frontend/subrequests/lint/lint.go
generated
vendored
8
vendor/github.com/moby/buildkit/frontend/subrequests/lint/lint.go
generated
vendored
@@ -108,7 +108,7 @@ func (results *LintResults) ToResult() (*client.Result, error) {
|
||||
res.AddMeta("result.txt", b.Bytes())
|
||||
|
||||
status := 0
|
||||
if len(results.Warnings) > 0 {
|
||||
if len(results.Warnings) > 0 || results.Error != nil {
|
||||
status = 1
|
||||
}
|
||||
res.AddMeta("result.statuscode", []byte(fmt.Sprintf("%d", status)))
|
||||
@@ -169,11 +169,11 @@ func PrintLintViolations(dt []byte, w io.Writer) error {
|
||||
})
|
||||
|
||||
for _, warning := range results.Warnings {
|
||||
fmt.Fprintf(w, "%s", warning.RuleName)
|
||||
fmt.Fprintf(w, "\nWARNING: %s", warning.RuleName)
|
||||
if warning.URL != "" {
|
||||
fmt.Fprintf(w, " - %s", warning.URL)
|
||||
}
|
||||
fmt.Fprintf(w, "\n%s\n", warning.Description)
|
||||
fmt.Fprintf(w, "\n%s\n", warning.Detail)
|
||||
|
||||
if warning.Location.SourceIndex < 0 {
|
||||
continue
|
||||
@@ -187,8 +187,8 @@ func PrintLintViolations(dt []byte, w io.Writer) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintln(w)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
3
vendor/modules.txt
vendored
3
vendor/modules.txt
vendored
@@ -161,7 +161,6 @@ github.com/containerd/containerd/content
|
||||
github.com/containerd/containerd/content/local
|
||||
github.com/containerd/containerd/content/proxy
|
||||
github.com/containerd/containerd/defaults
|
||||
github.com/containerd/containerd/errdefs
|
||||
github.com/containerd/containerd/filters
|
||||
github.com/containerd/containerd/identifiers
|
||||
github.com/containerd/containerd/images
|
||||
@@ -520,7 +519,7 @@ github.com/mitchellh/go-wordwrap
|
||||
# github.com/mitchellh/reflectwalk v1.0.2
|
||||
## explicit
|
||||
github.com/mitchellh/reflectwalk
|
||||
# github.com/moby/buildkit v0.14.0
|
||||
# github.com/moby/buildkit v0.14.1
|
||||
## explicit; go 1.21
|
||||
github.com/moby/buildkit/api/services/control
|
||||
github.com/moby/buildkit/api/types
|
||||
|
Reference in New Issue
Block a user