apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  annotations:
    managed-by: Tekton
  name: operator-fetch-component-releases
spec:
  params:
  - name: PIPELINES_VERSION
    description: Version of TektonCD Pipelines being fetched
    default: "latest"
  - name: TRIGGERS_VERSION
    description: Version of TektonCD Triggers being fetched
    default: "latest"
  - name: DASHBOARD_VERSION
    description: Version of TektonCD Dashboard being fetched
    default: "latest"
  - name: RESULTS_VERSION
    description: Version of TektonCD Results being fetched
    default: "latest"
  - name: TARGET_PLATFORM
    description: Target platform for for which the payload is going to be used
    default: "kubernetes"
  steps:
  - image: docker.io/curlimages/curl:7.75.0
    name: fetch-component-nightlies
    workingDir: /go/src/github.com/tektoncd/operator
    script: |
      #!/usr/bin/env sh
      set -u -e -o pipefail
      apk add bash # Bash is not present
      ./hack/fetch-releases.sh $(params.TARGET_PLATFORM) $(params.PIPELINES_VERSION) $(params.TRIGGERS_VERSION) $(params.DASHBOARD_VERSION) $(params.RESULTS_VERSION)
      # print directory structure of cmd/<target-platform>/operator/kodata
      find cmd/$(params.TARGET_PLATFORM)/operator/kodata/
    securityContext:
      runAsUser: 0
  workspaces:
  - mountPath: /go/src/github.com/tektoncd/operator
    name: source
