Created
December 19, 2025 17:36
-
-
Save pritidesai/20e1ec24d50859555a73f3a2bfd3d6c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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