Skip to content

Instantly share code, notes, and snippets.

@pritidesai
Created December 19, 2025 17:36
Show Gist options
  • Select an option

  • Save pritidesai/20e1ec24d50859555a73f3a2bfd3d6c3 to your computer and use it in GitHub Desktop.

Select an option

Save pritidesai/20e1ec24d50859555a73f3a2bfd3d6c3 to your computer and use it in GitHub Desktop.
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: build-task
spec:
params:
- name: app-name
type: string
default: my-app
results:
- name: artifact
description: Name (or path) of the built artifact
- name: version
description: Build version
steps:
- name: build
image: alpine:3.20
script: |
set -eu
echo "Building $(params.app-name)…"
# Produce a simple version string
VERSION="v$(date +%Y%m%d%H%M%S)"
# Produce an artifact name
ARTIFACT="artifact-for-$(params.app-name)"
# Write results
echo -n "${ARTIFACT}" > /tekton/results/artifact
echo -n "${VERSION}" > /tekton/results/version
echo "✅ Build complete: ${ARTIFACT} @ ${VERSION}"
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: test-task
spec:
params:
- name: artifact
type: string
- name: version
type: string
steps:
- name: run-tests
image: alpine:3.20
script: |
set -eu
echo "Running tests against artifact: $(params.artifact) (version: $(params.version))"
# Simulate tests
echo "✅ Tests passed for $(params.artifact) @ $(params.version)"
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ci-pipeline
spec:
params:
- name: app-name
type: string
default: my-app
tasks:
- name: build
taskRef:
name: build-task
params:
- name: app-name
value: $(params.app-name)
- name: test
runAfter: [build]
taskRef:
name: test-task
params:
- name: artifact
value: $(tasks.build.results.artifact)
- name: version
value: $(tasks.build.results.version)
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ci-pipelinerun
spec:
pipelineRef:
name: ci-pipeline
params:
- name: app-name
value: my-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment