logo
Alauda DevOps Pipelines Docs
logo
Alauda DevOps Pipelines Docs
Navigation

Overview

Introduction
Architecture
Feature Overview
Quick Start
Lifecycle Policy
Release Notes

Concepts

TektonConfig
TektonPipeline
Install

Upgrade

Upgrade Path
Upgrade Alauda DevOps Pipelines Operator

Configure

Adjusting Optional Configuration Items of Subcomponents
Configuring Resource Quotas for Pipeline Components
Pod Template Configuration Guide
Regular Cleanup of TaskRun and PipelineRun Resources

How To

Deploying tekton-pipelines in a global cluster through TektonConfig

Pipelines

Introduction
Architecture

Concepts

Tasks
TaskRuns
Pipelines
PipelineRuns
StepActions
Resolvers
Workspaces
Pod Templates
Quick Start

How To

Adjust Dockerfile for Building Task-Compatible Custom Images
Specifying remote pipelines using hub resolvers
Specifying remote tasks using hub resolvers
Use java-image-build-scan-deploy Pipeline

Trouble Shooting

Failed to create pod due to config error when using custom images in Tekton
Permission Issues When Using Custom Images in run-script Task
Unable to Use Multiple PVC Workspaces in Tekton
permissions

Triggers

Introduction
Architecture

Core Concepts

Core Concepts
EventListener
Trigger
Interceptor
TriggerBinding
TriggerTemplate
Quick Start

How To

Setup EventListener
Use GitLab Event Triggers
Create TriggerTemplate

Troubleshooting

The Pipeline is not automatically triggered
Permission Description

Hub

Introduction
Architecture

Core Concepts

Concepts
Understanding Tekton Hub
Permission Description

Results

Introduction
Architecture

Concepts

Core Concepts
Tekton Results
Quick Start
permissions

Configure

Database Configuration

Supply Chain Security

Introduction
Architecture

Concepts

Core Concepts
Understanding Tekton Chains

Quick Start

Getting Started
Signed Provenance

How To

Image Signature Verification
Build System Provenance Verification
Source Code Repository Verification
Vulnerability Scanning and Verification
Base Image and SBOM Verification
License Compliance Verification
Keyless Signing Verification

Configure

Chains Configuration
Chains Configuration
Authentication for Chains
Signing Key Configuration

API Reference

Introduction

Kubernetes APIs

Pipelines

Pipeline [tekton.dev/v1]
Task [tekton.dev/v1]
PipelineRun [tekton.dev/v1]
TaskRun [tekton.dev/v1]
ClusterTask [tekton.dev/v1]
Run [tekton.dev/v1]
CustomRun [tekton.dev/v1]
StepAction [tekton.dev/v1]
VerificationPolicy [tekton.dev/v1alpha1]
ResolutionRequest [resolution.tekton.dev/v1beta1]

Triggers

Trigger [triggers.tekton.dev/v1beta1]
TriggerTemplate [triggers.tekton.dev/v1beta1]
EventListener [triggers.tekton.dev/v1beta1]
TriggerBinding [triggers.tekton.dev/v1beta1]
Interceptor [triggers.tekton.dev/v1alpha1]
ClusterTriggerBinding [triggers.tekton.dev/v1beta1]
ClusterInterceptor [triggers.tekton.dev/v1alpha1]

Operator

TektonConfig [operator.tekton.dev/v1alpha1]
TektonInstallerSet [operator.tekton.dev/v1alpha1]
TektonPipeline [operator.tekton.dev/v1alpha1]
TektonTrigger [operator.tekton.dev/v1alpha1]
TektonChain [operator.tekton.dev/v1alpha1]
TektonHub [operator.tekton.dev/v1alpha1]
TektonResult [operator.tekton.dev/v1alpha1]
TektonInstallerSet [operator.tekton.dev/v1alpha1]
OpenShift Pipelines as Code [operator.tekton.dev/v1alpha1]

Advanced APIs

Results

Introduction to API Usage
Results List
Results Details
Result records List
Result logs List
📝 Edit this page on GitHub
Previous PageTriggerTemplate
Next PageHow To

#Quick Start

This guide will help you get started with Tekton Triggers by creating a simple "Hello World" trigger scenario to demonstrate its basic functionality.

#TOC

#Prerequisites

  1. Environment Requirements

    • Kubernetes version 1.21 or higher
    • Tekton Operator installed
    • Ensure that Tekton Triggers is installed and ready through the Operator
  2. Required Tools

    • kubectl command line tool
    • curl (for testing triggers)
  3. Permissions

    • Requires namespace administrator privileges

