apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: deb-bootc-image-builder-push
spec:
  description: |
    Pipeline for building and testing deb-bootc-image-builder on push to main
  params:
    - name: git-url
      type: string
    - name: git-revision
      type: string
    - name: git-ref
      type: string
  workspaces:
    - name: shared-workspace
  tasks:
    - name: fetch-repository
      taskRef:
        name: git-clone
      workspaces:
        - name: output
          workspace: shared-workspace
      params:
        - name: url
          value: $(params.git-url)
        - name: revision
          value: $(params.git-revision)
        - name: ref
          value: $(params.git-ref)
    
    - name: run-tests
      runAfter: ["fetch-repository"]
      taskRef:
        name: deb-bootc-image-builder-test
      workspaces:
        - name: source
          workspace: shared-workspace
      params:
        - name: go-version
          value: "1.22"
    
    - name: build-image
      runAfter: ["run-tests"]
      taskRef:
        name: deb-bootc-image-builder-build
      workspaces:
        - name: source
          workspace: shared-workspace
      params:
        - name: image-name
          value: "deb-bootc-image-builder"
        - name: image-tag
          value: "latest"
