'How do I use Argo Workflows Using Previous Step Outputs As Inputs?

I am trying to format my workflow per these instructions (https://argoproj.github.io/argo-workflows/workflow-inputs/#using-previous-step-outputs-as-inputs) but cannot seem to get it right. Specifically, I am trying to imitate "Using Previous Step Outputs As Inputs"

I have included my workflow below. In this version, I have added a path to the inputs.artifacts because the error requests one. The error I am now receiving is:

ATA[2022-02-28T14:14:45.933Z] Failed to submit workflow: templates.entrypoint.tasks.print1 templates.print1.inputs.artifacts.result.from not valid in inputs

Can someone please tell me how to correct this workflow so that it works?

---
{
   "apiVersion": "argoproj.io/v1alpha1",
   "kind": "Workflow",
   "metadata": {
      "annotations": {
         "workflows.argoproj.io/description": "Building from the ground up",
         "workflows.argoproj.io/version": ">= 3.1.0"
      },
      "labels": {
         "workflows.argoproj.io/archive-strategy": "false"
      },
      "name": "data-passing",
      "namespace": "sandbox"
   },
   "spec": {
      "artifactRepositoryRef": {
         "configMap": "my-config",
         "key": "data"
      },
      "entrypoint": "entrypoint",
      "nodeSelector": {
         "kubernetes.io/os": "linux"
      },
      "parallelism": 3,
      "securityContext": {
         "fsGroup": 2000,
         "fsGroupChangePolicy": "OnRootMismatch",
         "runAsGroup": 3000,
         "runAsNonRoot": true,
         "runAsUser": 1000
      },
      "templates": [
         {
            "container": {
               "args": [
                  "Hello World"
               ],
               "command": [
                  "cowsay"
               ],
               "image": "docker/whalesay:latest",
               "imagePullPolicy": "IfNotPresent"
            },
            "name": "whalesay",
            "outputs": {
               "artifacts": [
                  {
                     "name": "msg",
                     "path": "/tmp/raw"
                  }
               ]
            },
            "securityContext": {
               "fsGroup": 2000,
               "fsGroupChangePolicy": "OnRootMismatch",
               "runAsGroup": 3000,
               "runAsNonRoot": true,
               "runAsUser": 1000
            }
         },
         {
            "inputs": {
               "artifacts": [
                  {
                     "from": "{{tasks.whalesay.outputs.artifacts.msg}}",
                     "name": "result",
                     "path": "/tmp/raw"
                  }
               ]
            },
            "name": "print1",
            "script": {
               "command": [
                  "python"
               ],
               "image": "python:alpine3.6",
               "imagePullPolicy": "IfNotPresent",
               "source": "cat {{inputs.artifacts.result}}\n"
            },
            "securityContext": {
               "fsGroup": 2000,
               "fsGroupChangePolicy": "OnRootMismatch",
               "runAsGroup": 3000,
               "runAsNonRoot": true,
               "runAsUser": 1000
            }
         },
         {
            "dag": {
               "tasks": [
                  {
                     "name": "whalesay",
                     "template": "whalesay"
                  },
                  {
                     "arguments": {
                        "artifacts": [
                           {
                              "from": "{{tasks.whalesay.outputs.artifacts.msg}}",
                              "name": "result",
                              "path": "/tmp/raw"
                           }
                        ]
                     },
                     "dependencies": [
                        "whalesay"
                     ],
                     "name": "print1",
                     "template": "print1"
                  }
               ]
            },
            "name": "entrypoint"
         }
      ]
   }
}
...


Solution 1:[1]

A very similar workflow from the Argo developers/maintainers can be found here:

https://github.com/argoproj/argo-workflows/blob/master/examples/README.md#artifacts

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3877654