#Create Example Project

#Create Namespace (Optional)

TIP

If you do not want to create a namespace, you can skip this step and modify the namespace name in the example below.

kubectl create namespace tekton-triggers-demo

#Create Service Account and Permissions

Create the file rbac.yaml:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: tekton-triggers-example-sa
  namespace: tekton-triggers-demo
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: tekton-triggers-example-binding
  namespace: tekton-triggers-demo
subjects:
  - kind: ServiceAccount
    name: tekton-triggers-example-sa
    namespace: tekton-triggers-demo
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: tekton-triggers-eventlistener-roles
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: tekton-triggers-example-clusterbinding
subjects:
  - kind: ServiceAccount
    name: tekton-triggers-example-sa
    namespace: tekton-triggers-demo
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: tekton-triggers-aggregate-view

#Apply Configuration

kubectl apply -f rbac.yaml

#Create Hello World TaskRun

#Create Task

Create the file hello-task.yaml:

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: hello-task
  namespace: tekton-triggers-demo
spec:
  params:
    - name: message
      description: Message to print
      type: string
      default: "Hello World!"
  steps:
    - name: echo
      image: alpine
      script: |
        echo "$(params.message)"

#Create Trigger Template

Create the file trigger-template.yaml:

apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerTemplate
metadata:
  name: hello-template
  namespace: tekton-triggers-demo
spec:
  params:
    - name: message
      description: Message to print
      default: "Hello World!"
  resourcetemplates:
    - apiVersion: tekton.dev/v1beta1
      kind: TaskRun
      metadata:
        generateName: hello-run-
        namespace: tekton-triggers-demo
      spec:
        taskRef:
          name: hello-task
        params:
          - name: message
            value: $(tt.params.message)

#Create Trigger Binding

Create the file trigger-binding.yaml:

apiVersion: triggers.tekton.dev/v1beta1
kind: TriggerBinding
metadata:
  name: hello-binding
  namespace: tekton-triggers-demo
spec:
  params:
    - name: message
      value: $(body.message)

#Create Event Listener

Create the file event-listener.yaml:

apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
  name: hello-listener
  namespace: tekton-triggers-demo
spec:
  serviceAccountName: tekton-triggers-example-sa
  triggers:
    - name: hello-trigger
      bindings:
        - ref: hello-binding
      template:
        ref: hello-template

#Apply Configuration

Apply all created resources:

kubectl apply -f hello-task.yaml
kubectl apply -f trigger-template.yaml
kubectl apply -f trigger-binding.yaml
kubectl apply -f event-listener.yaml

#Test the Trigger

#Get EventListener URL

# Wait for the Pod to be ready
kubectl get pods -n tekton-triggers-demo

# Get the service address
export EL_URL=$(kubectl get el hello-listener -n tekton-triggers-demo -o jsonpath='{.status.address.url}')
TIP

Different cluster network configurations may prevent direct use of this address. If you encounter issues, please contact your platform administrator.

If you only need to test, you can access the address within the cluster or forward the address to your local machine using kubectl port-forward -n <namespace> svc/<service-name> <svc-port>:<local-port>.

#Send Test Request

curl -v -H 'Content-Type: application/json' -d '{"message":"Hello, Tekton!"}' $EL_URL

#View Results

# View the created TaskRun
kubectl get taskrun -n tekton-triggers-demo

# View logs of the specific TaskRun
kubectl logs -l eventlistener=hello-listener -n tekton-triggers-demo

#Clean Up Resources

After testing, you can delete the created resources:

kubectl delete namespace tekton-triggers-demo

#Next Steps

Now that you have successfully created and tested a basic Tekton Triggers example, you can:

  1. Explore concepts of Tekton Triggers
  2. Learn how to use Setup EventListeners for common setup instructions
  3. Setup and use Gitlab events to trigger pipelines

#Frequently Asked Questions

  1. EventListener Pod fails to start

    • Check if the RBAC configuration is correct
    • Confirm if the service account has sufficient privileges
  2. Trigger does not respond

    • Verify if the EventListener service is accessible
    • Check if the request format is correct
    • View the EventListener Pod logs
  3. TaskRun is not created

    • Confirm that the TriggerTemplate configuration is correct
    • Check the parameter mapping in TriggerBinding
    • View the error logs of the EventListener