argoproj / argo-workflows

Workflow Engine for Kubernetes
https://argo-workflows.readthedocs.io/
Apache License 2.0
15.08k stars 3.2k forks source link

Implement get resource manifest output as an artifact #6862

Open sylock opened 3 years ago

sylock commented 3 years ago

Summary

Currently when you try to get a manifest, you can only output it as a variable. When you can a complex data structure, it would be more easy to output it as an artifact.

This is what you can do:

  - name: get-workflow-object
    outputs:
      parameters:
      - name: workflow-object
        valueFrom:
          jsonPath: '{}'
    resource:
      action: get
      manifest: |
        apiVersion: argoproj.io/v1alpha1
        kind: Workflow
        metadata:
          name: {{workflow.name}}
          namespace: YOUR-NAMESPACE

This is what you should be able to do:

  - name: get-workflow-object
    outputs:
      artifacts:
      - name: workflow-object
        valueFrom:
          jsonPath: '{}'
    resource:
      action: get
      manifest: |
        apiVersion: argoproj.io/v1alpha1
        kind: Workflow
        metadata:
          name: {{workflow.name}}
          namespace: YOUR-NAMESPACE

Use Cases

See the related use case : https://github.com/argoproj/argo-workflows/issues/6431


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

terrytangyuan commented 3 years ago

Have you tried using kubectl get in script template and cat the output to an artifact instead?

sylock commented 3 years ago

That's the workaround mentioned by @sarabala1979 in the issue #6431 - I still need to test. But I opened this ticket on the request of @sarabala1979 who would like to implement this feature.