All Products
Search
Document Center

Container Service for Kubernetes:Configure artifacts

Last Updated:Dec 18, 2023

You can configure artifacts in workflow clusters to pass parameters through steps in a workflow. The output of a step is the input of another step. This helps you orchestrate complex workflow steps. This topic describes how to use Object Storage Service (OSS) as the artifact storage to pass parameters through steps in a workflow.

Prerequisites

OSS is activated. For more information, see Activate OSS.

Procedure

  1. Configure OSS as the artifact storage. For more information, see Configuring Alibaba Cloud OSS.

  2. Create a file named artifect-passing.yaml and add the following content to the file:

    apiVersion: argoproj.io/v1alpha1
    kind: Workflow
    metadata:
      generateName: artifact-passing-
    spec:
      entrypoint: artifact-example
      templates:
      - name: artifact-example
        steps:
        - - name: generate-artifact
            template: whalesay
        - - name: consume-artifact
            template: print-message
            arguments:
              artifacts:
              # bind message to the hello-art artifact.
              # generated by the generate-artifact step.
              - name: message
                from: "{{steps.generate-artifact.outputs.artifacts.hello-art}}"
    
      - name: whalesay
        container:
          image: docker/whalesay:latest
          command: [sh, -c]
          args: ["cowsay hello world | tee /tmp/hello_world.txt"]
        outputs:
          artifacts:
          # generate hello-art artifact from /tmp/hello_world.txt.
          # artifacts can be directories as well as files.
          - name: hello-art
            path: /tmp/hello_world.txt
    
      - name: print-message
        inputs:
          artifacts:
          # unpack the message input artifact.
          # and put it at /tmp/message.
          - name: message
            path: /tmp/message
        container:
          image: alpine:latest
          command: [sh, -c]
          args: ["cat /tmp/message"]
  3. Run the following command to submit the workflow:

    argo submit artifact-passing.yaml
  4. Run the following command to query the status of the workflow:

    argo list