Ở bài này chúng ta sử dụng Item khách cho loop là Dictionary.
apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: wf-loop-sets spec: entrypoint: dag-template arguments: parameters: - name: message1 value: Task 1 is executed - name: message2 value: Task 2 is executed templates: - name: dag-template inputs: parameters: - name: message1 - name: message2 dag: tasks: - name: Task1 arguments: parameters: [{name: text, value: "{{inputs.parameters.message1}}"}] template: task-template - name: Task2 arguments: parameters: [{name: text, value: "{{inputs.parameters.message2}}"}] template: task-template - name: Task3 template: task-loop-sets dependencies: [Task1] arguments: parameters: - name: extractor value: "{{item.extractor}}" - name: table value: "{{item.table}}" withItems: - { extractor: 'PythonExtractor', table: 'Table 1' } - { extractor: 'GolangExtractor', table: 'Table 2' } - { extractor: 'PHPExtractor', table: 'Table 3' } - name: task-template inputs: parameters: - name: text script: image: python:3.8-slim command: source: | p = "{{inputs.parameters.text}}" print(p) - name: task-loop-sets inputs: parameters: - name: extractor - name: table script: image: python:3.8-slim command: source: | print("Applying ", "{{inputs.parameters.extractor}}", "to the table ", "{{inputs.parameters.table}}")