apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: pipeline-go
  annotations:
    description: |
      Build the artifacts for the Conference application's services
spec:
  params:
    - description: Repository URL to clone from.
      name: git-repo
      type: string
    - default: main
      description: Revision to checkout. (branch, tag, sha, ref, etc...)
      name: git-revision
      type: string
    - description: Reference of the image the pipeline will produce.
      name: output-image
      type: string
  workspaces:
    - name: shared
      description: Workspace where the git repo is prepared for building
    - name: docker-credentials
      description: Docker config secret
  tasks:
    - name: git-clone
      taskRef:
        resolver: hub
        params:
          - name: catalog
            value: tekton-catalog-tasks
          - name: type
            value: artifact
          - name: name
            value: git-clone
          - name: version
            value: "0.10.0"
          - name: kind
            value: task 
      params:
      - name: url
        value: $(params.git-repo)
      - name: revision
        value: $(params.git-revision)
      workspaces:
      - name: output
        workspace: shared
    - name: golangci-lint
      taskRef:
        resolver: hub
        params:
          - name: catalog
            value: tekton-catalog-tasks
          - name: type
            value: artifact
          - name: name
            value: golangci-lint
          - name: version
            value: "0.2.0"
          - name: kind
            value: task
      runAfter:
        - git-clone
      params:
        - name: package
          value: .
      workspaces:
        - name: source
          workspace: shared
    - name: source-security-scan
      runAfter:
      - golangci-lint
      taskRef:
        resolver: hub
        params:
          - name: catalog
            value: tekton-catalog-tasks
          - name: type
            value: artifact
          - name: name
            value: trivy-scanner
          - name: version
            value: "0.2.0"
          - name: kind
            value: task
      params:
      - name: ARGS
        value:
        - filesystem
      - name: IMAGE_PATH
        value: "."
      workspaces:
      - name: manifest-dir
        workspace: shared
    - name: image-build
      runAfter:
      - source-security-scan
      taskRef:
        resolver: hub
        params:
          - name: catalog
            value: tekton-catalog-tasks
          - name: type
            value: artifact
          - name: name
            value: buildah
          - name: version
            value: "0.9.0"
          - name: kind
            value: task
      params:
      - name: IMAGE
        value: $(params.output-image)
      - name: STORAGE_DRIVER
        value: vfs
      workspaces:
      - name: shared
