<h3>Summary:</h3>
<p>We have a golang application that submits Argo workflows to a kubernetes cluster upon requests. I'd like to pass a yaml file to one of the steps and I'm wondering what are the options for doing this.</p>
<h3>Environment:</h3>
<ul>
<li>Argo: v2.4.2</li>
<li>K8s: 1.13.12-gke.25</li>
</ul>
<h3>Additional details:</h3>
<p>Eventually, I would like to pass this file to the test step as shown in this example:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: test-
spec:
  entrypoint: test
  templates:
  - name: test
    container:
      image: gcr.io/testproj/test:latest
      command: [bash]
      source: |
        python test.py --config_file_path=/path/to/config.yaml
</code></pre>
<p>The image used in this step would have a python script that receives the path to this file then accesses it.</p>
<p>To submit the Argo workflows with golang, we use the following dependencies:</p>
<ul>
<li><a href="https://github.com/argoproj/argo-workflows/tree/master/pkg/client" rel="nofollow noreferrer">https://github.com/argoproj/argo-workflows/tree/master/pkg/client</a></li>
<li><a href="https://github.com/argoproj/argo-workflows/tree/master/pkg/apis" rel="nofollow noreferrer">https://github.com/argoproj/argo-workflows/tree/master/pkg/apis</a></li>
</ul>
<p>Thank you.</p>

Ash
<h1>Option 1: pass the file as a parameter</h1>
<p><a href="https://github.com/argoproj/argo-workflows/tree/master/examples#parameters" rel="nofollow noreferrer">Workflow parameters</a> are usually small bits of text or numbers. But if your yaml file is reasonably small, you could string-encode it and pass it as a parameter.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: test-
spec:
  entrypoint: test
  arguments:
    parameters:
    - name: yaml
      value: &quot;string-encoded yaml&quot;
  templates:
  - name: test
    container:
      image: gcr.io/testproj/test:latest
      command: [bash]
      source: |
        # In this case, the string-encoding should be BASH-compatible.
        python test.py --config_file_as_string=&quot;{{inputs.parameters.message}}&quot;
</code></pre>
<h1>Option 2: pass the file as an artifact</h1>
<p>Argo supports multiple types of <a href="https://github.com/argoproj/argo-workflows/tree/master/examples#artifacts" rel="nofollow noreferrer">artifacts</a>. Perhaps the simplest for your use case is the <a href="https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-raw.yaml" rel="nofollow noreferrer">raw parameter</a> type.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: test-
spec:
  entrypoint: test
  templates:
  - name: test
    inputs:
      artifacts:
      - name: yaml
        path: /path/to/config.yaml
        raw:
          data: |
            this is
            the raw file
            contents
    container:
      image: gcr.io/testproj/test:latest
      command: [bash]
      source: |
        python test.py --config_file_path=/path/to/config.yaml
</code></pre>
<p>Besides <code>raw</code>, Argo supports &quot;S3, Artifactory, HTTP, [and] Git&quot; artifacts (among others, I think).</p>
<p>If, for example, you chose to use S3, you could upload the file from your golang app and then pass the S3 bucket and key as parameters.</p>
<h1>Golang client</h1>
<p>I'm not familiar with the golang client, but passing parameters is certainly supported, and I <em>think</em> passing in a raw parameter should be supported as well.</p>
