Skip to content

[Bug]: Cannot create dryRun for valid workflow template #186

@goranbs

Description

@goranbs

Cannot create dryRun of valid workflow template

Create new project, add the below workflow template and try to create a dryRun.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: matrikkel-download-data-
spec:
  entrypoint: main
  templates:

  - name: main
    dag:
      tasks:
      - name: process-items
        template: process-item
        continueOn:
          failed: true  # Continue processing even if some items fail
        arguments:
          parameters:
          - name: item
            value: "{{item}}"
        withItems:
        - "item1"
        - "item2"
        - "item3"

      - name: collect-status
        dependencies: [process-items]
        template: collect-status
        arguments:
          parameters:
          - name: statuses
            value: "{{tasks.process-items.outputs.parameters.status}}"

  # Process each item in parallel
  - name: process-item
    failFast: false  # Allow all branches to run to completion
    inputs:
      parameters:
      - name: item
    outputs:
      parameters:
      - name: status
        valueFrom:
          parameter: "{{tasks.run-cmd.outputs.parameters.status}}"
    dag:
      tasks:
      - name: run-cmd
        template: run-command
        arguments:
          parameters:
          - name: item
            value: "{{inputs.parameters.item}}"

      - name: notify-failure
        depends: run-cmd.Failed
        template: notify
        arguments:
          parameters:
          - name: error-message
            value: "{{inputs.parameters.item}} failed during run-cmd"

      - name: upload-to-s3
        depends: run-cmd.Succeeded
        template: upload-s3
        arguments:
          artifacts:
          - name: aggregated-output
            from: "{{tasks.run-cmd.outputs.artifacts.output}}"
          parameters:
          - name: item
            value: "{{inputs.parameters.item}}"


  - name: run-command
    inputs:
      parameters:
      - name: item
    container:
      image: alpine
      command: [sh, -c]
      args:
        - |
          mkdir -p /tmp/output
            if [ "{{inputs.parameters.item}}" == "item1" ] || [ "{{inputs.parameters.item}}" == "item2" ] || [ "{{inputs.parameters.item}}" == "item3" ]; then
            echo "Simulating failure for {{inputs.parameters.item}}"
            echo "Failed" > /tmp/status.txt
            status=1
          else
            echo "Processing {{inputs.parameters.item}}"
            echo "Output for {{inputs.parameters.item}}" | tee /tmp/output/{{inputs.parameters.item}}.out
            echo "Succeeded" > /tmp/status.txt
            status=0
          fi
          exit $status
      volumeMounts:
      - name: workdir
        mountPath: /tmp
    outputs:
      artifacts:
      - name: output
        path: /tmp/output/{{inputs.parameters.item}}.out
      parameters:
      - name: error-message
        value: "{{inputs.parameters.item}} failed"
      - name: status
        valueFrom:
          path: /tmp/status.txt

  - name: notify
    inputs:
      parameters:
      - name: error-message
    container:
      image: curlimages/curl
      command: [sh, -c]
      args:
        - |
          echo "Sending notification for failure: {{inputs.parameters.error-message}}"
          curl -H 'Content-Type: application/json' \
          -d '{
            "@type": "MessageCard",
            "@context": "http://schema.org/extensions",
            "summary": "Argo Workflow Notification",
            "themeColor": "0076D7",
            "title": "Argo Workflows Notification from {{workflow.name}}",
            "text": "{{inputs.parameters.error-message}}",
          }' \
          ${WEBHOOK_URL}
      env:
      - name: WEBHOOK_URL
        valueFrom:
          secretKeyRef:
            name: teams-webhook-secret
            key: WEBHOOK_URL

  - name: upload-s3
    container:
      image: alpine
      command: [sh, -c]
      args: ["cat /tmp/output/{{inputs.parameters.item}}.out"]
    inputs:
      artifacts:
      - name: aggregated-output
        path: /tmp/output/{{inputs.parameters.item}}.out
      parameters:
      - name: item

  - name: collect-status
    inputs:
      parameters:
      - name: statuses
    script:
      image: python:3.13-slim
      command: [python]
      source: |
        import sys, json
        # Add quotes around each status if missing
        raw = '{{inputs.parameters.statuses}}'
        print(f"Raw statuses: {raw}")
        # Handle the case where no statuses are present (all failed)
        if raw.startswith("{{") and raw.endswith("}}"):
            print("No items succeeded (all failed, no statuses present)")
            sys.exit(1)
        statuses = json.loads(raw)
        print(f"Collected statuses: {statuses}")
        if "Succeeded" in statuses:
            print("Workflow completed successfully.")
            sys.exit(0)
        else:
            print("No bubble types were successfully processed.")
            sys.exit(1)

  volumes:
  - name: workdir
    emptyDir: {}

