@@ -15,79 +15,86 @@ spec:
15
15
cue :
16
16
template : |
17
17
import (
18
- "vela/op"
18
+ "vela/op"
19
19
)
20
20
21
21
job: op.#Apply & {
22
- value: {
23
- apiVersion: "batch/v1"
24
- kind: "Job"
25
- metadata: {
26
- name: context.name + "-" + context.stepSessionID
27
- namespace: "vela-system"
28
- labels: "enable-addon.oam.dev": context.name
29
- annotations: "workflow.oam.dev/step": context.stepName
30
- }
31
- spec: {
32
- backoffLimit: 3
33
- template: {
34
- metadata: {
35
- labels: {
36
- "workflow.oam.dev/name": context.name
37
- "workflow.oam.dev/session": context.stepSessionID
38
- }
39
- annotations: "workflow.oam.dev/step": context.stepName
40
- }
41
- spec: {
42
- containers: [
43
- {
44
- name: parameter.addonName + "-enable-job"
45
- image: parameter.image
22
+ value: {
23
+ apiVersion: "batch/v1"
24
+ kind: "Job"
25
+ metadata: {
26
+ name: context.name + "-" + context.stepSessionID
27
+ namespace: "vela-system"
28
+ labels: {
29
+ "enable-addon.oam.dev": context.name
30
+ "workflow.oam.dev/name": context.name
31
+ "workflow.oam.dev/session": context.stepSessionID
32
+ }
33
+ annotations: "workflowrun.oam.dev/step": context.stepName
34
+ }
35
+ spec: {
36
+ backoffLimit: 3
37
+ template: {
38
+ metadata: {
39
+ labels: {
40
+ "workflow.oam.dev/name": context.name
41
+ "workflow.oam.dev/session": context.stepSessionID
42
+ }
43
+ annotations: "workflow.oam.dev/step": context.stepName
44
+ }
45
+ spec: {
46
+ containers: [
47
+ {
48
+ name: parameter.addonName + "-enable-job"
49
+ image: parameter.image
46
50
47
- if parameter.args == _|_ {
48
- command: ["vela", "addon", parameter.operation, parameter.addonName]
49
- }
51
+ if parameter.args == _|_ {
52
+ args: ["addon", parameter.operation, parameter.addonName]
53
+ }
54
+
55
+ if parameter.args != _|_ {
56
+ args: ["addon", parameter.operation, parameter.addonName] + parameter.args
57
+ }
58
+ },
59
+ ]
60
+ restartPolicy: "Never"
61
+ serviceAccount: parameter.serviceAccountName
62
+ }
63
+ }
64
+ }
65
+ }
66
+ } @step(1)
50
67
51
- if parameter.args != _|_ {
52
- command: ["vela", "addon", parameter.operation, parameter.addonName] + parameter.args
53
- }
54
- },
55
- ]
56
- restartPolicy: "Never"
57
- serviceAccount: parameter.serviceAccountName
58
- }
59
- }
60
- }
61
- }
62
- }
63
68
log: op.#Log & {
64
- source: resources: [{labelSelector: {
65
- "workflow.oam.dev/name": context.name
66
- "workflow.oam.dev/session": context.stepSessionID
67
- }}]
68
- }
69
- fail: op.#Steps & {
70
- if job.value.status.failed != _|_ {
71
- if job.value.status.failed > 2 {
72
- breakWorkflow: op.#Fail & {
73
- message: "enable addon failed"
74
- }
75
- }
76
- }
77
- }
69
+ source: resources: [{labelSelector: {
70
+ "workflow.oam.dev/name": context.name
71
+ "workflow.oam.dev/session": context.stepSessionID
72
+ }}]
73
+ } @step(2)
74
+
78
75
wait: op.#ConditionalWait & {
79
- continue: job.value.status.succeeded != _|_ && job.value.status.succeeded > 0
80
- }
76
+ continue: job.value.status.succeeded != _|_ || job.value.status.failed != _|_
77
+ } @step(3)
78
+
79
+ fail: op.#Steps & {
80
+ if job.value.status.failed != _|_ {
81
+ if job.value.status.failed > 2 {
82
+ breakWorkflow: op.#Fail & {
83
+ message: "enable addon failed"
84
+ }
85
+ }
86
+ }
87
+ } @step(4)
88
+
81
89
parameter: {
82
- // +usage=Specify the name of the addon.
83
- addonName: string
84
- // +usage=Specify addon enable args.
85
- args?: [...string]
86
- // +usage=Specify the image
87
- image: *"oamdev/vela-cli:v1.6.4 " | string
88
- // +usage=operation for the addon
89
- operation: *"enable" | "upgrade" | "disable"
90
- // +usage=specify serviceAccountName want to use
91
- serviceAccountName: *"kubevela-vela-core" | string
90
+ // +usage=Specify the name of the addon.
91
+ addonName: string
92
+ // +usage=Specify addon enable args.
93
+ args?: [...string]
94
+ // +usage=Specify the image
95
+ image: *"oamdev/vela-cli:v1.10.3 " | string
96
+ // +usage=operation for the addon
97
+ operation: *"enable" | "upgrade" | "disable"
98
+ // +usage=specify serviceAccountName want to use
99
+ serviceAccountName: *"kubevela-vela-core" | string
92
100
}
93
-
0 commit comments