---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: triggers-release
spec:
  params:
  - name: package
    description: package to release
    default: github.com/tektoncd/triggers
  - name: imageRegistry
    default: gcr.io/tekton-releases # TODO: USE SOMETHING ELSE FOR TESTING
  - name: versionTag
    description: The X.Y.Z version that the artifacts should be tagged with
  resources:
  - name: source-repo
    type: git
  - name: bucket
    type: storage
  - name: builtControllerImage
    type: image
  - name: builtWebhookImage
    type: image
  - name: builtEventListenerSinkImage
    type: image
  - name: notification
    type: cloudEvent
  tasks:
    - name: unit-tests
      taskRef:
        name: golang-test
      params:
        - name: package
          value: $(params.package)
        - name: version
          value: "1.13"
      resources:
        inputs:
          - name: source
            resource: source-repo
    - name: build
      taskRef:
        name: golang-build
      params:
        - name: package
          value: $(params.package)
        - name: version
          value: "1.13"
      resources:
        inputs:
          - name: source
            resource: source-repo
    - name: publish-images
      runAfter: [build, unit-tests]
      taskRef:
        name: publish-tekton-triggers
      params:
        - name: pathToProject
          value: $(params.package)
        - name: versionTag
          value: $(params.versionTag)
        - name: imageRegistry
          value: $(params.imageRegistry)
      resources:
        inputs:
          - name: source
            resource: source-repo
          - name: bucket
            resource: bucket
        outputs:
          - name: bucket
            resource: bucket
          - name: builtControllerImage
            resource: builtControllerImage
          - name: builtWebhookImage
            resource: builtWebhookImage
          - name: builtEventListenerSinkImage
            resource: builtEventListenerSinkImage
          - name: notification
            resource: notification
