Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/shp_build_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ shp build run <name> [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
Expand Down
1 change: 1 addition & 0 deletions docs/shp_build_upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ shp build upload <build-name> [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
Expand Down
1 change: 1 addition & 0 deletions docs/shp_buildrun_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ shp buildrun create <name> [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
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ 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.18.0
github.com/shipwright-io/build v0.18.0
github.com/spf13/cobra v1.10.1
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
k8s.io/api v0.33.6
Expand Down Expand Up @@ -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
Expand All @@ -47,7 +47,7 @@ require (
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.2 // indirect
github.com/go-git/go-git/v5 v5.16.3 // indirect
github.com/go-git/go-git/v5 v5.16.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -122,8 +122,8 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66D
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM=
github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU=
github.com/go-git/go-git/v5 v5.16.3 h1:Z8BtvxZ09bYm/yYNgPKCzgWtaRqDTgIKRgIRHBfU6Z8=
github.com/go-git/go-git/v5 v5.16.3/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
github.com/go-git/go-git/v5 v5.16.4 h1:7ajIEZHZJULcyJebDLo99bGgS0jRrOxzZG4uCk2Yb2Y=
github.com/go-git/go-git/v5 v5.16.4/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -375,15 +375,15 @@ github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQ
github.com/schollz/progressbar/v3 v3.18.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=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
Expand Down
9 changes: 7 additions & 2 deletions pkg/shp/flags/buildrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand Down Expand Up @@ -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
}
}
16 changes: 14 additions & 2 deletions pkg/shp/flags/buildrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions pkg/shp/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions vendor/github.com/onsi/gomega/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions vendor/github.com/onsi/gomega/format/format.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/onsi/gomega/gomega_dsl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions vendor/github.com/onsi/gomega/matchers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/onsi/gomega/matchers/have_key_matcher.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading