Created
October 23, 2025 23:52
-
-
Save pritidesai/0f29920d5eda4f1152a3b7cfa14e5c32 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: large-result-task | |
| spec: | |
| results: | |
| - name: result1 | |
| - name: result2 | |
| - name: result3 | |
| type: array | |
| description: The Array results | |
| - name: result4 | |
| - name: result5 | |
| type: object | |
| description: The object results | |
| properties: | |
| url: | |
| type: string | |
| digest: | |
| type: string | |
| steps: | |
| - name: step1 | |
| image: mirror.gcr.io/alpine | |
| script: | | |
| # produce a result - a random string with 2,500 characters - result1 | |
| tr -dc A-Za-z0-9 </dev/urandom | head -c 2500 | tee $(results.result1.path); | |
| # produce a result - a random string with 2,500 characters - result2 | |
| tr -dc A-Za-z0-9 </dev/urandom | head -c 2500 | tee $(results.result2.path); | |
| # produce a result - an array with four elements - result3 | |
| URL1=`tr -dc A-Za-z0-9 </dev/urandom | head -c 600` | |
| URL2=`tr -dc A-Za-z0-9 </dev/urandom | head -c 700` | |
| URL3=`tr -dc A-Za-z0-9 </dev/urandom | head -c 800` | |
| echo -n "[\"$URL1\", \"\", \"$URL2\", \"$URL3\"]" | tee $(results.result3.path) | |
| # produce a result - a random string with 2,500 characters - result4 | |
| tr -dc A-Za-z0-9 </dev/urandom | head -c 2500 | tee $(results.result4.path); | |
| # produce a result - a hash with two objects - result5 | |
| URL=`tr -dc A-Za-z0-9 </dev/urandom | head -c 2000` | |
| DIGEST=`tr -dc A-Za-z0-9 </dev/urandom | head -c 200` | |
| echo -n "{\"url\":\"$URL\",\"digest\":\"$DIGEST\"}" | tee $(results.result5.path) | |
| - image: docker | |
| name: client | |
| env: | |
| # Connect to the sidecar over TCP, with TLS. | |
| - name: DOCKER_HOST | |
| value: tcp://localhost:2376 | |
| # Verify TLS. | |
| - name: DOCKER_TLS_VERIFY | |
| value: '1' | |
| # Use the certs generated by the sidecar daemon. | |
| - name: DOCKER_CERT_PATH | |
| value: /certs/client | |
| workingDir: /workspace | |
| script: | | |
| #!/usr/bin/env sh | |
| set -e | |
| # Run a Docker container. | |
| docker run busybox echo hello | |
| # Write a Dockerfile and `docker build` it. | |
| cat > Dockerfile << EOF | |
| FROM ubuntu | |
| RUN apt-get update | |
| ENTRYPOINT ["echo", "hello"] | |
| EOF | |
| docker build -t hello . | |
| docker images | |
| # ...then run it! | |
| docker run hello | |
| volumeMounts: | |
| - mountPath: /certs/client | |
| name: dind-certs | |
| sidecars: | |
| - image: docker@sha256:74e78208fc18da48ddf8b569abe21563730845c312130bd0f0b059746a7e10f5 | |
| name: server | |
| args: | |
| - --storage-driver=vfs | |
| - --userland-proxy=false | |
| - --debug | |
| computeResources: | |
| requests: | |
| memory: "512Mi" | |
| securityContext: | |
| privileged: true | |
| env: | |
| # Write generated certs to the path shared with the client. | |
| - name: DOCKER_TLS_CERTDIR | |
| value: /certs | |
| volumeMounts: | |
| - mountPath: /certs/client | |
| name: dind-certs | |
| # Wait for the dind daemon to generate the certs it will share with the | |
| # client. | |
| readinessProbe: | |
| periodSeconds: 1 | |
| exec: | |
| command: ['ls', '/certs/client/ca.pem'] | |
| volumes: | |
| - name: dind-certs | |
| emptyDir: {} | |
| --- | |
| apiVersion: tekton.dev/v1 | |
| kind: Task | |
| metadata: | |
| name: verify-large-results | |
| spec: | |
| params: | |
| - name: param1 | |
| - name: param2 | |
| - name: param3 | |
| description: The array param | |
| type: array | |
| - name: param4 | |
| - name: param5 | |
| description: The object param | |
| properties: | |
| url: | |
| type: string | |
| digest: | |
| type: string | |
| steps: | |
| - name: step1 | |
| image: mirror.gcr.io/alpine | |
| args: [ | |
| "$(params.param3[*])" | |
| ] | |
| script: | | |
| #!/usr/bin/env sh | |
| echo "Validating the length of the param reading larger result - param1" | |
| echo "The string param, param1 must be 2500 characters long" | |
| p1=$(params.param1) | |
| if [ "${#p1}" != 2500 ]; then | |
| echo "Error: expected 2500 characters in param1 but has ${#p1} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the length of the param reading larger result - param1" | |
| echo "Validating the length of the param reading larger result - param2" | |
| echo "The string param, param2 must be 2500 characters long" | |
| p2=$(params.param2) | |
| if [ "${#p2}" != 2500 ]; then | |
| echo "Error: expected 2500 characters in param2 but has ${#p2} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the length of the param reading larger result - param2" | |
| echo "Validating the length of the array parameter - param3" | |
| echo "The array parameter, param3 must have 4 elements" | |
| if [[ $# != 4 ]]; then | |
| echo "Error: expected 4 elements in param3 but has $# characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the length of the array parameter - param3" | |
| echo "Validating the first element" | |
| if [ "${#1}" != 600 ]; then | |
| echo "Error: expected 600 characters in the first array element but has ${#1} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the first element" | |
| echo "Validating the second element" | |
| if [ "${#2}" != 0 ]; then | |
| echo "Error: expected 0 characters in the second array element but has ${#2} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the second element" | |
| echo "Validating the third element" | |
| if [ "${#3}" != 700 ]; then | |
| echo "Error: expected 700 characters in the third array element but has ${#3} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the third element" | |
| echo "Validating the fourth element" | |
| if [ "${#4}" != 800 ]; then | |
| echo "Error: expected 800 characters in the fourth array element but has ${#4} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the fourth element" | |
| echo "Validating the length of the param reading larger result - param4" | |
| echo "The string param, param4 must be 2500 characters long" | |
| p4=$(params.param4) | |
| if [ "${#p4}" != 2500 ]; then | |
| echo "Error: expected 2500 characters in param4 but has ${#p4} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating the length of the param reading larger result - param4" | |
| echo "validating param5.url" | |
| p51=$(params.param5.url) | |
| if [ "${#p51}" != 2000 ]; then | |
| echo "Error: expected 2000 characters in the url of the hash param \"param5\" but has ${#p51} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating param5.url" | |
| echo "Validating param5.digest" | |
| p52=$(params.param5.digest) | |
| if [ "${#p52}" != 200 ]; then | |
| echo "Error: expected 200 characters in the digest of the hash param \"param5\" but has ${#p52} characters" | |
| exit 1 | |
| fi | |
| echo "Done validating param5.digest" | |
| --- | |
| apiVersion: tekton.dev/v1 | |
| kind: Pipeline | |
| metadata: | |
| name: large-result-pipeline | |
| spec: | |
| tasks: | |
| - name: large-task | |
| taskRef: | |
| name: large-result-task | |
| - name: verify-results | |
| params: | |
| - name: param1 | |
| value: "$(tasks.large-task.results.result1)" | |
| - name: param2 | |
| value: "$(tasks.large-task.results.result2)" | |
| - name: param3 | |
| value: "$(tasks.large-task.results.result3[*])" | |
| - name: param4 | |
| value: "$(tasks.large-task.results.result4)" | |
| - name: param5 | |
| value: "$(tasks.large-task.results.result5[*])" | |
| taskRef: | |
| name: verify-large-results | |
| results: | |
| - name: large-result | |
| value: $(tasks.large-task.results.result1) | |
| --- | |
| apiVersion: tekton.dev/v1 | |
| kind: PipelineRun | |
| metadata: | |
| generateName: large-result-pipeline-run | |
| spec: | |
| pipelineRef: | |
| name: large-result-pipeline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment