argo-workflows icon indicating copy to clipboard operation
argo-workflows copied to clipboard

fix: ensure node phases propagate correctly. Fixes #12869

Open isubasinghe opened this issue 9 months ago • 3 comments

Fixes #12869 The previous code contained a logic error and always inherited node.Phase, this isn't always desirable, on failure it should inherit the parents phase.

In addition to this, the codebase also updates the outbound nodes for the targetTasks. This fix was contributed by @Joibel even though the commits here do not indicate this.

This fix is an interim fix while I rewrite some of the DAG code, generally speaking the DAG part of the codebase has a more dense population of bugs, enough to the point that I think it warrants a rewrite.

Verification

Tested

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: loop-test-
spec:
  entrypoint: main
  templates:
  - name: main
    dag:
      tasks:
        - name: print-json-entry-print-exitcode
          template: print-json-entry-print-exitcode
          arguments:
            parameters:
            - name: index
              value: '0'
        - name: call-access-aggregate-output
          depends: "print-json-entry-print-exitcode"
          template: access-aggregate-output
          arguments:
            parameters:
            - name: aggregate-results
              value: '{{tasks.print-json-entry-print-exitcode.outputs.parameters.exit-code}}'
  - name: print-json-entry-print-exitcode
    inputs:
      parameters:
        - name: index
    outputs:
      parameters:
        - name: exit-code
          valueFrom:
            parameter: "{{tasks.print-exitcode.outputs.result}}"
    dag:
      tasks:
        - name: print-json-entry
          template: print-json-entry
          arguments:
            parameters:
            - name: index
              value: '{{inputs.parameters.index}}'
        - name: print-exitcode
          depends: "print-json-entry.Failed"
          template: print-exitcode
          arguments:
            parameters:
            - name: exitcode
              value: '{{tasks.print-json-entry.exitCode}}'
  - name: print-json-entry
    inputs:
      parameters:
      - name: index
    container:
      image: alpine:latest
      command: [sh, -c]
      args: ["echo intentional failure; exit {{inputs.parameters.index}}"]
  - name: access-aggregate-output
    inputs:
      parameters:
      - name: aggregate-results
        value: 'no-value'
    script:
      image: alpine:latest
      command: [sh]
      source: |
        echo 'inputs.parameters.aggregate-results: "{{inputs.parameters.aggregate-results}}"'
  - name: print-exitcode
    inputs:
      parameters:
      - name: exitcode
        value: ''
    script:
      image: alpine:latest
      command: [sh]
      source: |
        echo '{{inputs.parameters.exitcode}}'

and it is marked as Error as expected.

isubasinghe avatar Apr 29 '24 05:04 isubasinghe

/retest

Joibel avatar May 08 '24 14:05 Joibel

/retest

isubasinghe avatar May 09 '24 02:05 isubasinghe

Also seeing this error, which I find odd because my workflow did not have any outputs.

sstaley-hioscar avatar May 22 '24 21:05 sstaley-hioscar