文档

配置Artifacts

更新时间:

通过配置使用工作流集群Artifacts,可以在工作流各个步骤之间传递参数,一个步骤的输出可以作为另一个步骤的输入,从而完成复杂工作流步骤的编排。本文介绍如何使用阿里云OSS作为Artifacts的存储,在工作流步骤间传递参数。

前提条件

已开通阿里云对象存储(OSS)服务。具体操作,请参见开通OSS服务

操作步骤

  1. 配置阿里云OSS。具体操作,请参见Configuring Alibaba Cloud OSS

  2. 使用以下YAML内容,创建artifect-passing.yaml文件。

    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. 执行以下命令,提交工作流。

    argo submit artifact-passing.yaml
  4. 执行以下命令,查看工作流状态。

    argo list
  • 本页导读 (1)
文档反馈