mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to master@8b7bcb900d3c
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
18
vendor/github.com/moby/buildkit/util/progress/progressui/colors.go
generated
vendored
18
vendor/github.com/moby/buildkit/util/progress/progressui/colors.go
generated
vendored
@ -6,8 +6,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/morikuni/aec"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var termColorMap = map[string]aec.ANSI{
|
||||
@ -41,7 +41,7 @@ func setUserDefinedTermColors(colorsEnv string) {
|
||||
k, v, ok := strings.Cut(field, "=")
|
||||
if !ok || strings.Contains(v, "=") {
|
||||
err := errors.New("A valid entry must have exactly two fields")
|
||||
logrus.WithError(err).Warnf("Could not parse BUILDKIT_COLORS component: %s", field)
|
||||
bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS component: %s", field)
|
||||
continue
|
||||
}
|
||||
k = strings.ToLower(k)
|
||||
@ -53,7 +53,7 @@ func setUserDefinedTermColors(colorsEnv string) {
|
||||
}
|
||||
} else {
|
||||
err := errors.New("Colors must be a name from the pre-defined list or a valid 3-part RGB value")
|
||||
logrus.WithError(err).Warnf("Unknown color value found in BUILDKIT_COLORS: %s=%s", k, v)
|
||||
bklog.L.WithError(err).Warnf("Unknown color value found in BUILDKIT_COLORS: %s=%s", k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ func readBuildkitColorsEnv(colorsEnv string) []string {
|
||||
csvReader.Comma = ':'
|
||||
fields, err := csvReader.Read()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Warnf("Could not parse BUILDKIT_COLORS. Falling back to defaults.")
|
||||
bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS. Falling back to defaults.")
|
||||
return nil
|
||||
}
|
||||
return fields
|
||||
@ -73,12 +73,12 @@ func readRGB(v string) aec.ANSI {
|
||||
csvReader := csv.NewReader(strings.NewReader(v))
|
||||
fields, err := csvReader.Read()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Warnf("Could not parse value %s as valid comma-separated RGB color. Ignoring.", v)
|
||||
bklog.L.WithError(err).Warnf("Could not parse value %s as valid comma-separated RGB color. Ignoring.", v)
|
||||
return nil
|
||||
}
|
||||
if len(fields) != 3 {
|
||||
err = errors.New("A valid RGB color must have three fields")
|
||||
logrus.WithError(err).Warnf("Could not parse value %s as valid RGB color. Ignoring.", v)
|
||||
bklog.L.WithError(err).Warnf("Could not parse value %s as valid RGB color. Ignoring.", v)
|
||||
return nil
|
||||
}
|
||||
ok := isValidRGB(fields)
|
||||
@ -103,7 +103,7 @@ func parseKeys(k string, c aec.ANSI) {
|
||||
case "warning":
|
||||
colorWarning = c
|
||||
default:
|
||||
logrus.Warnf("Unknown key found in BUILDKIT_COLORS (expected: run, cancel, error, or warning): %s", k)
|
||||
bklog.L.Warnf("Unknown key found in BUILDKIT_COLORS (expected: run, cancel, error, or warning): %s", k)
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,14 +111,14 @@ func isValidRGB(s []string) bool {
|
||||
for _, n := range s {
|
||||
num, err := strconv.Atoi(n)
|
||||
if err != nil {
|
||||
logrus.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not an integer: %s", strings.Join(s, ","))
|
||||
bklog.L.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not an integer: %s", strings.Join(s, ","))
|
||||
return false
|
||||
}
|
||||
ok := isValidRGBValue(num)
|
||||
if ok {
|
||||
continue
|
||||
} else {
|
||||
logrus.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not within the valid range of 0-255: %s", strings.Join(s, ","))
|
||||
bklog.L.Warnf("A field in BUILDKIT_COLORS appears to contain an RGB value that is not within the valid range of 0-255: %s", strings.Join(s, ","))
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user