From d627ecea2a3d3c827ac9a6d8680d4cb0fba302e2 Mon Sep 17 00:00:00 2001 From: Chaitanyareddy0702 <78363486+Chaitanyareddy0702@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:26:37 +0530 Subject: [PATCH] Chore: Upgrade cuelang version to v0.14.1 (#6877) * chore: updates culenag version and syntax across all files Signed-off-by: Amit Singh Signed-off-by: Ayush Kumar * debuggin: reverts tf provider changes Signed-off-by: Amit Singh Signed-off-by: Ayush Kumar * Refactor: Simplify provider configuration by removing 'providerBasic' and directly defining access keys and region for providers Signed-off-by: Ayush Kumar * Refactor: Consolidate provider configuration by introducing 'providerBasic' for access keys and region Signed-off-by: Ayush Kumar * chore: reorganize import statements in deepcopy files for consistency Signed-off-by: Ayush Kumar * chore: reorder import statements for consistency across deepcopy files Signed-off-by: Ayush Kumar * Refactor: Safely handle pattern parameter selectors to avoid panics in GetParameters and getStatusMap Signed-off-by: Ayush Kumar * chore: add comment to clarify test context in definition_revision_test.go Signed-off-by: Ayush Kumar * chore: remove redundant comment from test context initialization in definition_revision_test.go Signed-off-by: Ayush Kumar * Refactor: Introduce GetSelectorLabel function to safely extract labels from CUE selectors Signed-off-by: Ayush Kumar * chore: add newline at end of file in utils.go Signed-off-by: Ayush Kumar * chore: increase timeout for multi-cluster e2e Signed-off-by: Ayush Kumar --------- Signed-off-by: Amit Singh Signed-off-by: Ayush Kumar Co-authored-by: Amit Singh Co-authored-by: Ayush Kumar --- .../apply-application-in-parallel.yaml | 4 +- .../defwithtemplate/apply-application.yaml | 4 +- .../defwithtemplate/apply-deployment.yaml | 8 +- .../defwithtemplate/apply-object.yaml | 4 +- .../defwithtemplate/apply-remaining.yaml | 4 +- .../apply-terraform-config.yaml | 6 +- .../apply-terraform-provider.yaml | 17 +- .../defwithtemplate/build-push-image.yaml | 11 +- .../defwithtemplate/check-metrics.yaml | 6 +- .../templates/defwithtemplate/clean-jobs.yaml | 4 +- .../collect-service-endpoints.yaml | 8 +- .../templates/defwithtemplate/command.yaml | 4 +- .../defwithtemplate/container-ports.yaml | 13 +- .../defwithtemplate/create-config.yaml | 4 +- .../templates/defwithtemplate/cron-task.yaml | 4 +- .../templates/defwithtemplate/daemon.yaml | 4 +- .../defwithtemplate/delete-config.yaml | 4 +- .../defwithtemplate/depends-on-app.yaml | 8 +- .../deploy-cloud-resource.yaml | 4 +- .../templates/defwithtemplate/deploy.yaml | 7 +- .../templates/defwithtemplate/deploy2env.yaml | 4 +- .../defwithtemplate/deploy2runtime.yaml | 4 +- .../templates/defwithtemplate/env.yaml | 8 +- .../defwithtemplate/export-data.yaml | 6 +- .../defwithtemplate/export-service.yaml | 6 +- .../defwithtemplate/export2config.yaml | 4 +- .../defwithtemplate/export2secret.yaml | 8 +- .../templates/defwithtemplate/expose.yaml | 6 +- .../templates/defwithtemplate/gateway.yaml | 1 + .../generate-jdbc-connection.yaml | 8 +- .../defwithtemplate/init-container.yaml | 6 +- .../defwithtemplate/list-config.yaml | 4 +- .../templates/defwithtemplate/nocalhost.yaml | 4 +- .../defwithtemplate/notification.yaml | 14 +- .../print-message-in-status.yaml | 4 +- .../defwithtemplate/read-config.yaml | 4 +- .../defwithtemplate/read-object.yaml | 4 +- .../templates/defwithtemplate/request.yaml | 8 +- .../defwithtemplate/share-cloud-resource.yaml | 4 +- .../defwithtemplate/statefulset.yaml | 6 +- .../templates/defwithtemplate/suspend.yaml | 4 +- .../templates/defwithtemplate/vela-cli.yaml | 8 +- .../templates/defwithtemplate/webhook.yaml | 12 +- .../templates/defwithtemplate/webservice.yaml | 6 +- go.mod | 40 ++-- go.sum | 82 +++---- makefiles/dependency.mk | 2 +- pkg/builtin/http/http.go | 2 +- .../application_controller_test.go | 4 +- .../testdata/definitions/panic.yaml | 4 +- pkg/cue/convert.go | 3 +- pkg/cue/convert_test.go | 21 ++ pkg/cue/definition/health/health.go | 7 +- pkg/cue/definition/health/health_test.go | 208 ++++++++++++++++-- pkg/cue/definition/template.go | 5 +- pkg/cue/testdata/workloads/pattern-params.cue | 16 ++ pkg/cue/utils.go | 33 +++ pkg/definition/definition.go | 87 +++++++- .../testdata/apply-terraform-provider.cue | 8 +- references/cli/adopt-templates/default.cue | 2 +- references/cli/debug.go | 2 +- references/cli/revision_test.go | 29 ++- references/cuegen/convert.go | 3 +- references/docgen/parser_test.go | 8 +- references/docgen/provider.go | 7 +- .../multicluster_standalone_test.go | 8 +- .../definition/replica-webservice.yaml | 5 +- .../internal/component/cron-task.cue | 4 +- .../workflowstep/apply-terraform-provider.cue | 8 +- 69 files changed, 566 insertions(+), 303 deletions(-) create mode 100644 pkg/cue/testdata/workloads/pattern-params.cue create mode 100644 pkg/cue/utils.go diff --git a/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml b/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml index 8813eada2..bcc51d33e 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-application-in-parallel.yaml @@ -15,9 +15,7 @@ spec: schematic: cue: template: | - import ( - "vela/op" - ) + import "vela/op" output: op.#ApplyApplicationInParallel & {} diff --git a/charts/vela-core/templates/defwithtemplate/apply-application.yaml b/charts/vela-core/templates/defwithtemplate/apply-application.yaml index 6f0934b98..710364494 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-application.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-application.yaml @@ -16,9 +16,7 @@ spec: schematic: cue: template: | - import ( - "vela/op" - ) + import "vela/op" // apply application output: op.#ApplyApplication & {} diff --git a/charts/vela-core/templates/defwithtemplate/apply-deployment.yaml b/charts/vela-core/templates/defwithtemplate/apply-deployment.yaml index 71518b5a8..54553cbe5 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-deployment.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-deployment.yaml @@ -13,12 +13,8 @@ spec: schematic: cue: template: | - import ( - "strconv" - "strings" - "vela/kube" - "vela/builtin" - ) + import "vela/kube" + import "vela/builtin" output: kube.#Apply & { $params: { diff --git a/charts/vela-core/templates/defwithtemplate/apply-object.yaml b/charts/vela-core/templates/defwithtemplate/apply-object.yaml index 1b51ac8be..871097dc0 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-object.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-object.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - ) + import "vela/kube" apply: kube.#Apply & { $params: parameter diff --git a/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml b/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml index 13a5def02..0b0250043 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-remaining.yaml @@ -16,9 +16,7 @@ spec: schematic: cue: template: | - import ( - "vela/op" - ) + import "vela/op" // apply remaining components and traits apply: op.#ApplyRemaining & { diff --git a/charts/vela-core/templates/defwithtemplate/apply-terraform-config.yaml b/charts/vela-core/templates/defwithtemplate/apply-terraform-config.yaml index 4f7a894b9..fcd83b002 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-terraform-config.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-terraform-config.yaml @@ -13,10 +13,8 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - "vela/builtin" - ) + import "vela/kube" + import "vela/builtin" apply: kube.#Apply & { $params: value: { diff --git a/charts/vela-core/templates/defwithtemplate/apply-terraform-provider.yaml b/charts/vela-core/templates/defwithtemplate/apply-terraform-provider.yaml index 6a8999932..b263a7c2c 100644 --- a/charts/vela-core/templates/defwithtemplate/apply-terraform-provider.yaml +++ b/charts/vela-core/templates/defwithtemplate/apply-terraform-provider.yaml @@ -13,12 +13,9 @@ spec: schematic: cue: template: | - import ( - "vela/config" - "vela/kube" - "vela/builtin" - "strings" - ) + import "vela/config" + import "vela/kube" + import "vela/builtin" cfg: config.#CreateConfig & { $params: { @@ -87,9 +84,9 @@ spec: } } providerBasic: { - accessKey: string - secretKey: string - region: string + accessKey!: string + secretKey!: string + region!: string } #AlibabaProvider: { providerBasic @@ -141,5 +138,5 @@ spec: type: "ucloud" name: *"ucloud-provider" | string } - parameter: *#AlibabaProvider | #AWSProvider | #AzureProvider | #BaiduProvider | #ECProvider | #GCPProvider | #TencentProvider | #UCloudProvider + parameter: #AlibabaProvider | #AWSProvider | #AzureProvider | #BaiduProvider | #ECProvider | #GCPProvider | #TencentProvider | #UCloudProvider diff --git a/charts/vela-core/templates/defwithtemplate/build-push-image.yaml b/charts/vela-core/templates/defwithtemplate/build-push-image.yaml index e89ff07ae..8976826c4 100644 --- a/charts/vela-core/templates/defwithtemplate/build-push-image.yaml +++ b/charts/vela-core/templates/defwithtemplate/build-push-image.yaml @@ -13,13 +13,10 @@ spec: schematic: cue: template: | - import ( - "vela/builtin" - "vela/kube" - "vela/util" - "encoding/json" - "strings" - ) + import "vela/builtin" + import "vela/kube" + import "vela/util" + import "strings" url: { if parameter.context.git != _|_ { diff --git a/charts/vela-core/templates/defwithtemplate/check-metrics.yaml b/charts/vela-core/templates/defwithtemplate/check-metrics.yaml index 573b29ece..c50a5128c 100644 --- a/charts/vela-core/templates/defwithtemplate/check-metrics.yaml +++ b/charts/vela-core/templates/defwithtemplate/check-metrics.yaml @@ -14,10 +14,8 @@ spec: schematic: cue: template: | - import ( - "vela/metrics" - "vela/builtin" - ) + import "vela/metrics" + import "vela/builtin" check: metrics.#PromCheck & { $params: { diff --git a/charts/vela-core/templates/defwithtemplate/clean-jobs.yaml b/charts/vela-core/templates/defwithtemplate/clean-jobs.yaml index b6c4bd7a0..0a301335b 100644 --- a/charts/vela-core/templates/defwithtemplate/clean-jobs.yaml +++ b/charts/vela-core/templates/defwithtemplate/clean-jobs.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - ) + import "vela/kube" parameter: { labelselector?: {...} diff --git a/charts/vela-core/templates/defwithtemplate/collect-service-endpoints.yaml b/charts/vela-core/templates/defwithtemplate/collect-service-endpoints.yaml index e1b2a0e3e..7af4d24ac 100644 --- a/charts/vela-core/templates/defwithtemplate/collect-service-endpoints.yaml +++ b/charts/vela-core/templates/defwithtemplate/collect-service-endpoints.yaml @@ -12,11 +12,9 @@ spec: schematic: cue: template: | - import ( - "vela/builtin" - "vela/query" - "strconv" - ) + import "vela/builtin" + import "vela/query" + import "strconv" collect: query.#CollectServiceEndpoints & { $params: app: { diff --git a/charts/vela-core/templates/defwithtemplate/command.yaml b/charts/vela-core/templates/defwithtemplate/command.yaml index 4b97a22dd..7575dbb47 100644 --- a/charts/vela-core/templates/defwithtemplate/command.yaml +++ b/charts/vela-core/templates/defwithtemplate/command.yaml @@ -16,6 +16,8 @@ spec: schematic: cue: template: | + import "list" + #PatchParams: { // +usage=Specify the name of the target container, if not set, use the component name containerName: *"" | string @@ -73,7 +75,7 @@ spec: } // +patchStrategy=replace - args: [for a in _args if _delArgs[a] == _|_ {a}] + [for a in _addArgs if _delArgs[a] == _|_ && _argsMap[a] == _|_ {a}] + args: list.Concat([[for a in _args if _delArgs[a] == _|_ {a}], [for a in _addArgs if _delArgs[a] == _|_ && _argsMap[a] == _|_ {a}]]) } } // +patchStrategy=open diff --git a/charts/vela-core/templates/defwithtemplate/container-ports.yaml b/charts/vela-core/templates/defwithtemplate/container-ports.yaml index f26ab3402..5c41e8747 100644 --- a/charts/vela-core/templates/defwithtemplate/container-ports.yaml +++ b/charts/vela-core/templates/defwithtemplate/container-ports.yaml @@ -17,10 +17,9 @@ spec: schematic: cue: template: | - import ( - "strconv" - "strings" - ) + import "strconv" + import "strings" + import "list" #PatchParams: { // +usage=Specify the name of the target container, if not set, use the component name @@ -67,7 +66,7 @@ spec: _basePortsMap: {for _basePort in _basePorts {(strings.ToLower(_basePort.protocol) + strconv.FormatInt(_basePort.containerPort, 10)): _basePort}} _portsMap: {for port in _params.ports {(strings.ToLower(port.protocol) + strconv.FormatInt(port.containerPort, 10)): port}} // +patchStrategy=replace - ports: [for portVar in _basePorts { + ports: list.Concat([[for portVar in _basePorts { containerPort: portVar.containerPort protocol: portVar.protocol name: portVar.name @@ -80,7 +79,7 @@ spec: hostIP: _portsMap[_uniqueKey].hostIP } } - }] + [for port in _params.ports if _basePortsMap[strings.ToLower(port.protocol)+strconv.FormatInt(port.containerPort, 10)] == _|_ { + }], [for port in _params.ports if _basePortsMap[strings.ToLower(port.protocol)+strconv.FormatInt(port.containerPort, 10)] == _|_ { if port.containerPort != _|_ { containerPort: port.containerPort } @@ -93,7 +92,7 @@ spec: if port.hostIP != _|_ { hostIP: port.hostIP } - }] + }]]) } } } diff --git a/charts/vela-core/templates/defwithtemplate/create-config.yaml b/charts/vela-core/templates/defwithtemplate/create-config.yaml index 03e049d45..7a4ccb74c 100644 --- a/charts/vela-core/templates/defwithtemplate/create-config.yaml +++ b/charts/vela-core/templates/defwithtemplate/create-config.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/config" - ) + import "vela/config" deploy: config.#CreateConfig & { $params: parameter diff --git a/charts/vela-core/templates/defwithtemplate/cron-task.yaml b/charts/vela-core/templates/defwithtemplate/cron-task.yaml index 9cdcc23bb..a4cfa74c0 100644 --- a/charts/vela-core/templates/defwithtemplate/cron-task.yaml +++ b/charts/vela-core/templates/defwithtemplate/cron-task.yaml @@ -11,6 +11,8 @@ spec: schematic: cue: template: | + import "list" + mountsArray: { pvc: *[ for v in parameter.volumeMounts.pvc { @@ -130,7 +132,7 @@ spec: }, ] | [] } - volumesList: volumesArray.pvc + volumesArray.configMap + volumesArray.secret + volumesArray.emptyDir + volumesArray.hostPath + volumesList: list.Concat([volumesArray.pvc, volumesArray.configMap, volumesArray.secret, volumesArray.emptyDir, volumesArray.hostPath]) deDupVolumesArray: [ for val in [ for i, vi in volumesList { diff --git a/charts/vela-core/templates/defwithtemplate/daemon.yaml b/charts/vela-core/templates/defwithtemplate/daemon.yaml index 75cb38aa5..2f5965e4f 100644 --- a/charts/vela-core/templates/defwithtemplate/daemon.yaml +++ b/charts/vela-core/templates/defwithtemplate/daemon.yaml @@ -11,9 +11,7 @@ spec: schematic: cue: template: | - import ( - "strconv" - ) + import "strconv" mountsArray: [ if parameter.volumeMounts != _|_ && parameter.volumeMounts.pvc != _|_ for v in parameter.volumeMounts.pvc { diff --git a/charts/vela-core/templates/defwithtemplate/delete-config.yaml b/charts/vela-core/templates/defwithtemplate/delete-config.yaml index f1d261aac..0c4462c4d 100644 --- a/charts/vela-core/templates/defwithtemplate/delete-config.yaml +++ b/charts/vela-core/templates/defwithtemplate/delete-config.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/config" - ) + import "vela/config" deploy: config.#DeleteConfig & { $params: parameter diff --git a/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml b/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml index 2dec60312..26bcbede3 100644 --- a/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml +++ b/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml @@ -12,11 +12,9 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - "vela/builtin" - "encoding/yaml" - ) + import "vela/kube" + import "vela/builtin" + import "encoding/yaml" dependsOn: kube.#Read & { $params: value: { diff --git a/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml b/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml index 7a9c5b5d0..862fe0af7 100644 --- a/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml +++ b/charts/vela-core/templates/defwithtemplate/deploy-cloud-resource.yaml @@ -14,9 +14,7 @@ spec: schematic: cue: template: | - import ( - "vela/op" - ) + import "vela/op" app: op.#DeployCloudResource & { env: parameter.env diff --git a/charts/vela-core/templates/defwithtemplate/deploy.yaml b/charts/vela-core/templates/defwithtemplate/deploy.yaml index 338e493f3..2b335ad90 100644 --- a/charts/vela-core/templates/defwithtemplate/deploy.yaml +++ b/charts/vela-core/templates/defwithtemplate/deploy.yaml @@ -14,10 +14,9 @@ spec: schematic: cue: template: | - import ( - "vela/multicluster" - "vela/builtin" - ) + import "vela/multicluster" + import "vela/builtin" + if parameter.auto == false { suspend: builtin.#Suspend & {$params: message: "Waiting approval to the deploy step \"\(context.stepName)\""} diff --git a/charts/vela-core/templates/defwithtemplate/deploy2env.yaml b/charts/vela-core/templates/defwithtemplate/deploy2env.yaml index 16e93d32e..94fb365f9 100644 --- a/charts/vela-core/templates/defwithtemplate/deploy2env.yaml +++ b/charts/vela-core/templates/defwithtemplate/deploy2env.yaml @@ -15,9 +15,7 @@ spec: schematic: cue: template: | - import ( - "vela/op" - ) + import "vela/op" app: op.#ApplyEnvBindApp & { env: parameter.env diff --git a/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml b/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml index 07069066c..ee03e13f8 100644 --- a/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml +++ b/charts/vela-core/templates/defwithtemplate/deploy2runtime.yaml @@ -15,9 +15,7 @@ spec: schematic: cue: template: | - import ( - "vela/op" - ) + import "vela/op" app: op.#Steps & { load: op.#Load diff --git a/charts/vela-core/templates/defwithtemplate/env.yaml b/charts/vela-core/templates/defwithtemplate/env.yaml index 8f51afad7..377b97dfd 100644 --- a/charts/vela-core/templates/defwithtemplate/env.yaml +++ b/charts/vela-core/templates/defwithtemplate/env.yaml @@ -16,6 +16,8 @@ spec: schematic: cue: template: | + import "list" + #PatchParams: { // +usage=Specify the name of the target container, if not set, use the component name containerName: *"" | string @@ -49,7 +51,7 @@ spec: if _baseEnv != _|_ { _baseEnvMap: {for envVar in _baseEnv {(envVar.name): envVar}} // +patchStrategy=replace - env: [for envVar in _baseEnv if _delKeys[envVar.name] == _|_ && !_params.replace { + env: list.Concat([[for envVar in _baseEnv if _delKeys[envVar.name] == _|_ && !_params.replace { name: envVar.name if _params.env[envVar.name] != _|_ { value: _params.env[envVar.name] @@ -62,10 +64,10 @@ spec: valueFrom: envVar.valueFrom } } - }] + [for k, v in _params.env if _delKeys[k] == _|_ && (_params.replace || _baseEnvMap[k] == _|_) { + }], [for k, v in _params.env if _delKeys[k] == _|_ && (_params.replace || _baseEnvMap[k] == _|_) { name: k value: v - }] + }]]) } } } diff --git a/charts/vela-core/templates/defwithtemplate/export-data.yaml b/charts/vela-core/templates/defwithtemplate/export-data.yaml index a6ba29728..d86d40d57 100644 --- a/charts/vela-core/templates/defwithtemplate/export-data.yaml +++ b/charts/vela-core/templates/defwithtemplate/export-data.yaml @@ -14,10 +14,8 @@ spec: schematic: cue: template: | - import ( - "vela/op" - "vela/kube" - ) + import "vela/op" + import "vela/kube" object: { apiVersion: "v1" diff --git a/charts/vela-core/templates/defwithtemplate/export-service.yaml b/charts/vela-core/templates/defwithtemplate/export-service.yaml index 54217f336..baae45ef3 100644 --- a/charts/vela-core/templates/defwithtemplate/export-service.yaml +++ b/charts/vela-core/templates/defwithtemplate/export-service.yaml @@ -14,10 +14,8 @@ spec: schematic: cue: template: | - import ( - "vela/op" - "vela/kube" - ) + import "vela/op" + import "vela/kube" meta: { name: *context.name | string diff --git a/charts/vela-core/templates/defwithtemplate/export2config.yaml b/charts/vela-core/templates/defwithtemplate/export2config.yaml index 6d4e6a6eb..171bb03cd 100644 --- a/charts/vela-core/templates/defwithtemplate/export2config.yaml +++ b/charts/vela-core/templates/defwithtemplate/export2config.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - ) + import "vela/kube" apply: kube.#Apply & { $params: { diff --git a/charts/vela-core/templates/defwithtemplate/export2secret.yaml b/charts/vela-core/templates/defwithtemplate/export2secret.yaml index 26e218a64..c5c55e085 100644 --- a/charts/vela-core/templates/defwithtemplate/export2secret.yaml +++ b/charts/vela-core/templates/defwithtemplate/export2secret.yaml @@ -12,11 +12,9 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - "encoding/base64" - "encoding/json" - ) + import "vela/kube" + import "encoding/base64" + import "encoding/json" secret: { data: *parameter.data | {} diff --git a/charts/vela-core/templates/defwithtemplate/expose.yaml b/charts/vela-core/templates/defwithtemplate/expose.yaml index 289bd0082..0feff34eb 100644 --- a/charts/vela-core/templates/defwithtemplate/expose.yaml +++ b/charts/vela-core/templates/defwithtemplate/expose.yaml @@ -15,10 +15,8 @@ spec: schematic: cue: template: | - import ( - "strconv" - "strings" - ) + import "strconv" + import "strings" outputs: service: { apiVersion: "v1" diff --git a/charts/vela-core/templates/defwithtemplate/gateway.yaml b/charts/vela-core/templates/defwithtemplate/gateway.yaml index bfa3e2c77..1357b4434 100644 --- a/charts/vela-core/templates/defwithtemplate/gateway.yaml +++ b/charts/vela-core/templates/defwithtemplate/gateway.yaml @@ -17,6 +17,7 @@ spec: template: | import "strconv" + let nameSuffix = { if parameter.name != _|_ {"-" + parameter.name} if parameter.name == _|_ {""} diff --git a/charts/vela-core/templates/defwithtemplate/generate-jdbc-connection.yaml b/charts/vela-core/templates/defwithtemplate/generate-jdbc-connection.yaml index 7f9d3530f..9430d68c9 100644 --- a/charts/vela-core/templates/defwithtemplate/generate-jdbc-connection.yaml +++ b/charts/vela-core/templates/defwithtemplate/generate-jdbc-connection.yaml @@ -12,11 +12,9 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - "vela/util" - "encoding/base64" - ) + import "vela/kube" + import "vela/util" + import "encoding/base64" output: kube.#Read & { $params: value: { diff --git a/charts/vela-core/templates/defwithtemplate/init-container.yaml b/charts/vela-core/templates/defwithtemplate/init-container.yaml index 123ee70db..cc1558d5f 100644 --- a/charts/vela-core/templates/defwithtemplate/init-container.yaml +++ b/charts/vela-core/templates/defwithtemplate/init-container.yaml @@ -17,6 +17,8 @@ spec: schematic: cue: template: | + import "list" + patch: spec: template: spec: { // +patchKey=name containers: [{ @@ -43,10 +45,10 @@ spec: } // +patchKey=name - volumeMounts: [{ + volumeMounts: list.Concat([[{ name: parameter.mountName mountPath: parameter.initMountPath - }] + parameter.extraVolumeMounts + }], parameter.extraVolumeMounts]) }] // +patchKey=name volumes: [{ diff --git a/charts/vela-core/templates/defwithtemplate/list-config.yaml b/charts/vela-core/templates/defwithtemplate/list-config.yaml index 50b8b16a4..dc8fa924c 100644 --- a/charts/vela-core/templates/defwithtemplate/list-config.yaml +++ b/charts/vela-core/templates/defwithtemplate/list-config.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/config" - ) + import "vela/config" output: config.#ListConfig & { $params: parameter diff --git a/charts/vela-core/templates/defwithtemplate/nocalhost.yaml b/charts/vela-core/templates/defwithtemplate/nocalhost.yaml index 1624fd669..04437df70 100644 --- a/charts/vela-core/templates/defwithtemplate/nocalhost.yaml +++ b/charts/vela-core/templates/defwithtemplate/nocalhost.yaml @@ -19,9 +19,7 @@ spec: schematic: cue: template: | - import ( - "encoding/json" - ) + import "encoding/json" outputs: nocalhostService: { apiVersion: "v1" diff --git a/charts/vela-core/templates/defwithtemplate/notification.yaml b/charts/vela-core/templates/defwithtemplate/notification.yaml index 58625da0d..fae370c74 100644 --- a/charts/vela-core/templates/defwithtemplate/notification.yaml +++ b/charts/vela-core/templates/defwithtemplate/notification.yaml @@ -12,14 +12,12 @@ spec: schematic: cue: template: | - import ( - "vela/http" - "vela/email" - "vela/kube" - "vela/util" - "encoding/base64" - "encoding/json" - ) + import "vela/http" + import "vela/email" + import "vela/kube" + import "vela/util" + import "encoding/base64" + import "encoding/json" parameter: { // +usage=Please fulfill its url and message if you want to send Lark messages diff --git a/charts/vela-core/templates/defwithtemplate/print-message-in-status.yaml b/charts/vela-core/templates/defwithtemplate/print-message-in-status.yaml index 6e455afcd..f1995582e 100644 --- a/charts/vela-core/templates/defwithtemplate/print-message-in-status.yaml +++ b/charts/vela-core/templates/defwithtemplate/print-message-in-status.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/builtin" - ) + import "vela/builtin" parameter: message: string diff --git a/charts/vela-core/templates/defwithtemplate/read-config.yaml b/charts/vela-core/templates/defwithtemplate/read-config.yaml index 33d1af4f8..2db44b1d4 100644 --- a/charts/vela-core/templates/defwithtemplate/read-config.yaml +++ b/charts/vela-core/templates/defwithtemplate/read-config.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/config" - ) + import "vela/config" output: config.#ReadConfig & { $params: parameter diff --git a/charts/vela-core/templates/defwithtemplate/read-object.yaml b/charts/vela-core/templates/defwithtemplate/read-object.yaml index 23a349c0c..5e2f426f7 100644 --- a/charts/vela-core/templates/defwithtemplate/read-object.yaml +++ b/charts/vela-core/templates/defwithtemplate/read-object.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - ) + import "vela/kube" output: kube.#Read & { $params: { diff --git a/charts/vela-core/templates/defwithtemplate/request.yaml b/charts/vela-core/templates/defwithtemplate/request.yaml index 8461dfc01..f15d7a946 100644 --- a/charts/vela-core/templates/defwithtemplate/request.yaml +++ b/charts/vela-core/templates/defwithtemplate/request.yaml @@ -13,11 +13,9 @@ spec: schematic: cue: template: | - import ( - "vela/op" - "vela/http" - "encoding/json" - ) + import "vela/op" + import "vela/http" + import "encoding/json" req: http.#HTTPDo & { $params: { diff --git a/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml b/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml index 120a53076..762a786e3 100644 --- a/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml +++ b/charts/vela-core/templates/defwithtemplate/share-cloud-resource.yaml @@ -14,9 +14,7 @@ spec: schematic: cue: template: | - import ( - "vela/op" - ) + import "vela/op" app: op.#ShareCloudResource & { env: parameter.env diff --git a/charts/vela-core/templates/defwithtemplate/statefulset.yaml b/charts/vela-core/templates/defwithtemplate/statefulset.yaml index e230d0686..4f00355b5 100644 --- a/charts/vela-core/templates/defwithtemplate/statefulset.yaml +++ b/charts/vela-core/templates/defwithtemplate/statefulset.yaml @@ -11,10 +11,8 @@ spec: schematic: cue: template: | - import ( - "strconv" - "strings" - ) + import "strconv" + import "strings" mountsArray: [ if parameter.volumeMounts != _|_ if parameter.volumeMounts.pvc != _|_ for v in parameter.volumeMounts.pvc { diff --git a/charts/vela-core/templates/defwithtemplate/suspend.yaml b/charts/vela-core/templates/defwithtemplate/suspend.yaml index b612c1523..db0736f5c 100644 --- a/charts/vela-core/templates/defwithtemplate/suspend.yaml +++ b/charts/vela-core/templates/defwithtemplate/suspend.yaml @@ -12,9 +12,7 @@ spec: schematic: cue: template: | - import ( - "vela/builtin" - ) + import "vela/builtin" suspend: builtin.#Suspend & { $params: parameter diff --git a/charts/vela-core/templates/defwithtemplate/vela-cli.yaml b/charts/vela-core/templates/defwithtemplate/vela-cli.yaml index e69ecacc2..db850a15d 100644 --- a/charts/vela-core/templates/defwithtemplate/vela-cli.yaml +++ b/charts/vela-core/templates/defwithtemplate/vela-cli.yaml @@ -12,11 +12,9 @@ spec: schematic: cue: template: | - import ( - "vela/kube" - "vela/builtin" - "vela/util" - ) + import "vela/kube" + import "vela/builtin" + import "vela/util" mountsArray: [ if parameter.storage != _|_ && parameter.storage.secret != _|_ for v in parameter.storage.secret { diff --git a/charts/vela-core/templates/defwithtemplate/webhook.yaml b/charts/vela-core/templates/defwithtemplate/webhook.yaml index 2d3a559e6..8d4d503cd 100644 --- a/charts/vela-core/templates/defwithtemplate/webhook.yaml +++ b/charts/vela-core/templates/defwithtemplate/webhook.yaml @@ -12,13 +12,11 @@ spec: schematic: cue: template: | - import ( - "vela/http" - "vela/kube" - "vela/util" - "encoding/json" - "encoding/base64" - ) + import "vela/http" + import "vela/kube" + import "vela/util" + import "encoding/json" + import "encoding/base64" data: { if parameter.data == _|_ { diff --git a/charts/vela-core/templates/defwithtemplate/webservice.yaml b/charts/vela-core/templates/defwithtemplate/webservice.yaml index e05f43453..32262268a 100644 --- a/charts/vela-core/templates/defwithtemplate/webservice.yaml +++ b/charts/vela-core/templates/defwithtemplate/webservice.yaml @@ -11,10 +11,8 @@ spec: schematic: cue: template: | - import ( - "strconv" - "strings" - ) + import "strconv" + import "strings" mountsArray: [ if parameter.volumeMounts != _|_ && parameter.volumeMounts.pvc != _|_ for v in parameter.volumeMounts.pvc { diff --git a/go.mod b/go.mod index 4219a0c13..9bf0a0a6f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/oam-dev/kubevela go 1.23.8 require ( - cuelang.org/go v0.9.2 + cuelang.org/go v0.14.1 github.com/AlecAivazis/survey/v2 v2.1.1 github.com/FogDong/uitable v0.0.5 github.com/Masterminds/semver v1.5.0 @@ -37,8 +37,8 @@ require ( github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 github.com/imdario/mergo v0.3.16 github.com/jeremywohl/flatten/v2 v2.0.0-20211013061545-07e4a09fb8e4 - github.com/kubevela/pkg v1.9.3-0.20250625225831-a2894a62a307 - github.com/kubevela/workflow v0.6.3-0.20250717221743-56b80cee4121 + github.com/kubevela/pkg v1.9.3-0.20251007211343-a91fd1f290c6 + github.com/kubevela/workflow v0.6.3-0.20251007211423-415593c3cee0 github.com/kyokomi/emoji v2.2.4+incompatible github.com/magiconair/properties v1.8.7 github.com/mattn/go-runewidth v0.0.15 @@ -59,21 +59,21 @@ require ( github.com/prometheus/client_model v0.6.1 github.com/rivo/tview v0.0.0-20221128165837-db36428c92d9 github.com/sirupsen/logrus v1.9.3 - github.com/spf13/cobra v1.8.1 - github.com/spf13/pflag v1.0.5 + github.com/spf13/cobra v1.9.1 + github.com/spf13/pflag v1.0.7 github.com/stretchr/testify v1.10.0 github.com/tidwall/gjson v1.14.4 github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f github.com/xlab/treeprint v1.2.0 gitlab.com/gitlab-org/api/client-go v0.127.0 go.uber.org/multierr v1.11.0 - golang.org/x/crypto v0.37.0 - golang.org/x/mod v0.24.0 - golang.org/x/oauth2 v0.29.0 - golang.org/x/sync v0.13.0 - golang.org/x/term v0.31.0 - golang.org/x/text v0.24.0 - golang.org/x/tools v0.31.0 + golang.org/x/crypto v0.40.0 + golang.org/x/mod v0.26.0 + golang.org/x/oauth2 v0.30.0 + golang.org/x/sync v0.16.0 + golang.org/x/term v0.33.0 + golang.org/x/text v0.27.0 + golang.org/x/tools v0.35.0 gomodules.xyz/jsonpatch/v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 helm.sh/helm/v3 v3.14.4 @@ -99,7 +99,7 @@ require ( ) require ( - cuelabs.dev/go/oci/ociregistry v0.0.0-20240404174027-a39bec0462d2 // indirect + cuelabs.dev/go/oci/ociregistry v0.0.0-20250715075730-49cab49c8e9d // indirect dario.cat/mergo v1.0.0 // indirect github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect @@ -134,7 +134,7 @@ require ( github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect github.com/creack/pty v1.1.18 // indirect github.com/cyphar/filepath-securejoin v0.4.1 // indirect github.com/distribution/reference v0.6.0 // indirect @@ -145,7 +145,7 @@ require ( github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/emicklei/go-restful/v3 v3.12.0 // indirect - github.com/emicklei/proto v1.10.0 // indirect + github.com/emicklei/proto v1.14.2 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/evanphx/json-patch v5.7.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect @@ -232,15 +232,16 @@ require ( github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0 // indirect + github.com/opencontainers/image-spec v1.1.1 // indirect github.com/openshift/library-go v0.0.0-20230327085348-8477ec72b725 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pjbgf/sha1cd v0.3.2 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 // indirect + github.com/protocolbuffers/txtpbfmt v0.0.0-20250627152318-f293424e46b5 // indirect github.com/rivo/uniseg v0.4.3 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -276,9 +277,10 @@ require ( go.uber.org/automaxprocs v1.5.3 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/net v0.39.0 // indirect - golang.org/x/sys v0.32.0 // indirect + golang.org/x/net v0.42.0 // indirect + golang.org/x/sys v0.34.0 // indirect golang.org/x/time v0.10.0 // indirect + golang.org/x/tools/go/expect v0.1.0-deprecated // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect diff --git a/go.sum b/go.sum index 926f357c9..cde51a131 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,9 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cuelabs.dev/go/oci/ociregistry v0.0.0-20240404174027-a39bec0462d2 h1:BnG6pr9TTr6CYlrJznYUDj6V7xldD1W+1iXPum0wT/w= -cuelabs.dev/go/oci/ociregistry v0.0.0-20240404174027-a39bec0462d2/go.mod h1:pK23AUVXuNzzTpfMCA06sxZGeVQ/75FdVtW249de9Uo= -cuelang.org/go v0.9.2 h1:pfNiry2PdRBr02G/aKm5k2vhzmqbAOoaB4WurmEbWvs= -cuelang.org/go v0.9.2/go.mod h1:qpAYsLOf7gTM1YdEg6cxh553uZ4q9ZDWlPbtZr9q1Wk= +cuelabs.dev/go/oci/ociregistry v0.0.0-20250715075730-49cab49c8e9d h1:lX0EawyoAu4kgMJJfy7MmNkIHioBcdBGFRSKDZ+CWo0= +cuelabs.dev/go/oci/ociregistry v0.0.0-20250715075730-49cab49c8e9d/go.mod h1:4WWeZNxUO1vRoZWAHIG0KZOd6dA25ypyWuwD3ti0Tdc= +cuelang.org/go v0.14.1 h1:kxFAHr7bvrCikbtVps2chPIARazVdnRmlz65dAzKyWg= +cuelang.org/go v0.14.1/go.mod h1:aSP9UZUM5m2izHAHUvqtq0wTlWn5oLjuv2iBMQZBLLs= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= @@ -144,8 +144,8 @@ github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03V github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= @@ -185,8 +185,8 @@ github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE= github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapwQtU84iWk= github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/emicklei/proto v1.10.0 h1:pDGyFRVV5RvV+nkBK9iy3q67FBy9Xa7vwrOTE+g5aGw= -github.com/emicklei/proto v1.10.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= +github.com/emicklei/proto v1.14.2 h1:wJPxPy2Xifja9cEMrcA/g08art5+7CGJNFNk35iXC1I= +github.com/emicklei/proto v1.14.2/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -476,10 +476,10 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kubevela/pkg v1.9.3-0.20250625225831-a2894a62a307 h1:6vebFO0h5vU/0gSol3l/9KlgZeuZzYhl3/DlDr0jI6E= -github.com/kubevela/pkg v1.9.3-0.20250625225831-a2894a62a307/go.mod h1:P1yK32LmSs+NRjGu3Wu45VeCeKgIXiRg4qItN1MbgA8= -github.com/kubevela/workflow v0.6.3-0.20250717221743-56b80cee4121 h1:clU2P7FyrhLm1l/xviiLO1Cen00ZI01oOfPxAOoMi0w= -github.com/kubevela/workflow v0.6.3-0.20250717221743-56b80cee4121/go.mod h1:79KSLzfgBnJboWgxy5P/1GCc2ZUOLEYlF+vS4xQ3FNo= +github.com/kubevela/pkg v1.9.3-0.20251007211343-a91fd1f290c6 h1:7REKNm1RC8pcvkYKyTD+mRMWp10+Jdkv/YqL/LE6VSE= +github.com/kubevela/pkg v1.9.3-0.20251007211343-a91fd1f290c6/go.mod h1:P5FmkdwbXKt42LOhR0oMfMiQffYYKie9s2mLDJaPzjc= +github.com/kubevela/workflow v0.6.3-0.20251007211423-415593c3cee0 h1:23CTZ0d7/KOB1TH52E+dvzKkp5vCMcrqGyyGLOelb9c= +github.com/kubevela/workflow v0.6.3-0.20251007211423-415593c3cee0/go.mod h1:8mZrIj+6Oe08ikz/IpvGFTB/WzP2stwb8G6M01TCqac= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyokomi/emoji v2.2.4+incompatible h1:np0woGKwx9LiHAQmwZx79Oc0rHpNw3o+3evou4BEPv4= @@ -596,8 +596,8 @@ github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= 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.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= -github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= +github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= +github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= github.com/openkruise/kruise-api v1.4.0 h1:MDDXQIYvaCh0ioIJSRniF4kCKby9JI3/ec6pZHHw/Ao= github.com/openkruise/kruise-api v1.4.0/go.mod h1:HyRlDV0MfW5Zm+3g36bx7u4CcWHcKBxL8g/c/2bjcd4= github.com/openkruise/rollouts v0.3.0 h1:T02r9BxHJ02MRkbc7C4F12qMGgrziZVjgmukwz6k60s= @@ -607,6 +607,8 @@ github.com/openshift/library-go v0.0.0-20230327085348-8477ec72b725/go.mod h1:Osp github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= @@ -655,8 +657,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 h1:sadMIsgmHpEOGbUs6VtHBXRR1OHevnj7hLx9ZcdNGW4= -github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c= +github.com/protocolbuffers/txtpbfmt v0.0.0-20250627152318-f293424e46b5 h1:WWs1ZFnGobK5ZXNu+N9If+8PDNVB9xAqrib/stUXsV4= +github.com/protocolbuffers/txtpbfmt v0.0.0-20250627152318-f293424e46b5/go.mod h1:BnHogPTyzYAReeQLZrOxyxzS739DaTNtTvohVdbENmA= github.com/rivo/tview v0.0.0-20221128165837-db36428c92d9 h1:ccTgRxA37ypj3q8zB8G4k3xGPfBbIaMwrf3Yw6k50NY= github.com/rivo/tview v0.0.0-20221128165837-db36428c92d9/go.mod h1:YX2wUZOcJGOIycErz2s9KvDaP0jnWwRCirQMPLPpQ+Y= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -691,10 +693,12 @@ github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= +github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -817,8 +821,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= -golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= +golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= +golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= @@ -833,8 +837,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= -golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= +golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -861,8 +865,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= -golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -870,8 +874,8 @@ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.29.0 h1:WdYw2tdTK1S8olAzWHdgeqfy+Mtm9XNhv/xJsY65d98= -golang.org/x/oauth2 v0.29.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= +golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= +golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -882,8 +886,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= -golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -922,16 +926,16 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= -golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= +golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o= -golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw= +golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= +golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -942,8 +946,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= -golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= +golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4= golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= @@ -960,8 +964,12 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= -golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= +golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= +golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools/go/expect v0.1.0-deprecated h1:jY2C5HGYR5lqex3gEniOQL0r7Dq5+VGVgY1nudX5lXY= +golang.org/x/tools/go/expect v0.1.0-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/makefiles/dependency.mk b/makefiles/dependency.mk index 8e9e3bc76..ac8be1787 100644 --- a/makefiles/dependency.mk +++ b/makefiles/dependency.mk @@ -50,7 +50,7 @@ else GOIMPORTS=$(shell which goimports) endif -CUE_VERSION ?= v0.9.2 +CUE_VERSION ?= v0.14.1 .PHONY: installcue installcue: ifeq (, $(shell which cue)) diff --git a/pkg/builtin/http/http.go b/pkg/builtin/http/http.go index d58d3fe7f..4b6edc8af 100644 --- a/pkg/builtin/http/http.go +++ b/pkg/builtin/http/http.go @@ -152,7 +152,7 @@ func parseHeaders(obj cue.Value, label string) (http.Header, error) { if err != nil { return nil, err } - h.Add(iter.Label(), str) + h.Add(iter.Selector().Unquoted(), str) } return h, nil } diff --git a/pkg/controller/core.oam.dev/v1beta1/application/application_controller_test.go b/pkg/controller/core.oam.dev/v1beta1/application/application_controller_test.go index fc09f3359..19cd3bef3 100644 --- a/pkg/controller/core.oam.dev/v1beta1/application/application_controller_test.go +++ b/pkg/controller/core.oam.dev/v1beta1/application/application_controller_test.go @@ -1477,7 +1477,7 @@ var _ = Describe("Test Application Controller", func() { Outputs: workflowv1alpha1.StepOutputs{ { Name: "output", - ValueFrom: "context.name", + ValueFrom: `"app-with-skip-output"`, }, }, Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)}, @@ -1492,7 +1492,7 @@ var _ = Describe("Test Application Controller", func() { ParameterKey: "", }, }, - If: `inputs.output == "app-with-timeout-output"`, + If: `inputs.output == "app-with-skip-output"`, Type: "apply-component", Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)}, }, diff --git a/pkg/controller/core.oam.dev/v1beta1/application/testdata/definitions/panic.yaml b/pkg/controller/core.oam.dev/v1beta1/application/testdata/definitions/panic.yaml index 33e68af8b..273131915 100644 --- a/pkg/controller/core.oam.dev/v1beta1/application/testdata/definitions/panic.yaml +++ b/pkg/controller/core.oam.dev/v1beta1/application/testdata/definitions/panic.yaml @@ -8,6 +8,8 @@ spec: schematic: cue: template: | + import "list" + pvcVolumesList: *[ for v in parameter.pvc if v.mountPath != _|_ { { @@ -24,7 +26,7 @@ spec: } }, ] | [] - volumesList: pvcVolumesList + configMapVolumesList + volumesList: list.Concat([pvcVolumesList, configMapVolumesList]) deDupVolumesArray: [ for val in [ for i, vi in volumesList { diff --git a/pkg/cue/convert.go b/pkg/cue/convert.go index 93dffd826..267b8d4df 100644 --- a/pkg/cue/convert.go +++ b/pkg/cue/convert.go @@ -47,8 +47,9 @@ func GetParameters(templateStr string) ([]types.Parameter, error) { if iter.Selector().IsDefinition() { continue } + name := GetSelectorLabel(iter.Selector()) var param = types.Parameter{ - Name: iter.Label(), + Name: name, Required: !iter.IsOptional(), } val := iter.Value() diff --git a/pkg/cue/convert_test.go b/pkg/cue/convert_test.go index 7cf0da082..496b3c26f 100644 --- a/pkg/cue/convert_test.go +++ b/pkg/cue/convert_test.go @@ -78,4 +78,25 @@ func TestGetParameter(t *testing.T) { } } assert.Equal(t, flag, true) + + // Test pattern parameter selectors which would cause panic with Unquoted() + data, _ = os.ReadFile("testdata/workloads/pattern-params.cue") + params, err = GetParameters(string(data)) + assert.NoError(t, err) // Should not panic + // We should get the regular parameters but pattern selectors are handled safely + assert.GreaterOrEqual(t, len(params), 2) // At least name and port + foundName := false + foundPort := false + for _, p := range params { + if p.Name == "name" { + foundName = true + assert.Equal(t, cue.StringKind, p.Type) + } + if p.Name == "port" { + foundPort = true + assert.Equal(t, int64(8080), p.Default) + } + } + assert.True(t, foundName, "Should find 'name' parameter") + assert.True(t, foundPort, "Should find 'port' parameter") } diff --git a/pkg/cue/definition/health/health.go b/pkg/cue/definition/health/health.go index ebcbfd50a..e7a3faab9 100644 --- a/pkg/cue/definition/health/health.go +++ b/pkg/cue/definition/health/health.go @@ -27,6 +27,8 @@ import ( "github.com/kubevela/workflow/pkg/cue/model/value" "github.com/pkg/errors" "k8s.io/klog/v2" + + velacue "github.com/oam-dev/kubevela/pkg/cue" ) const ( @@ -143,7 +145,8 @@ func getStatusMap(templateContext map[string]interface{}, statusFields string, p return templateContext, nil, errors.WithMessage(err, "get context fields") } for iter.Next() { - contextLabels = append(contextLabels, iter.Label()) + label := velacue.GetSelectorLabel(iter.Selector()) + contextLabels = append(contextLabels, label) } cueBuffer := runtimeContextBuff + "\n" + statusFields @@ -160,7 +163,7 @@ func getStatusMap(templateContext map[string]interface{}, statusFields string, p outer: for iter.Next() { - label := iter.Label() + label := velacue.GetSelectorLabel(iter.Selector()) if len(label) >= 32 { klog.Warningf("status.details field label %s is too long, skipping", label) diff --git a/pkg/cue/definition/health/health_test.go b/pkg/cue/definition/health/health_test.go index 7420baaa2..f7319ed24 100644 --- a/pkg/cue/definition/health/health_test.go +++ b/pkg/cue/definition/health/health_test.go @@ -476,11 +476,11 @@ func TestContextPassing(t *testing.T) { statusCtx := ctx["status"].(map[string]interface{}) details := statusCtx["details"].(map[string]interface{}) - assert.Equal(t, 3, details["replicas"]) - assert.Equal(t, 8080, details["port"]) + assert.Equal(t, int64(3), details["replicas"]) + assert.Equal(t, int64(8080), details["port"]) assert.Equal(t, true, details["isReady"]) assert.Equal(t, true, details["configEnabled"]) - assert.Equal(t, 30, details["configTimeout"]) + assert.Equal(t, int64(30), details["configTimeout"]) assert.Nil(t, details["config"]) }, @@ -518,9 +518,9 @@ func TestContextPassing(t *testing.T) { ports := details["$ports"].([]interface{}) assert.Len(t, ports, 3) - assert.Equal(t, 80, ports[0]) - assert.Equal(t, 443, ports[1]) - assert.Equal(t, 8080, ports[2]) + assert.Equal(t, int64(80), ports[0]) + assert.Equal(t, int64(443), ports[1]) + assert.Equal(t, int64(8080), ports[2]) protocols := details["$protocols"].([]interface{}) assert.Len(t, protocols, 3) @@ -530,8 +530,8 @@ func TestContextPassing(t *testing.T) { mappings := details["$mappings"].([]interface{}) assert.Len(t, mappings, 2) - assert.Equal(t, 3, details["portCount"]) - assert.Equal(t, 80, details["firstPort"]) + assert.Equal(t, int64(3), details["portCount"]) + assert.Equal(t, int64(80), details["firstPort"]) assert.Equal(t, "http", details["mainProtocol"]) assert.Equal(t, "80,443,8080", details["portsString"]) }, @@ -631,9 +631,9 @@ func TestContextPassing(t *testing.T) { statusCtx := ctx["status"].(map[string]interface{}) details := statusCtx["details"].(map[string]interface{}) - assert.Equal(t, 2, details["$multiplier"]) - assert.Equal(t, 5, details["$offset"]) - assert.Equal(t, 25, details["result"]) + assert.Equal(t, int64(2), details["$multiplier"]) + assert.Equal(t, int64(5), details["$offset"]) + assert.Equal(t, int64(25), details["result"]) assert.Equal(t, "Result is 25", details["displayText"]) }, }, @@ -670,8 +670,8 @@ func TestContextPassing(t *testing.T) { statusCtx := ctx["status"].(map[string]interface{}) assert.Equal(t, false, statusCtx["healthy"]) details := statusCtx["details"].(map[string]interface{}) - assert.Equal(t, 5, details["replicas"]) - assert.Equal(t, 3, details["readyReplicas"]) + assert.Equal(t, int64(5), details["replicas"]) + assert.Equal(t, int64(3), details["readyReplicas"]) }, }, "message-references-health-and-details": { @@ -781,3 +781,185 @@ func TestContextPassing(t *testing.T) { }) } } + +func TestGetStatusWithDefinitionAndHiddenLabels(t *testing.T) { + testCases := []struct { + name string + templateContext map[string]interface{} + statusFields string + wantNoErr bool + description string + }{ + { + name: "handles definition labels without panic", + templateContext: map[string]interface{}{ + "output": map[string]interface{}{ + "metadata": map[string]interface{}{ + "name": "test", + }, + }, + }, + statusFields: ` +#SomeDefinition: { + name: string + type: string +} + +status: #SomeDefinition & { + name: "test" + type: "healthy" +} +`, + wantNoErr: true, + description: "Should handle definition labels (#SomeDefinition) without panicking", + }, + { + name: "handles hidden labels without panic", + templateContext: map[string]interface{}{ + "output": map[string]interface{}{ + "metadata": map[string]interface{}{ + "name": "test", + }, + }, + }, + statusFields: ` +_hiddenField: "internal" + +status: { + name: "test" + internal: _hiddenField +} +`, + wantNoErr: true, + description: "Should handle hidden labels (_hiddenField) without panicking", + }, + { + name: "handles pattern labels without panic", + templateContext: map[string]interface{}{ + "output": map[string]interface{}{ + "metadata": map[string]interface{}{ + "name": "test", + }, + }, + }, + statusFields: ` +[string]: _ + +status: { + name: "test" + healthy: true +} +`, + wantNoErr: true, + description: "Should handle pattern labels ([string]: _) without panicking", + }, + { + name: "handles mixed label types without panic", + templateContext: map[string]interface{}{ + "output": map[string]interface{}{ + "metadata": map[string]interface{}{ + "name": "test", + }, + }, + }, + statusFields: ` +#Definition: { + field: string +} + +_hidden: "value" + +normalField: "visible" + +status: { + name: normalField + type: _hidden + def: #Definition & {field: "test"} +} +`, + wantNoErr: true, + description: "Should handle mixed label types without panicking", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + request := &StatusRequest{ + Details: tc.statusFields, + Parameter: map[string]interface{}{}, + } + + // This should not panic even with definition or hidden labels + result, err := GetStatus(tc.templateContext, request) + + if tc.wantNoErr { + // We expect no panic and a valid result + assert.NotNil(t, result, tc.description) + // The function may return an error for invalid CUE, but it shouldn't panic + if err != nil { + t.Logf("Got expected error (non-panic): %v", err) + } + } else { + assert.Error(t, err, tc.description) + } + }) + } +} + +func TestGetStatusMapWithComplexSelectors(t *testing.T) { + // Test that getStatusMap doesn't panic with various selector types + testCases := []struct { + name string + statusFields string + templateContext map[string]interface{} + shouldNotPanic bool + }{ + { + name: "definition selector in context", + statusFields: ` +#Config: { + enabled: bool +} + +config: #Config & { + enabled: true +} +`, + templateContext: map[string]interface{}{}, + shouldNotPanic: true, + }, + { + name: "hidden field selector", + statusFields: ` +_internal: { + secret: "hidden" +} + +public: _internal.secret +`, + templateContext: map[string]interface{}{}, + shouldNotPanic: true, + }, + { + name: "optional field selector", + statusFields: ` +optional?: string + +required: string | *"default" +`, + templateContext: map[string]interface{}{}, + shouldNotPanic: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + if tc.shouldNotPanic { + // The function should not panic + assert.NotPanics(t, func() { + _, _, _ = getStatusMap(tc.templateContext, tc.statusFields, nil) + }, "getStatusMap should not panic with %s", tc.name) + } + }) + } +} diff --git a/pkg/cue/definition/template.go b/pkg/cue/definition/template.go index b16e92a56..0a11760ef 100644 --- a/pkg/cue/definition/template.go +++ b/pkg/cue/definition/template.go @@ -38,6 +38,7 @@ import ( "github.com/kubevela/workflow/pkg/cue/model/value" "github.com/kubevela/workflow/pkg/cue/process" + velacue "github.com/oam-dev/kubevela/pkg/cue" velaprocess "github.com/oam-dev/kubevela/pkg/cue/process" "github.com/oam-dev/kubevela/pkg/cue/task" "github.com/oam-dev/kubevela/pkg/oam" @@ -139,7 +140,7 @@ func (wd *workloadDef) Complete(ctx process.Context, abstractTemplate string, pa continue } other, err := model.NewOther(iter.Value()) - name := iter.Label() + name := velacue.GetSelectorLabel(iter.Selector()) if err != nil { return errors.WithMessagef(err, "invalid outputs(%s) of workload %s", name, wd.name) } @@ -272,7 +273,7 @@ func (td *traitDef) Complete(ctx process.Context, abstractTemplate string, param continue } other, err := model.NewOther(iter.Value()) - name := iter.Label() + name := velacue.GetSelectorLabel(iter.Selector()) if err != nil { return errors.WithMessagef(err, "invalid outputs(resource=%s) of trait %s", name, td.name) } diff --git a/pkg/cue/testdata/workloads/pattern-params.cue b/pkg/cue/testdata/workloads/pattern-params.cue new file mode 100644 index 000000000..74a2fe69d --- /dev/null +++ b/pkg/cue/testdata/workloads/pattern-params.cue @@ -0,0 +1,16 @@ +// Test template with pattern parameter selectors +parameter: { + // Regular string parameter + name: string + + // Pattern parameter selector - this would cause Unquoted() to panic + [string]: _ + + // Another regular parameter + port: *8080 | int +} + +output: { + apiVersion: "apps/v1" + kind: "Deployment" +} \ No newline at end of file diff --git a/pkg/cue/utils.go b/pkg/cue/utils.go new file mode 100644 index 000000000..88ca22e78 --- /dev/null +++ b/pkg/cue/utils.go @@ -0,0 +1,33 @@ +/* +Copyright 2021 The KubeVela 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 cue + +import "cuelang.org/go/cue" + +// GetSelectorLabel safely extracts a label from a CUE selector. +// It uses String() by default to avoid panics on pattern parameter selectors, +// and only uses Unquoted() when it's safe (i.e., for StringLabel with concrete names). +// This prevents panics that would occur when calling Unquoted() on pattern constraints like [string]: T. +func GetSelectorLabel(selector cue.Selector) string { + // Use String() as a safe default + label := selector.String() + // If it's a quoted string, unquote it safely + if selector.IsString() && selector.LabelType() == cue.StringLabel { + label = selector.Unquoted() + } + return label +} diff --git a/pkg/definition/definition.go b/pkg/definition/definition.go index 2afe1dd1f..cac7e22e0 100644 --- a/pkg/definition/definition.go +++ b/pkg/definition/definition.go @@ -225,18 +225,25 @@ func (def *Definition) ToCUEString() (string, error) { if err != nil { return "", errors.Wrapf(err, "failed to parse template cue string") } + + // Extract imports before fix.File() clears them + importPaths := extractImportsFromFile(f) + f = fix.File(f) - var importDecls, templateDecls []ast.Decl + var templateDecls []ast.Decl for _, decl := range f.Decls { - if importDecl, ok := decl.(*ast.ImportDecl); ok { - importDecls = append(importDecls, importDecl) - } else { + if _, ok := decl.(*ast.ImportDecl); !ok { templateDecls = append(templateDecls, decl) } } - importString, err := encodeDeclsToString(importDecls) - if err != nil { - return "", errors.Wrapf(err, "failed to encode import decls") + var importString string + if len(importPaths) > 0 { + // Reconstruct import statements from extracted paths + var importLines []string + for _, importPath := range importPaths { + importLines = append(importLines, fmt.Sprintf("import %s", importPath)) + } + importString = strings.Join(importLines, "\n") + "\n" } templateString, err = encodeDeclsToString(templateDecls) if err != nil { @@ -244,7 +251,12 @@ func (def *Definition) ToCUEString() (string, error) { } templateString = fmt.Sprintf("template: {\n%s}", templateString) - completeCUEString := importString + "\n" + metadataString + "\n" + templateString + var completeCUEString string + if importString != "" { + completeCUEString = importString + "\n" + metadataString + "\n" + templateString + } else { + completeCUEString = metadataString + "\n" + templateString + } if completeCUEString, err = formatCUEString(completeCUEString); err != nil { return "", errors.Wrapf(err, "failed to format cue format string") } @@ -647,17 +659,68 @@ func GetDefinitionDefaultSpec(kind string) map[string]interface{} { return map[string]interface{}{} } +// extractImportsFromFile extracts import paths from an AST file before fix.File() clears them. +// This is necessary because fix.File() removes import declarations that are not directly used. +// Returns a slice of import paths, where named imports are formatted as "name path". +func extractImportsFromFile(f *ast.File) []string { + var importPaths []string + for _, decl := range f.Decls { + if importDecl, ok := decl.(*ast.ImportDecl); ok { + for _, spec := range importDecl.Specs { + if spec.Path != nil { + importPath := spec.Path.Value + if spec.Name != nil { + // Handle named imports + importPaths = append(importPaths, fmt.Sprintf("%s %s", spec.Name.Name, importPath)) + } else { + importPaths = append(importPaths, importPath) + } + } + } + } + } + return importPaths +} + func formatCUEString(cueString string) (string, error) { f, err := parser.ParseFile("-", cueString, parser.ParseComments) if err != nil { return "", errors.Wrapf(err, "failed to parse file during format cue string") } + + // Extract imports before fix.File() clears them + importPaths := extractImportsFromFile(f) + n := fix.File(f) - b, err := format.Node(n, format.Simplify()) - if err != nil { - return "", errors.Wrapf(err, "failed to format node during formating cue string") + + // Format only non-import declarations + var nonImportDecls []ast.Decl + for _, decl := range n.Decls { + if _, ok := decl.(*ast.ImportDecl); !ok { + nonImportDecls = append(nonImportDecls, decl) + } } - return string(b), nil + + var result strings.Builder + + // Add imports first + if len(importPaths) > 0 { + for _, importPath := range importPaths { + result.WriteString(fmt.Sprintf("import %s\n", importPath)) + } + result.WriteString("\n") + } + + // Format and add other declarations + if len(nonImportDecls) > 0 { + b, err := format.Node(&ast.File{Decls: nonImportDecls}, format.Simplify()) + if err != nil { + return "", errors.Wrapf(err, "failed to format node during formating cue string") + } + result.WriteString(string(b)) + } + + return result.String(), nil } func findAndDecodeFieldByLabel(slit *ast.StructLit, targetLabel string) (*ast.Field, error) { diff --git a/pkg/definition/gen_sdk/testdata/apply-terraform-provider.cue b/pkg/definition/gen_sdk/testdata/apply-terraform-provider.cue index 4404d389a..37cf99914 100644 --- a/pkg/definition/gen_sdk/testdata/apply-terraform-provider.cue +++ b/pkg/definition/gen_sdk/testdata/apply-terraform-provider.cue @@ -83,9 +83,9 @@ template: { } } providerBasic: { - accessKey: string - secretKey: string - region: string + accessKey!: string + secretKey!: string + region!: string } #AlibabaProvider: { providerBasic @@ -137,5 +137,5 @@ template: { type: "ucloud" name: *"ucloud-provider" | string } - parameter: *#AlibabaProvider | #AWSProvider | #AzureProvider | #BaiduProvider | #ECProvider | #GCPProvider | #TencentProvider | #UCloudProvider + parameter: #AlibabaProvider | #AWSProvider | #AzureProvider | #BaiduProvider | #ECProvider | #GCPProvider | #TencentProvider | #UCloudProvider } diff --git a/references/cli/adopt-templates/default.cue b/references/cli/adopt-templates/default.cue index cae5e499d..0e06ae071 100644 --- a/references/cli/adopt-templates/default.cue +++ b/references/cli/adopt-templates/default.cue @@ -138,7 +138,7 @@ import ( metadata: name: r.metadata.name }] }, - for r in resourceMap.workload + resourceMap.service { + for r in list.Concat([resourceMap.workload, resourceMap.service]) { type: "k8s-objects" name: _prefix + strings.ToLower("\(r.kind)-\(r.metadata.name)") properties: objects: [{ diff --git a/references/cli/debug.go b/references/cli/debug.go index 93debae14..ff8878c62 100644 --- a/references/cli/debug.go +++ b/references/cli/debug.go @@ -322,7 +322,7 @@ func (d *debugOpts) separateBySteps(v cue.Value, ioStreams cmdutil.IOStreams) er if it.Value().IncompleteKind() == cue.BottomKind { break } - fieldName := it.Label() + fieldName := it.Selector().String() fieldList = append(fieldList, fieldName) fieldMap[fieldName] = it.Value() } diff --git a/references/cli/revision_test.go b/references/cli/revision_test.go index 8cbf53dbe..fb79fa4aa 100644 --- a/references/cli/revision_test.go +++ b/references/cli/revision_test.go @@ -59,9 +59,9 @@ metadata: spec: schematic: cue: - template: "import (\n\t\"strconv\"\n)\n\nmountsArray: {\n\tpvc: *[\n\t\tfor - v in parameter.volumeMounts.pvc {\n\t\t\t{\n\t\t\t\tmountPath: v.mountPath\n\t\t\t\tif - v.subPath != _|_ {\n\t\t\t\t\tsubPath: v.subPath\n\t\t\t\t}\n\t\t\t\tname: + template: "import (\n\t\"strconv\"\n\t\"list\"\n)\n\nmountsArray: {\n\tpvc: + *[\n\t\tfor v in parameter.volumeMounts.pvc {\n\t\t\t{\n\t\t\t\tmountPath: + v.mountPath\n\t\t\t\tif v.subPath != _|_ {\n\t\t\t\t\tsubPath: v.subPath\n\t\t\t\t}\n\t\t\t\tname: v.name\n\t\t\t}\n\t\t},\n\t] | []\n\n\tconfigMap: *[\n\t\t\tfor v in parameter.volumeMounts.configMap {\n\t\t\t{\n\t\t\t\tmountPath: v.mountPath\n\t\t\t\tif v.subPath != _|_ {\n\t\t\t\t\tsubPath: v.subPath\n\t\t\t\t}\n\t\t\t\tname: v.name\n\t\t\t}\n\t\t},\n\t] | []\n\n\tsecret: @@ -85,11 +85,11 @@ spec: v.name\n\t\t\t\temptyDir: medium: v.medium\n\t\t\t}\n\t\t},\n\t] | []\n\n\thostPath: *[\n\t\t\tfor v in parameter.volumeMounts.hostPath {\n\t\t\t{\n\t\t\t\tname: v.name\n\t\t\t\thostPath: path: v.path\n\t\t\t}\n\t\t},\n\t] | []\n}\nvolumesList: - volumesArray.pvc + volumesArray.configMap + volumesArray.secret + volumesArray.emptyDir - + volumesArray.hostPath\ndeDupVolumesArray: [\n\tfor val in [\n\t\tfor i, - vi in volumesList {\n\t\t\tfor j, vj in volumesList if j < i && vi.name == - vj.name {\n\t\t\t\t_ignore: true\n\t\t\t}\n\t\t\tvi\n\t\t},\n\t] if val._ignore - == _|_ {\n\t\tval\n\t},\n]\noutput: {\n\tapiVersion: \"apps/v1\"\n\tkind: + list.Concat([volumesArray.pvc, volumesArray.configMap, volumesArray.secret, + volumesArray.emptyDir, volumesArray.hostPath])\ndeDupVolumesArray: [\n\tfor + val in [\n\t\tfor i, vi in volumesList {\n\t\t\tfor j, vj in volumesList if + j < i && vi.name == vj.name {\n\t\t\t\t_ignore: true\n\t\t\t}\n\t\t\tvi\n\t\t},\n\t] + if val._ignore == _|_ {\n\t\tval\n\t},\n]\noutput: {\n\tapiVersion: \"apps/v1\"\n\tkind: \ \"Deployment\"\n\tspec: {\n\t\tselector: matchLabels: \"app.oam.dev/component\": context.name\n\n\t\ttemplate: {\n\t\t\tmetadata: {\n\t\t\t\tlabels: {\n\t\t\t\t\tif parameter.labels != _|_ {\n\t\t\t\t\t\tparameter.labels\n\t\t\t\t\t}\n\t\t\t\t\tif @@ -115,8 +115,8 @@ spec: parameter[\"volumes\"] != _|_ && parameter[\"volumeMounts\"] == _|_ {\n\t\t\t\t\t\tvolumeMounts: [ for v in parameter.volumes {\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmountPath: v.mountPath\n\t\t\t\t\t\t\t\tname: v.name\n\t\t\t\t\t\t\t}}]\n\t\t\t\t\t}\n\n\t\t\t\t\tif - parameter[\"volumeMounts\"] != _|_ {\n\t\t\t\t\t\tvolumeMounts: mountsArray.pvc - + mountsArray.configMap + mountsArray.secret + mountsArray.emptyDir + mountsArray.hostPath\n\t\t\t\t\t}\n\n\t\t\t\t\tif + parameter[\"volumeMounts\"] != _|_ {\n\t\t\t\t\t\tvolumeMounts: list.Concat([mountsArray.pvc, + mountsArray.configMap, mountsArray.secret, mountsArray.emptyDir, mountsArray.hostPath])\n\t\t\t\t\t}\n\n\t\t\t\t\tif parameter[\"livenessProbe\"] != _|_ {\n\t\t\t\t\t\tlivenessProbe: parameter.livenessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tif parameter[\"readinessProbe\"] != _|_ {\n\t\t\t\t\t\treadinessProbe: parameter.readinessProbe\n\t\t\t\t\t}\n\n\t\t\t\t}]\n\n\t\t\t\tif parameter[\"hostAliases\"] != _|_ {\n\t\t\t\t\t// +patchKey=ip\n\t\t\t\t\thostAliases: @@ -305,7 +305,7 @@ spec: spec: schematic: cue: - template: "import (\n\t\"strconv\"\n)\n\nmountsArray: {\n\tpvc: *[\n\t\tfor + template: "import (\n\t\"strconv\"\n\t\"list\"\n)\n\nmountsArray: {\n\tpvc: *[\n\t\tfor v in parameter.volumeMounts.pvc {\n\t\t\t{\n\t\t\t\tmountPath: v.mountPath\n\t\t\t\tif v.subPath != _|_ {\n\t\t\t\t\tsubPath: v.subPath\n\t\t\t\t}\n\t\t\t\tname: v.name\n\t\t\t}\n\t\t},\n\t] | []\n\n\tconfigMap: *[\n\t\t\tfor v in @@ -333,8 +333,7 @@ spec: {\n\t\t\t{\n\t\t\t\tname: v.name\n\t\t\t\temptyDir: medium: v.medium\n\t\t\t}\n\t\t},\n\t] | []\n\n\thostPath: *[\n\t\t\tfor v in parameter.volumeMounts.hostPath {\n\t\t\t{\n\t\t\t\tname: v.name\n\t\t\t\thostPath: path: v.path\n\t\t\t}\n\t\t},\n\t] - | []\n}\nvolumesList: volumesArray.pvc + volumesArray.configMap + volumesArray.secret - + volumesArray.emptyDir + volumesArray.hostPath\ndeDupVolumesArray: + | []\n}\nvolumesList: list.Concat([volumesArray.pvc, volumesArray.configMap, volumesArray.secret, volumesArray.emptyDir, volumesArray.hostPath])\ndeDupVolumesArray: [\n\tfor val in [\n\t\tfor i, vi in volumesList {\n\t\t\tfor j, vj in volumesList if j < i && vi.name == vj.name {\n\t\t\t\t_ignore: true\n\t\t\t}\n\t\t\tvi\n\t\t},\n\t] if val._ignore == _|_ {\n\t\tval\n\t},\n]\noutput: {\n\tapiVersion: @@ -365,9 +364,7 @@ spec: parameter[\"volumes\"] != _|_ && parameter[\"volumeMounts\"] == _|_ {\n\t\t\t\t\t\tvolumeMounts: [ for v in parameter.volumes {\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmountPath: v.mountPath\n\t\t\t\t\t\t\t\tname: v.name\n\t\t\t\t\t\t\t}}]\n\t\t\t\t\t}\n\n\t\t\t\t\tif - parameter[\"volumeMounts\"] != _|_ {\n\t\t\t\t\t\tvolumeMounts: mountsArray.pvc - + mountsArray.configMap + mountsArray.secret + mountsArray.emptyDir - + mountsArray.hostPath\n\t\t\t\t\t}\n\n\t\t\t\t\tif parameter[\"livenessProbe\"] + parameter[\"volumeMounts\"] != _|_ {\n\t\t\t\t\t\tvolumeMounts: list.Concat([mountsArray.pvc, mountsArray.configMap, mountsArray.secret, mountsArray.emptyDir, mountsArray.hostPath])\n\t\t\t\t\t}\n\n\t\t\t\t\tif parameter[\"livenessProbe\"] != _|_ {\n\t\t\t\t\t\tlivenessProbe: parameter.livenessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tif parameter[\"readinessProbe\"] != _|_ {\n\t\t\t\t\t\treadinessProbe: parameter.readinessProbe\n\t\t\t\t\t}\n\n\t\t\t\t}]\n\n\t\t\t\tif parameter[\"hostAliases\"] diff --git a/references/cuegen/convert.go b/references/cuegen/convert.go index 9469815ec..4541b2676 100644 --- a/references/cuegen/convert.go +++ b/references/cuegen/convert.go @@ -252,8 +252,7 @@ func (g *Generator) addFields(st *cueast.StructLit, x *gotypes.Struct, names map // process field with optional tag(omitempty in json tag) if opts.Optional { - f.Token = cuetoken.COLON - f.Optional = cuetoken.Blank.Pos() + f.Constraint = cuetoken.OPTION } makeComments(f, comments[i]) diff --git a/references/docgen/parser_test.go b/references/docgen/parser_test.go index c01c48b45..74a6be274 100644 --- a/references/docgen/parser_test.go +++ b/references/docgen/parser_test.go @@ -749,7 +749,7 @@ func TestExtractParameterFromFiles(t *testing.T) { containerName | Specify the name of the target container, if not set, use the component name. | string | false | empty replace | Specify if replacing the whole environment settings for the container. | bool | false | false env | Specify the environment variables to merge, if key already existing, override its value. | map[string]string | true | - unset | Specify which existing environment variables to unset. | []string | true | + unset | Specify which existing environment variables to unset. | list | true | #### type-option-2 @@ -766,7 +766,7 @@ func TestExtractParameterFromFiles(t *testing.T) { containerName | Specify the name of the target container, if not set, use the component name. | string | false | empty replace | Specify if replacing the whole environment settings for the container. | bool | false | false env | Specify the environment variables to merge, if key already existing, override its value. | map[string]string | true | - unset | Specify which existing environment variables to unset. | []string | true |`, + unset | Specify which existing environment variables to unset. | list | true |`, }, "command": { path: "testdata/parameter/command.cue", @@ -819,8 +819,8 @@ func TestExtractParameterFromFiles(t *testing.T) { Name | Description | Type | Required | Default ---- | ----------- | ---- | -------- | ------- name | | string | true | - defaultMode | only works when type equals configmap. | int | false | 420 - type | | "configMap" or "secret" or "emptyDir" or "ephemeral" | false | configMap`, + type | | "configMap" or "secret" or "emptyDir" or "ephemeral" | false | configMap + defaultMode | only works when type equals configmap. | int | false | 420 `, }, } for key, ca := range testcases { diff --git a/references/docgen/provider.go b/references/docgen/provider.go index 16815b879..fa8069151 100644 --- a/references/docgen/provider.go +++ b/references/docgen/provider.go @@ -27,6 +27,8 @@ import ( "cuelang.org/go/cue" "cuelang.org/go/cue/cuecontext" "golang.org/x/sync/errgroup" + + velacue "github.com/oam-dev/kubevela/pkg/cue" ) // GenerateProvidersMarkdown generates markdown documentation for providers. @@ -99,8 +101,9 @@ func GenerateProviderMarkdown(provider io.Reader, w io.Writer) error { pkg = t } - // header - fmt.Fprintf(docs, "## %s\n", iter.Label()) + // header - handle both string and non-string selectors + selectorStr := velacue.GetSelectorLabel(iter.Selector()) + fmt.Fprintf(docs, "## %s\n", selectorStr) doc, _, err := ref.parseParameters("", item.LookupPath(cue.ParsePath(paramsKey)), "*Params*", 0, true) if err != nil { diff --git a/test/e2e-multicluster-test/multicluster_standalone_test.go b/test/e2e-multicluster-test/multicluster_standalone_test.go index 882a827ac..1eb44e2a3 100644 --- a/test/e2e-multicluster-test/multicluster_standalone_test.go +++ b/test/e2e-multicluster-test/multicluster_standalone_test.go @@ -291,28 +291,28 @@ var _ = Describe("Test multicluster standalone scenario", func() { Eventually(func(g Gomega) { g.Expect(k8sClient.Get(hubCtx, appKey, app)).Should(Succeed()) g.Expect(app.Status.Phase).Should(Equal(oamcomm.ApplicationRunning)) - }).WithTimeout(5 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) + }).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) By("Verify deployment image rollback") Eventually(func(g Gomega) { deploy := &v1.Deployment{} g.Expect(k8sClient.Get(workerCtx, types.NamespacedName{Namespace: namespace, Name: "busybox"}, deploy)).Should(Succeed()) g.Expect(deploy.Spec.Template.Spec.Containers[0].Image).Should(Equal("busybox")) - }).WithTimeout(5 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) + }).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) By("Verify referred object state rollback") Eventually(func(g Gomega) { deploy := &v1.Deployment{} g.Expect(k8sClient.Get(workerCtx, types.NamespacedName{Namespace: namespace, Name: "busybox-ref"}, deploy)).Should(Succeed()) g.Expect(deploy.Spec.Replicas).Should(Equal(ptr.To(int32(0)))) - }).WithTimeout(5 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) + }).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) By("Verify application revisions") Eventually(func(g Gomega) { revs, err := application.GetSortedAppRevisions(hubCtx, k8sClient, app.Name, namespace) g.Expect(err).Should(Succeed()) g.Expect(len(revs)).Should(BeNumerically(">=", 1)) - }).WithTimeout(5 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) + }).WithTimeout(10 * time.Minute).WithPolling(5 * time.Second).Should(Succeed()) }) It("Test large application parallel apply and delete", func() { diff --git a/test/e2e-test/testdata/definition/replica-webservice.yaml b/test/e2e-test/testdata/definition/replica-webservice.yaml index e48573705..559575d9d 100644 --- a/test/e2e-test/testdata/definition/replica-webservice.yaml +++ b/test/e2e-test/testdata/definition/replica-webservice.yaml @@ -14,6 +14,7 @@ spec: template: | import ( "strconv" + "list" ) mountsArray: { @@ -135,7 +136,7 @@ spec: }, ] | [] } - volumesList: volumesArray.pvc + volumesArray.configMap + volumesArray.secret + volumesArray.emptyDir + volumesArray.hostPath + volumesList: list.Concat([volumesArray.pvc, volumesArray.configMap, volumesArray.secret, volumesArray.emptyDir, volumesArray.hostPath]) deDupVolumesArray: [ for val in [ for i, vi in volumesList { @@ -250,7 +251,7 @@ spec: } if parameter["volumeMounts"] != _|_ { - volumeMounts: mountsArray.pvc + mountsArray.configMap + mountsArray.secret + mountsArray.emptyDir + mountsArray.hostPath + volumeMounts: list.Concat([mountsArray.pvc, mountsArray.configMap, mountsArray.secret, mountsArray.emptyDir, mountsArray.hostPath]) } if parameter["livenessProbe"] != _|_ { diff --git a/vela-templates/definitions/internal/component/cron-task.cue b/vela-templates/definitions/internal/component/cron-task.cue index 93a575fe3..a0e714808 100644 --- a/vela-templates/definitions/internal/component/cron-task.cue +++ b/vela-templates/definitions/internal/component/cron-task.cue @@ -1,3 +1,5 @@ +import "list" + "cron-task": { type: "component" annotations: {} @@ -125,7 +127,7 @@ template: { }, ] | [] } - volumesList: volumesArray.pvc + volumesArray.configMap + volumesArray.secret + volumesArray.emptyDir + volumesArray.hostPath + volumesList: list.Concat([volumesArray.pvc, volumesArray.configMap, volumesArray.secret, volumesArray.emptyDir, volumesArray.hostPath]) deDupVolumesArray: [ for val in [ for i, vi in volumesList { diff --git a/vela-templates/definitions/internal/workflowstep/apply-terraform-provider.cue b/vela-templates/definitions/internal/workflowstep/apply-terraform-provider.cue index 52bb95ded..09f31af6a 100644 --- a/vela-templates/definitions/internal/workflowstep/apply-terraform-provider.cue +++ b/vela-templates/definitions/internal/workflowstep/apply-terraform-provider.cue @@ -86,9 +86,9 @@ template: { } } providerBasic: { - accessKey: string - secretKey: string - region: string + accessKey!: string + secretKey!: string + region!: string } #AlibabaProvider: { providerBasic @@ -140,5 +140,5 @@ template: { type: "ucloud" name: *"ucloud-provider" | string } - parameter: *#AlibabaProvider | #AWSProvider | #AzureProvider | #BaiduProvider | #ECProvider | #GCPProvider | #TencentProvider | #UCloudProvider + parameter: #AlibabaProvider | #AWSProvider | #AzureProvider | #BaiduProvider | #ECProvider | #GCPProvider | #TencentProvider | #UCloudProvider }