---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: s2i-nodejs-deployment
  namespace: openshift
  labels:
    pipeline.openshift.io/runtime: nodejs
    pipeline.openshift.io/type: kubernetes
  annotations:
    operator.tekton.dev/preserve-namespace: "true"
spec:
  params:
    - name: APP_NAME
      type: string
  resources:
    - name: app-source
      type: git
    - name: app-image
      type: image

  tasks:
    - name: build
      taskRef:
        name: s2i-nodejs
        kind: ClusterTask
      resources:
        inputs:
          - name: source
            resource: app-source
        outputs:
          - name: image
            resource: app-image
      params:
        - name: TLSVERIFY
          value: "false"

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