---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: s2i-python-3
  namespace: openshift
  labels:
    pipeline.openshift.io/runtime: python
    pipeline.openshift.io/type: openshift
  annotations:
    operator.tekton.dev/preserve-namespace: "true"
spec:
  params:
    - name: APP_NAME
      type: string
    - name: GIT_REPO
      type: string
    - name: GIT_REVISION
      type: string
    - name: IMAGE_NAME
      type: string
  workspaces:
    - name: workspace
  tasks:
    - name: fetch-repository
      taskRef:
        name: git-clone
        kind: ClusterTask
      workspaces:
        - name: output
          workspace: workspace
      params:
        - name: url
          value: $(params.GIT_REPO)
        - name: revision
          value: $(params.GIT_REVISION)
        - name: subdirectory
          value: ""
        - name: deleteExisting
          value: "true"

    - name: build
      taskRef:
        name: s2i-python-3
        kind: ClusterTask
      runAfter:
        - fetch-repository
      workspaces:
        - name: source
          workspace: workspace
      params:
        - name: IMAGE
          value: $(params.IMAGE_NAME)
        - name: TLSVERIFY
          value: "false"

    - name: deploy
      taskRef:
        name: openshift-client
        kind: ClusterTask
      runAfter:
        - build
      params:
        - name: ARGS
          value: ["rollout", "status", "dc/$(params.APP_NAME)"]