Expected behavior

No response

Steps to reproduce

No response

Environment

  • SIM-PIPE version:
  • Platform/OS:
  • Browser:
  • Other:

Screenshots

No response

Logs

dag 
{name: 'main', inputs: {…}, outputs: {…}, metadata: {…}, dag: {…}}
dag
: 
{tasks: Array(2)}
inputs
: 
{}
metadata
: 
{}
name
: 
"main"
outputs
: 
{}
[[Prototype]]
: 
Object
submit-new-dry-run-modal.svelte:305 tasks 
(2) [{…}, {…}]
0
: 
{name: 'process-items', template: 'process-item', arguments: {…}, withItems: Array(3), continueOn: {…}}
1
: 
{name: 'collect-status', template: 'collect-status', arguments: {…}, dependencies: Array(1)}
length
: 
2
[[Prototype]]
: 
Array(0)
submit-new-dry-run-modal.svelte:306 templateContainerInputs 
{main: {…}, process-item: {…}, run-command: {…}, notify: {…}, upload-s3: {…}, …}
collect-status
: 
{parameters: Array(1)}
main
: 
{}
notify
: 
{parameters: Array(1)}
process-item
: 
{parameters: Array(1)}
run-command
: 
{parameters: Array(1)}
upload-s3
: 
{parameters: Array(1), artifacts: Array(1)}
[[Prototype]]
: 
Object
submit-new-dry-run-modal.svelte:39 currentArgoWorkflowTemplate 
(6) [{…}, {…}, {…}, {…}, {…}, {…}]
0
: 
{name: 'main', inputs: {…}, outputs: {…}, metadata: {…}, dag: {…}}
1
: 
{name: 'process-item', inputs: {…}, outputs: {…}, metadata: {…}, dag: {…}, …}
2
: 
{name: 'run-command', inputs: {…}, outputs: {…}, metadata: {…}, container: {…}}
3
: 
{name: 'notify', inputs: {…}, outputs: {…}, metadata: {…}, container: {…}}
4
: 
{name: 'upload-s3', inputs: {…}, outputs: {…}, metadata: {…}, container: {…}}
5
: 
{name: 'collect-status', inputs: {…}, outputs: {…}, metadata: {…}, script: {…}}
length
: 
6
[[Prototype]]
: 
Array(0)
submit-new-dry-run-modal.svelte:386 inputdata 
{}
+page.svelte:94 [HMR][Svelte] Unrecoverable HMR error in <Submit-new-dry-run-modal>: next update will trigger a full reload
submit-new-dry-run-modal.svelte:416 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
    at Object.keys (<anonymous>)
    at create_each_block (submit-new-dry-run-modal.svelte:416:19)
    at create_if_block_1 (submit-new-dry-run-modal.svelte:395:11)
    at create_if_block (submit-new-dry-run-modal.svelte:394:36)
    at create_fragment (submit-new-dry-run-modal.svelte:389:19)
    at new Submit_new_dry_run_modal (submit-new-dry-run-modal.svelte:39:76)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions