<p>An <code>outer-template</code> which calls <code>inner-template</code> twice since there are 2 steps. Inner template is a simple container which write some text to <code>/command_output/result.txt</code>. The workflow outputs attempts to read it thru:</p>
<pre><code>- name: previous_step_output
  valueFrom:
    path: /command_output/result.txt
</code></pre>
<p>This does appear to be working for some reason. Based on the documentation I also created <code>volumes</code> and <code>volumeMounts</code>
The error is:</p>
<pre><code> Service Account Name:  argo
  Templates:
    Arguments:
    Inputs:
    Metadata:
    Name:  HelloWorld
    Outputs:
    Steps:
      [map[arguments:map[parameters:[map[name:message value:Hello World.....]]] name:init-step templateRef:map[name:outer-template template:HelloWorld]]]
Status:
  Conditions:
    Status:     True
    Type:       Completed
  Finished At:  2021-06-17T23:50:37Z
  Message:      runtime error: invalid memory address or nil pointer dereference
  Nodes:
    hello-css4z:
</code></pre>
<p>Need some advise on what is missing. Attaching inner-template, outer-template and the request.yaml.</p>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: inner-template
  namespace: cali
  labels:
    workflows.argoproj.io/controller-instanceid: cali
spec:
  templates:
    - name: InnerJob
      metadata:
        annotations:
          sidecar.istio.io/inject: &quot;false&quot;
      inputs:
        parameters:
          - name: message
          - name: previous_step_output
            value: &quot;&quot;
      resource:
        action: create
        successCondition: status.succeeded &gt; 0
        failureCondition: status.failed &gt; 0
        manifest: |
          apiVersion: batch/v1
          kind: Job
          metadata:
            namespace: default
            generateName: hellojob-
            annotations:
              sidecar.istio.io/inject: &quot;false&quot;
          spec:
            template:
              metadata:
                annotations:
                  sidecar.istio.io/inject: &quot;false&quot;
              spec:
                volumes:
                  - emptyDir: {}
                    name: cali-mount
                containers:
                  - name: export-tenant
                    image: centos:7
                    command: [sh, -c]
                    args: [&quot;echo 'some result' &gt; /command_output/result.txt; cat /command_output/result.txt; sleep 5; echo done; exit 0&quot;]
                    env:
                      - name: message
                        value: &quot;{{inputs.parameters.message}}&quot;
                      - name: previous_step_output
                        value: &quot;{{inputs.parameters.previous_step_output}}&quot;
                    volumeMounts:
                      - mountPath: /command_output
                        name: cali-mount
                restartPolicy: Never
      outputs:
        parameters:
          - name: job-name
            valueFrom:
              jsonPath: '{.metadata.name}'
          - name: job-obj
            valueFrom:
              jqFilter: '.'
          - name: previous_step_output
            valueFrom:
              path: /command_output/result.txt
</code></pre>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: outer-template
  namespace: cali
  labels:
    workflows.argoproj.io/controller-instanceid: cali
spec:
  entrypoint: HelloWorld
  templates:
    - name: HelloWorld
      inputs:
        parameters:
          - name: message
      steps:
        - - name: step-1
            templateRef:
              name: inner-template
              template: InnerJob
            arguments:
              parameters:
                - name: message
                  value: &quot;{{inputs.parameters.message}}&quot;
        - - name: step-2
            templateRef:
              name: inner-template
              template: InnerJob
            arguments:
              parameters:
                - name: message
                  value: &quot;{{inputs.parameters.message}}&quot;
                - name: previous_step_output
                  value: &quot;{{steps.step-1.outputs.parameters.previous_step_output}}&quot;
</code></pre>
<p>request payload:</p>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-
  namespace: cali
  labels:
    workflows.argoproj.io/controller-instanceid: cali
spec:
  entrypoint: HelloWorld
  serviceAccountName: argo
  templates:
      - name: HelloWorld
        steps:
          - - name: init-step
              arguments:
                parameters:
                  - name: message
                    value: &quot;Hello World.....&quot;
              templateRef:
                name: outer-template
                template: HelloWorld
</code></pre>

colossal
<p>As far as I can tell, <a href="https://github.com/argoproj/argo-workflows/tree/master/examples#kubernetes-resources" rel="nofollow noreferrer">Argo Workflows resource templates</a> do not support reading files as output parameters.</p>
<p>It looks like the only built-in method of communicating from a <code>job</code> resource to the instantiating workflow is via the JSON representation of the <code>job</code> resource itself.</p>
<p>I would recommend converting the Job to a normal container template in the workflow. Then you could use all the typical communication methods (reading directly from stdout, reading a file into an output param, reading an output artifact, etc.).</p>
