github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/internal/workflowstep/depends-on-app.cue (about) 1 import ( 2 "vela/op" 3 "encoding/yaml" 4 ) 5 6 "depends-on-app": { 7 type: "workflow-step" 8 annotations: { 9 "category": "Application Delivery" 10 } 11 labels: {} 12 description: "Wait for the specified Application to complete." 13 } 14 15 template: { 16 dependsOn: op.#Read & { 17 value: { 18 apiVersion: "core.oam.dev/v1beta1" 19 kind: "Application" 20 metadata: { 21 name: parameter.name 22 namespace: parameter.namespace 23 } 24 } 25 } 26 load: op.#Steps & { 27 if dependsOn.err != _|_ { 28 configMap: op.#Read & { 29 value: { 30 apiVersion: "v1" 31 kind: "ConfigMap" 32 metadata: { 33 name: parameter.name 34 namespace: parameter.namespace 35 } 36 } 37 } @step(1) 38 template: configMap.value.data["application"] 39 apply: op.#Apply & { 40 value: yaml.Unmarshal(template) 41 } @step(2) 42 wait: op.#ConditionalWait & { 43 continue: apply.value.status.status == "running" 44 } @step(3) 45 } 46 47 if dependsOn.err == _|_ { 48 wait: op.#ConditionalWait & { 49 continue: dependsOn.value.status.status == "running" 50 } 51 } 52 } 53 parameter: { 54 // +usage=Specify the name of the dependent Application 55 name: string 56 // +usage=Specify the namespace of the dependent Application 57 namespace: string 58 } 59 }