# Copyright 2019 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
apiVersion: argoproj.io/v1alpha1
metadata:
  annotations:
    pipelines.kubeflow.org/pipeline_spec: '{"description": "A pipeline with multiple
      pipeline params.", "inputs": [{"default": "latest", "name":
      "tag"}, {"default": "10", "name": "sleep_ms"}], "name": "PipelineParams"}'
  generateName: pipelineparams-
spec:
  entrypoint: pipelineparams
  arguments:
    parameters:
    - name: tag
      value: latest
    - name: sleep_ms
      value: '10'
  templates:
  - name: download
    inputs:
      parameters:
      - name: sleep_ms
      - name: tag
    container:
      image: busybox:{{inputs.parameters.tag}}
      args:
      - sleep {{inputs.parameters.sleep_ms}}; wget localhost:5678 -O /tmp/results.txt
      command:
      - sh
      - "-c"
    outputs:
      artifacts:
      - name: download-downloaded
        path: "/tmp/results.txt"
      parameters:
      - name: download-downloaded
        valueFrom:
          path: "/tmp/results.txt"
    sidecars:
    - image: hashicorp/http-echo:{{inputs.parameters.tag}}
      name: echo
      args:
      - -text="hello world"
  - name: echo
    inputs:
      parameters:
      - name: download-downloaded
    container:
      image: library/bash
      args:
      - echo $MSG {{inputs.parameters.download-downloaded}}
      command:
      - sh
      - "-c"
      env:
      - name: MSG
        value: 'pipelineParams: '
  - name: pipelineparams
    inputs:
      parameters:
      - name: sleep_ms
      - name: tag
    dag:
      tasks:
      - name: download
        arguments:
          parameters:
          - name: sleep_ms
            value: "{{inputs.parameters.sleep_ms}}"
          - name: tag
            value: "{{inputs.parameters.tag}}"
        template: download
      - dependencies:
        - download
        arguments:
          parameters:
          - name: download-downloaded
            value: "{{tasks.download.outputs.parameters.download-downloaded}}"
        name: echo
        template: echo
  serviceAccountName: pipeline-runner
kind: Workflow
