github.com/kubevela/workflow@v0.6.0/charts/vela-workflow/templates/definitions/apply-job.yaml (about)

     1  # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
     2  # Definition source cue file: vela-templates/definitions/internal/apply-job.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: WorkflowStepDefinition
     5  metadata:
     6    annotations:
     7      custom.definition.oam.dev/category: Resource Management
     8      definition.oam.dev/description: Apply job
     9    name: apply-job
    10    namespace: {{ include "systemDefinitionNamespace" . }}
    11  spec:
    12    schematic:
    13      cue:
    14        template: |
    15          import (
    16          	"vela/op"
    17          )
    18  
    19          // apply the job
    20          apply: op.#Apply & {
    21          	value:   parameter.value
    22          	cluster: parameter.cluster
    23          }
    24  
    25          // fail the step if the job fails
    26          if apply.status.failed > 0 {
    27          	fail: op.#Fail & {
    28          		message: "Job failed"
    29          	}
    30          }
    31  
    32          // wait the job to be ready
    33          wait: op.#ConditionalWait & {
    34          	continue: apply.status.succeeded == apply.spec.completions
    35          }
    36  
    37          parameter: {
    38          	// +usage=Specify Kubernetes job object to be applied
    39          	value: {
    40          		apiVersion: "batch/v1"
    41          		kind:       "Job"
    42          		...
    43          	}
    44          	// +usage=The cluster you want to apply the resource to, default is the current control plane cluster
    45          	cluster: *"" | string
    46          }
    47