Skip to content

Files

Latest commit

 

History

History
151 lines (133 loc) · 4.56 KB

pipeline-config.md

File metadata and controls

151 lines (133 loc) · 4.56 KB

pipeline-config

Overview

Config allows to specify default values and triggers to create a list of PipelineRun based on InterceptorRequest.

Specifying Config

Config supports supports the following fields:

  • defaults - Specifies common default values for each Pipeline.
  • triggers - Specifies a list of Trigger.

Sample config file:

defaults:
  timeouts:
    pipeline: 1h
    tasks: 30m
    finally: 10m
  metadata:
    namespace: tekton
    annotations:
      github.tekton.dev/owner: body.repository.owner.login
      github.tekton.dev/repo: body.repository.name
      github.tekton.dev/commit: >-
        "pull_request" in body
          ? body.pull_request.head.sha
          : body.head_commit.id
      github.tekton.dev/url: >-
        https://dashboard.tekton.dev/#/namespaces/{{ .Namespace }}/pipelineruns/{{ index .Labels "tekton.dev/pipelineRun" }}?pipelineTask={{ index .Labels "tekton.dev/pipelineTask" }}
      github.tekton.dev/name: >-
        {{ index .Labels "tekton.dev/pipeline" }} / {{ index .Labels "tekton.dev/pipelineTask" }}
  params:
    - name: clone-url
      value: body.repository.clone_url
    - name: clone-ref
      value: >-
        "pull_request" in body
          ? body.pull_request.head.sha
          : body.head_commit.id
    - name: repo-name
      value: body.repository.name
    - name: repo-owner-name
      value: body.repository.owner.login
  workspaces:
    - name: source
      volumeClaimTemplate:
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 5Gi
          storageClassName: <Storage Class Name>
    - name: cache
      persistentVolumeClaim:
        claimName: <PVC name>
  podTemplate:
    tolerations:
      - effect: NoSchedule
        key: tekton-pipelines
        operator: Equal
        value: "true"
    nodeSelector:
      node_pool: tekton-pipelines
triggers:
  - name: pr
    filter: >-
      "action" in body &&  body.action in ["opened", "synchronize", "reopened"]
    pipelines: [ ]
    defaults:
      params: [ ]
  - name: main
    filter: >-
      "ref" in body && body.ref == "refs/heads/main"
    pipelines: [ ]
    defaults:
      params: [ ]
  - name: tag
    filter: >-
      "ref" in body && body.ref.startsWith("refs/tags/")
    defaults:
      params: [ ]

Specifying Defaults

Defaults definition contains all Pipeline fields except name.

Specifying Triggers

Each Triggers definition supports the following fields:

Specifying Pipeline

Pipeline definition supports the following fields:

  • * - all PipelineRunSpec fields.
  • name - Specifies a name of current pipeline.
  • metadata - Specifies metadata that uniquely identifies pipeline, eg. annotations.

Example on how to rewrite computeResources for task or task.step

triggers:
  - name: pr
    pipelines:
      - name: buf
        pipelineRef:
          resolver: git
          params:
            - name: repo
              value: tekton-catalog-new
            - name: pathInRepo
              value: pipeline/protos/0.3/buf.yaml
        taskRunSpecs:
          - pipelineTaskName: lint
            computeResources:
              requests:
                memory: 1Gi
                cpu: '1'
              limits:
                memory: 1Gi
                cpu: '1'

          - pipelineTaskName: svu
            stepSpecs:
              - name: svu
                computeResources:
                  requests:
                    memory: 1.2Gi
                    cpu: '1.2'
                  limits:
                    memory: 1.2Gi
                    cpu: '1.2'