From 0673bc9cd5e199aa26ab89467c745915ea948d58 Mon Sep 17 00:00:00 2001 From: yangsoon Date: Tue, 16 Nov 2021 22:48:26 +0800 Subject: [PATCH] Fix: fix workflowstep depends-on-app (#2723) Co-authored-by: yangsoon --- .../defwithtemplate/depends-on-app.yaml | 19 ++++++++--------- .../defwithtemplate/depends-on-app.yaml | 19 ++++++++--------- .../definitions/internal/depends-on-app.cue | 21 ++++++++----------- 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml b/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml index dcea3b229..ff7f93cc0 100644 --- a/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml +++ b/charts/vela-core/templates/defwithtemplate/depends-on-app.yaml @@ -27,7 +27,7 @@ spec: } } load: op.#Steps & { - if dependsOn.err != _|_ && dependsOn.value == _|_ { + if dependsOn.err != _|_ { configMap: op.#Read & { value: { apiVersion: "v1" @@ -37,18 +37,17 @@ spec: namespace: parameter.namespace } } - } - apply: op.#Apply & { - value: { - yaml.Unmarshal(configMap.value.data[parameter.name]) - } - } + } @step(1) + template: configMap.value.data["application"] + apply: op.#Apply & { + value: yaml.Unmarshal(template) + } @step(2) wait: op.#ConditionalWait & { - continue: load.apply.value.status.status == "running" - } + continue: apply.value.status.status == "running" + } @step(3) } - if dependsOn.value != _|_ { + if dependsOn.err == _|_ { wait: op.#ConditionalWait & { continue: dependsOn.value.status.status == "running" } diff --git a/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml b/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml index dcea3b229..ff7f93cc0 100644 --- a/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/depends-on-app.yaml @@ -27,7 +27,7 @@ spec: } } load: op.#Steps & { - if dependsOn.err != _|_ && dependsOn.value == _|_ { + if dependsOn.err != _|_ { configMap: op.#Read & { value: { apiVersion: "v1" @@ -37,18 +37,17 @@ spec: namespace: parameter.namespace } } - } - apply: op.#Apply & { - value: { - yaml.Unmarshal(configMap.value.data[parameter.name]) - } - } + } @step(1) + template: configMap.value.data["application"] + apply: op.#Apply & { + value: yaml.Unmarshal(template) + } @step(2) wait: op.#ConditionalWait & { - continue: load.apply.value.status.status == "running" - } + continue: apply.value.status.status == "running" + } @step(3) } - if dependsOn.value != _|_ { + if dependsOn.err == _|_ { wait: op.#ConditionalWait & { continue: dependsOn.value.status.status == "running" } diff --git a/vela-templates/definitions/internal/depends-on-app.cue b/vela-templates/definitions/internal/depends-on-app.cue index 8a12fc817..968b08ae0 100644 --- a/vela-templates/definitions/internal/depends-on-app.cue +++ b/vela-templates/definitions/internal/depends-on-app.cue @@ -21,9 +21,8 @@ template: { } } } - load: op.#Steps & { - if dependsOn.err != _|_ && dependsOn.value == _|_ { + if dependsOn.err != _|_ { configMap: op.#Read & { value: { apiVersion: "v1" @@ -33,24 +32,22 @@ template: { namespace: parameter.namespace } } - } - apply: op.#Apply & { - value: { - yaml.Unmarshal(configMap.value.data[parameter.name]) - } - } + } @step(1) + template: configMap.value.data["application"] + apply: op.#Apply & { + value: yaml.Unmarshal(template) + } @step(2) wait: op.#ConditionalWait & { - continue: load.apply.value.status.status == "running" - } + continue: apply.value.status.status == "running" + } @step(3) } - if dependsOn.value != _|_ { + if dependsOn.err == _|_ { wait: op.#ConditionalWait & { continue: dependsOn.value.status.status == "running" } } } - parameter: { // +usage=Specify the name of the dependent Application name: string