From c16342a67068f8c8d0f88f14d96fc13e05a2b475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Irving=20Mondrag=C3=B3n?= Date: Tue, 13 Jan 2026 11:56:00 +0100 Subject: [PATCH] Add --runtime-class flag to buildrun create MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Irving Mondragón Signed-off-by: Sascha Schwarze --- docs/shp_build_run.md | 1 + docs/shp_build_upload.md | 1 + docs/shp_buildrun_create.md | 1 + go.mod | 6 +-- go.sum | 16 ++++---- pkg/shp/cmd/build/build.go | 2 +- pkg/shp/cmd/build/create.go | 2 +- pkg/shp/cmd/build/delete.go | 2 +- pkg/shp/cmd/build/doc.go | 2 +- pkg/shp/cmd/build/list.go | 2 +- pkg/shp/cmd/build/run.go | 2 +- pkg/shp/cmd/build/run_test.go | 2 +- pkg/shp/cmd/build/upload.go | 2 +- pkg/shp/cmd/version/version.go | 2 +- pkg/shp/flags/buildrun.go | 9 ++++- pkg/shp/flags/buildrun_test.go | 16 +++++++- pkg/shp/flags/flags.go | 12 ++++++ vendor/github.com/onsi/gomega/CHANGELOG.md | 11 ++++++ .../github.com/onsi/gomega/format/format.go | 26 ++++++------- vendor/github.com/onsi/gomega/gomega_dsl.go | 2 +- vendor/github.com/onsi/gomega/matchers.go | 22 ++++++++++- .../onsi/gomega/matchers/have_key_matcher.go | 2 +- .../matchers/have_key_with_value_matcher.go | 2 +- .../matchers/match_error_strictly_matcher.go | 39 +++++++++++++++++++ .../matchers/support/goraph/edge/edge.go | 13 +++---- .../pkg/apis/build/v1beta1/build_types.go | 6 +++ .../pkg/apis/build/v1beta1/buildrun_types.go | 4 ++ vendor/modules.txt | 6 +-- 28 files changed, 160 insertions(+), 53 deletions(-) create mode 100644 vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go diff --git a/docs/shp_build_run.md b/docs/shp_build_run.md index 7c5d51dfc..2ccff9eb1 100644 --- a/docs/shp_build_run.md +++ b/docs/shp_build_run.md @@ -31,6 +31,7 @@ shp build run [flags] --param-value stringArray set of key-value pairs to pass as parameters to the buildStrategy (default []) --retention-ttl-after-failed duration duration to delete the BuildRun after it failed --retention-ttl-after-succeeded duration duration to delete the BuildRun after it succeeded + --runtime-class string specify the runtime class to be used for the Pod --sa-name string Kubernetes service-account name --scheduler-name string specify the scheduler to be used to dispatch the Pod --timeout duration build process timeout diff --git a/docs/shp_build_upload.md b/docs/shp_build_upload.md index ae8967cbf..19fd2b13d 100644 --- a/docs/shp_build_upload.md +++ b/docs/shp_build_upload.md @@ -41,6 +41,7 @@ shp build upload [path/to/source|.] [flags] --param-value stringArray set of key-value pairs to pass as parameters to the buildStrategy (default []) --retention-ttl-after-failed duration duration to delete the BuildRun after it failed --retention-ttl-after-succeeded duration duration to delete the BuildRun after it succeeded + --runtime-class string specify the runtime class to be used for the Pod --sa-name string Kubernetes service-account name --scheduler-name string specify the scheduler to be used to dispatch the Pod --timeout duration build process timeout diff --git a/docs/shp_buildrun_create.md b/docs/shp_buildrun_create.md index 550b57f88..912f2f89d 100644 --- a/docs/shp_buildrun_create.md +++ b/docs/shp_buildrun_create.md @@ -30,6 +30,7 @@ shp buildrun create [flags] --param-value stringArray set of key-value pairs to pass as parameters to the buildStrategy (default []) --retention-ttl-after-failed duration duration to delete the BuildRun after it failed --retention-ttl-after-succeeded duration duration to delete the BuildRun after it succeeded + --runtime-class string specify the runtime class to be used for the Pod --sa-name string Kubernetes service-account name --scheduler-name string specify the scheduler to be used to dispatch the Pod --timeout duration build process timeout diff --git a/go.mod b/go.mod index b39689afd..9b8285abc 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.24.0 require ( github.com/google/go-containerregistry v0.20.7 - github.com/onsi/gomega v1.38.2 + github.com/onsi/gomega v1.39.0 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/schollz/progressbar/v3 v3.19.0 - github.com/shipwright-io/build v0.18.0 + github.com/shipwright-io/build v0.18.2-0.20260112084729-e48a9ff9aa57 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 github.com/texttheater/golang-levenshtein/levenshtein v0.0.0-20200805054039-cae8b0eaed6c @@ -36,7 +36,7 @@ require ( github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/docker/cli v29.0.3+incompatible // indirect + github.com/docker/cli v29.1.4+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/docker-credential-helpers v0.9.3 // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect diff --git a/go.sum b/go.sum index 55ef632ac..58c50db04 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/cli v29.0.3+incompatible h1:8J+PZIcF2xLd6h5sHPsp5pvvJA+Sr2wGQxHkRl53a1E= -github.com/docker/cli v29.0.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v29.1.4+incompatible h1:AI8fwZhqsAsrqZnVv9h6lbexeW/LzNTasf6A4vcNN8M= +github.com/docker/cli v29.1.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= @@ -310,10 +310,10 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns= -github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A= -github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= +github.com/onsi/ginkgo/v2 v2.27.4 h1:fcEcQW/A++6aZAZQNUmNjvA9PSOzefMJBerHJ4t8v8Y= +github.com/onsi/ginkgo/v2 v2.27.4/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= +github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q= +github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= @@ -375,8 +375,8 @@ github.com/schollz/progressbar/v3 v3.19.0 h1:Ea18xuIRQXLAUidVDox3AbwfUhD0/1Ivohy github.com/schollz/progressbar/v3 v3.19.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/shipwright-io/build v0.18.0 h1:99rZ1f8P71zxOzJSIcQFbWEPybXm5H46eNwXm1uz94Q= -github.com/shipwright-io/build v0.18.0/go.mod h1:j8DzQf7y+xlrlfxhn1+awjc6adBSqcxxRdNZCqxAo+4= +github.com/shipwright-io/build v0.18.2-0.20260112084729-e48a9ff9aa57 h1:F/3mRGP1jaSrYHKKSGlTJBww+6Tb9vApn2cvI/xWj1o= +github.com/shipwright-io/build v0.18.2-0.20260112084729-e48a9ff9aa57/go.mod h1:4yvBdUJGjBbDtW8CuBiuAVeLfJL0/V7X8WF129WdpBE= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= diff --git a/pkg/shp/cmd/build/build.go b/pkg/shp/cmd/build/build.go index 8f48ebd5d..80c1f6243 100644 --- a/pkg/shp/cmd/build/build.go +++ b/pkg/shp/cmd/build/build.go @@ -1,4 +1,4 @@ -package build +package build // nolint:revive import ( "github.com/spf13/cobra" diff --git a/pkg/shp/cmd/build/create.go b/pkg/shp/cmd/build/create.go index a4942f4ae..c731ce26d 100644 --- a/pkg/shp/cmd/build/create.go +++ b/pkg/shp/cmd/build/create.go @@ -1,4 +1,4 @@ -package build +package build // nolint:revive import ( "fmt" diff --git a/pkg/shp/cmd/build/delete.go b/pkg/shp/cmd/build/delete.go index c5e99cd40..5a478c663 100644 --- a/pkg/shp/cmd/build/delete.go +++ b/pkg/shp/cmd/build/delete.go @@ -1,4 +1,4 @@ -package build +package build // nolint:revive import ( "fmt" diff --git a/pkg/shp/cmd/build/doc.go b/pkg/shp/cmd/build/doc.go index 2f93c2bd2..b0db962e3 100644 --- a/pkg/shp/cmd/build/doc.go +++ b/pkg/shp/cmd/build/doc.go @@ -1,2 +1,2 @@ // Package build contains types and functions for build cobra sub-command -package build +package build // nolint:revive diff --git a/pkg/shp/cmd/build/list.go b/pkg/shp/cmd/build/list.go index 14ddd3782..c053be735 100644 --- a/pkg/shp/cmd/build/list.go +++ b/pkg/shp/cmd/build/list.go @@ -1,4 +1,4 @@ -package build +package build // nolint:revive import ( "fmt" diff --git a/pkg/shp/cmd/build/run.go b/pkg/shp/cmd/build/run.go index 4f66c199d..91b88f8b2 100644 --- a/pkg/shp/cmd/build/run.go +++ b/pkg/shp/cmd/build/run.go @@ -1,4 +1,4 @@ -package build +package build // nolint:revive import ( "errors" diff --git a/pkg/shp/cmd/build/run_test.go b/pkg/shp/cmd/build/run_test.go index 51c59d00b..660e63430 100644 --- a/pkg/shp/cmd/build/run_test.go +++ b/pkg/shp/cmd/build/run_test.go @@ -1,4 +1,4 @@ -package build +package build // nolint:revive import ( "bytes" diff --git a/pkg/shp/cmd/build/upload.go b/pkg/shp/cmd/build/upload.go index 6c80fffcb..7abe3dd3e 100644 --- a/pkg/shp/cmd/build/upload.go +++ b/pkg/shp/cmd/build/upload.go @@ -1,4 +1,4 @@ -package build +package build // nolint:revive import ( "fmt" diff --git a/pkg/shp/cmd/version/version.go b/pkg/shp/cmd/version/version.go index 7e7eacb46..f66c8070a 100644 --- a/pkg/shp/cmd/version/version.go +++ b/pkg/shp/cmd/version/version.go @@ -1,4 +1,4 @@ -package version +package version // nolint:revive import ( "fmt" diff --git a/pkg/shp/flags/buildrun.go b/pkg/shp/flags/buildrun.go index 2ce262ab0..2e801a24a 100644 --- a/pkg/shp/flags/buildrun.go +++ b/pkg/shp/flags/buildrun.go @@ -28,8 +28,9 @@ func BuildRunSpecFromFlags(flags *pflag.FlagSet) *buildv1beta1.BuildRunSpec { TTLAfterFailed: &metav1.Duration{}, TTLAfterSucceeded: &metav1.Duration{}, }, - NodeSelector: map[string]string{}, - SchedulerName: ptr.To(""), + NodeSelector: map[string]string{}, + SchedulerName: ptr.To(""), + RuntimeClassName: ptr.To(""), } buildRefFlags(flags, &spec.Build) @@ -43,6 +44,7 @@ func BuildRunSpecFromFlags(flags *pflag.FlagSet) *buildv1beta1.BuildRunSpec { buildRunRetentionFlags(flags, spec.Retention) buildNodeSelectorFlags(flags, spec.NodeSelector) buildSchedulerNameFlag(flags, spec.SchedulerName) + buildRuntimeClassNameFlag(flags, spec.RuntimeClassName) return spec } @@ -89,4 +91,7 @@ func SanitizeBuildRunSpec(br *buildv1beta1.BuildRunSpec) { if br.SchedulerName != nil && *br.SchedulerName == "" { br.SchedulerName = nil } + if br.RuntimeClassName != nil && *br.RuntimeClassName == "" { + br.RuntimeClassName = nil + } } diff --git a/pkg/shp/flags/buildrun_test.go b/pkg/shp/flags/buildrun_test.go index 494be4bbc..85fad1b9c 100644 --- a/pkg/shp/flags/buildrun_test.go +++ b/pkg/shp/flags/buildrun_test.go @@ -38,8 +38,9 @@ func TestBuildRunSpecFromFlags(t *testing.T) { Duration: 30 * time.Minute, }, }, - NodeSelector: map[string]string{"kubernetes.io/hostname": "worker-1"}, - SchedulerName: ptr.To("dolphinscheduler"), + NodeSelector: map[string]string{"kubernetes.io/hostname": "worker-1"}, + SchedulerName: ptr.To("dolphinscheduler"), + RuntimeClassName: ptr.To("kata"), } cmd := &cobra.Command{} @@ -91,6 +92,13 @@ func TestBuildRunSpecFromFlags(t *testing.T) { g.Expect(expected.SchedulerName).To(o.Equal(spec.SchedulerName), "spec.schedulerName") }) + t.Run(".spec.runtimeClassName", func(_ *testing.T) { + err := flags.Set(RuntimeClassNameFlag, *expected.RuntimeClassName) + g.Expect(err).To(o.BeNil()) + + g.Expect(expected.RuntimeClassName).To(o.Equal(spec.RuntimeClassName), "spec.runtimeClassName") + }) + t.Run(".spec.retention.ttlAfterFailed", func(_ *testing.T) { err := flags.Set(RetentionTTLAfterFailedFlag, expected.Retention.TTLAfterFailed.Duration.String()) g.Expect(err).To(o.BeNil()) @@ -150,6 +158,10 @@ func TestSanitizeBuildRunSpec(t *testing.T) { Retention: &buildv1beta1.BuildRunRetention{}, }, out: buildv1beta1.BuildRunSpec{}, + }, { + name: "should clean-up runtime-class-name", + in: buildv1beta1.BuildRunSpec{RuntimeClassName: ptr.To("")}, + out: buildv1beta1.BuildRunSpec{}, }} for _, tt := range testCases { diff --git a/pkg/shp/flags/flags.go b/pkg/shp/flags/flags.go index dc9560a87..3e77b9c56 100644 --- a/pkg/shp/flags/flags.go +++ b/pkg/shp/flags/flags.go @@ -78,6 +78,8 @@ const ( NodeSelectorFlag = "node-selector" // SchedulerNameFlag command-line flag. SchedulerNameFlag = "scheduler-name" + // RuntimeClassNameFlag command-line flag. + RuntimeClassNameFlag = "runtime-class" ) // sourceFlags flags for ".spec.source" @@ -287,6 +289,16 @@ func buildSchedulerNameFlag(flags *pflag.FlagSet, schedulerName *string) { ) } +// buildRuntimeClassNameFlag registers flags for adding BuildRunSpec.RuntimeClassName +func buildRuntimeClassNameFlag(flags *pflag.FlagSet, runtimeClassName *string) { + flags.StringVar( + runtimeClassName, + RuntimeClassNameFlag, + "", + "specify the runtime class to be used for the Pod", + ) +} + // envFlags registers flags for adding corev1.EnvVars. func envFlags(flags *pflag.FlagSet, envs *[]corev1.EnvVar) { flags.VarP( diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index b7d7309f3..cf020605c 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,14 @@ +## 1.39.0 + +### Features + +Add `MatchErrorStrictly` which only passes if `errors.Is(actual, expected)` returns true. `MatchError`, by contrast, will fallback to string comparison. + +## 1.38.3 + +### Fixes +make string formatitng more consistent for users who use format.Object directly + ## 1.38.2 - roll back to go 1.23.0 [c404969] diff --git a/vendor/github.com/onsi/gomega/format/format.go b/vendor/github.com/onsi/gomega/format/format.go index 96f04b210..6c23ba338 100644 --- a/vendor/github.com/onsi/gomega/format/format.go +++ b/vendor/github.com/onsi/gomega/format/format.go @@ -262,7 +262,7 @@ func Object(object any, indentation uint) string { if err, ok := object.(error); ok && !isNilValue(value) { // isNilValue check needed here to avoid nil deref due to boxed nil commonRepresentation += "\n" + IndentString(err.Error(), indentation) + "\n" + indent } - return fmt.Sprintf("%s<%s>: %s%s", indent, formatType(value), commonRepresentation, formatValue(value, indentation)) + return fmt.Sprintf("%s<%s>: %s%s", indent, formatType(value), commonRepresentation, formatValue(value, indentation, true)) } /* @@ -306,7 +306,7 @@ func formatType(v reflect.Value) string { } } -func formatValue(value reflect.Value, indentation uint) string { +func formatValue(value reflect.Value, indentation uint, isTopLevel bool) string { if indentation > MaxDepth { return "..." } @@ -367,11 +367,11 @@ func formatValue(value reflect.Value, indentation uint) string { case reflect.Func: return fmt.Sprintf("0x%x", value.Pointer()) case reflect.Ptr: - return formatValue(value.Elem(), indentation) + return formatValue(value.Elem(), indentation, isTopLevel) case reflect.Slice: return truncateLongStrings(formatSlice(value, indentation)) case reflect.String: - return truncateLongStrings(formatString(value.String(), indentation)) + return truncateLongStrings(formatString(value.String(), indentation, isTopLevel)) case reflect.Array: return truncateLongStrings(formatSlice(value, indentation)) case reflect.Map: @@ -392,8 +392,8 @@ func formatValue(value reflect.Value, indentation uint) string { } } -func formatString(object any, indentation uint) string { - if indentation == 1 { +func formatString(object any, indentation uint, isTopLevel bool) string { + if isTopLevel { s := fmt.Sprintf("%s", object) components := strings.Split(s, "\n") result := "" @@ -416,14 +416,14 @@ func formatString(object any, indentation uint) string { func formatSlice(v reflect.Value, indentation uint) string { if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 && isPrintableString(string(v.Bytes())) { - return formatString(v.Bytes(), indentation) + return formatString(v.Bytes(), indentation, false) } l := v.Len() result := make([]string, l) longest := 0 - for i := 0; i < l; i++ { - result[i] = formatValue(v.Index(i), indentation+1) + for i := range l { + result[i] = formatValue(v.Index(i), indentation+1, false) if len(result[i]) > longest { longest = len(result[i]) } @@ -443,7 +443,7 @@ func formatMap(v reflect.Value, indentation uint) string { longest := 0 for i, key := range v.MapKeys() { value := v.MapIndex(key) - result[i] = fmt.Sprintf("%s: %s", formatValue(key, indentation+1), formatValue(value, indentation+1)) + result[i] = fmt.Sprintf("%s: %s", formatValue(key, indentation+1, false), formatValue(value, indentation+1, false)) if len(result[i]) > longest { longest = len(result[i]) } @@ -462,10 +462,10 @@ func formatStruct(v reflect.Value, indentation uint) string { l := v.NumField() result := []string{} longest := 0 - for i := 0; i < l; i++ { + for i := range l { structField := t.Field(i) fieldEntry := v.Field(i) - representation := fmt.Sprintf("%s: %s", structField.Name, formatValue(fieldEntry, indentation+1)) + representation := fmt.Sprintf("%s: %s", structField.Name, formatValue(fieldEntry, indentation+1, false)) result = append(result, representation) if len(representation) > longest { longest = len(representation) @@ -479,7 +479,7 @@ func formatStruct(v reflect.Value, indentation uint) string { } func formatInterface(v reflect.Value, indentation uint) string { - return fmt.Sprintf("<%s>%s", formatType(v.Elem()), formatValue(v.Elem(), indentation)) + return fmt.Sprintf("<%s>%s", formatType(v.Elem()), formatValue(v.Elem(), indentation, false)) } func isNilValue(a reflect.Value) bool { diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index fdba34ee9..cd6ce450f 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.38.2" +const GOMEGA_VERSION = "1.39.0" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index 10b6693fd..16ca8f46d 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -146,6 +146,24 @@ func MatchError(expected any, functionErrorDescription ...any) types.GomegaMatch } } +// MatchErrorStrictly succeeds iff actual is a non-nil error that matches the passed in +// expected error according to errors.Is(actual, expected). +// +// This behavior differs from MatchError where +// +// Expect(errors.New("some error")).To(MatchError(errors.New("some error"))) +// +// succeeds, but errors.Is would return false so: +// +// Expect(errors.New("some error")).To(MatchErrorStrictly(errors.New("some error"))) +// +// fails. +func MatchErrorStrictly(expected error) types.GomegaMatcher { + return &matchers.MatchErrorStrictlyMatcher{ + Expected: expected, + } +} + // BeClosed succeeds if actual is a closed channel. // It is an error to pass a non-channel to BeClosed, it is also an error to pass nil // @@ -515,8 +533,8 @@ func HaveExistingField(field string) types.GomegaMatcher { // and even interface values. // // actual := 42 -// Expect(actual).To(HaveValue(42)) -// Expect(&actual).To(HaveValue(42)) +// Expect(actual).To(HaveValue(Equal(42))) +// Expect(&actual).To(HaveValue(Equal(42))) func HaveValue(matcher types.GomegaMatcher) types.GomegaMatcher { return &matchers.HaveValueMatcher{ Matcher: matcher, diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go index 9e16dcf5d..16630c18e 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go @@ -39,7 +39,7 @@ func (matcher *HaveKeyMatcher) Match(actual any) (success bool, err error) { } keys := reflect.ValueOf(actual).MapKeys() - for i := 0; i < len(keys); i++ { + for i := range keys { success, err := keyMatcher.Match(keys[i].Interface()) if err != nil { return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go index 1c53f1e56..0cd708153 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go @@ -52,7 +52,7 @@ func (matcher *HaveKeyWithValueMatcher) Match(actual any) (success bool, err err } keys := reflect.ValueOf(actual).MapKeys() - for i := 0; i < len(keys); i++ { + for i := range keys { success, err := keyMatcher.Match(keys[i].Interface()) if err != nil { return false, fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error()) diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go new file mode 100644 index 000000000..63969b266 --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go @@ -0,0 +1,39 @@ +package matchers + +import ( + "errors" + "fmt" + + "github.com/onsi/gomega/format" +) + +type MatchErrorStrictlyMatcher struct { + Expected error +} + +func (matcher *MatchErrorStrictlyMatcher) Match(actual any) (success bool, err error) { + + if isNil(matcher.Expected) { + return false, fmt.Errorf("Expected error is nil, use \"ToNot(HaveOccurred())\" to explicitly check for nil errors") + } + + if isNil(actual) { + return false, fmt.Errorf("Expected an error, got nil") + } + + if !isError(actual) { + return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) + } + + actualErr := actual.(error) + + return errors.Is(actualErr, matcher.Expected), nil +} + +func (matcher *MatchErrorStrictlyMatcher) FailureMessage(actual any) (message string) { + return format.Message(actual, "to match error", matcher.Expected) +} + +func (matcher *MatchErrorStrictlyMatcher) NegatedFailureMessage(actual any) (message string) { + return format.Message(actual, "not to match error", matcher.Expected) +} diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go index 8c38411b2..72edba20f 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go @@ -1,6 +1,9 @@ package edge -import . "github.com/onsi/gomega/matchers/support/goraph/node" +import ( + . "github.com/onsi/gomega/matchers/support/goraph/node" + "slices" +) type Edge struct { Node1 int @@ -20,13 +23,7 @@ func (ec EdgeSet) Free(node Node) bool { } func (ec EdgeSet) Contains(edge Edge) bool { - for _, e := range ec { - if e == edge { - return true - } - } - - return false + return slices.Contains(ec, edge) } func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) { diff --git a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/build_types.go b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/build_types.go index 33d8f8809..a41b37c62 100644 --- a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/build_types.go +++ b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/build_types.go @@ -82,6 +82,8 @@ const ( TolerationNotValid BuildReason = "TolerationNotValid" // SchedulerNameNotValid indicates that the Scheduler name is not valid SchedulerNameNotValid BuildReason = "SchedulerNameNotValid" + // RuntimeClassNameNotValid indicates that the RuntimeClassName is not valid + RuntimeClassNameNotValid BuildReason = "RuntimeClassNameNotValid" // AllValidationsSucceeded indicates a Build was successfully validated AllValidationsSucceeded = "all validations succeeded" ) @@ -196,6 +198,10 @@ type BuildSpec struct { // SchedulerName specifies the scheduler to be used to dispatch the Pod // +optional SchedulerName *string `json:"schedulerName,omitempty"` + + // RuntimeClassName specifies the RuntimeClass to be used to run the Pod + // +optional + RuntimeClassName *string `json:"runtimeClassName,omitempty"` } // BuildVolume is a volume that will be mounted in build pod during build step diff --git a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/buildrun_types.go b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/buildrun_types.go index d6acc3c8a..d8f2f9888 100644 --- a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/buildrun_types.go +++ b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1beta1/buildrun_types.go @@ -126,6 +126,10 @@ type BuildRunSpec struct { // SchedulerName specifies the scheduler to be used to dispatch the Pod // +optional SchedulerName *string `json:"schedulerName,omitempty"` + + // RuntimeClassName specifies the RuntimeClass to be used to run the Pod + // +optional + RuntimeClassName *string `json:"runtimeClassName,omitempty"` } // BuildRunRequestedState defines the buildrun state the user can provide to override whatever is the current state. diff --git a/vendor/modules.txt b/vendor/modules.txt index d3aba7ecf..622bab735 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -53,7 +53,7 @@ github.com/cpuguy83/go-md2man/v2/md2man # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/docker/cli v29.0.3+incompatible +# github.com/docker/cli v29.1.4+incompatible ## explicit github.com/docker/cli/cli/config github.com/docker/cli/cli/config/configfile @@ -273,7 +273,7 @@ github.com/munnerz/goautoneg # github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f ## explicit github.com/mxk/go-flowrate/flowrate -# github.com/onsi/gomega v1.38.2 +# github.com/onsi/gomega v1.39.0 ## explicit; go 1.23.0 github.com/onsi/gomega github.com/onsi/gomega/format @@ -336,7 +336,7 @@ github.com/sabhiram/go-gitignore # github.com/schollz/progressbar/v3 v3.19.0 ## explicit; go 1.22 github.com/schollz/progressbar/v3 -# github.com/shipwright-io/build v0.18.0 +# github.com/shipwright-io/build v0.18.2-0.20260112084729-e48a9ff9aa57 ## explicit; go 1.24.0 github.com/shipwright-io/build/pkg/apis/build/v1alpha1 github.com/shipwright-io/build/pkg/apis/build/v1beta1