Skip to content

Instantly share code, notes, and snippets.

@pritidesai
Last active June 5, 2020 04:20
Show Gist options
  • Save pritidesai/0c938e4034dbe9e441fee147f1d637cb to your computer and use it in GitHub Desktop.
Save pritidesai/0c938e4034dbe9e441fee147f1d637cb to your computer and use it in GitHub Desktop.
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: pipeline-with-missing-params
spec:
params:
- name: pl-param-x
type: string
- name: pl-param-y
type: string
tasks:
- name: add-params
taskRef:
name: add-params
params:
- name: a
value: "$(params.pl-param-x)"
- name: b
value: "$(params.pl-param-y)"
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: add-params
annotations:
description: |
A simple task that sums the two provided integers
spec:
params:
- name: a
type: string
description: The first integer
- name: b
type: string
description: The second integer
steps:
- name: sum
image: bash:latest
script: |
#!/usr/bin/env bash
echo -n $(( "$(inputs.params.a)" + "$(inputs.params.b)" ))
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: pipelinerun-with-missing-params
spec:
params:
- name: pl-param-x
value: "100"
pipelineRef:
name: pipeline-with-missing-params
@pritidesai
Copy link
Author

kubectl get pr -o json
{
    "apiVersion": "v1",
    "items": [
        {
            "apiVersion": "tekton.dev/v1beta1",
            "kind": "PipelineRun",
            "metadata": {
                "annotations": {
                    "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"tekton.dev/v1beta1\",\"kind\":\"Pipeline\",\"metadata\":{\"annotations\":{},\"name\":\"pipeline-with-missing-params\",\"namespace\":\"default\"},\"spec\":{\"params\":[{\"name\":\"pl-param-x\",\"type\":\"string\"},{\"name\":\"pl-param-y\",\"type\":\"string\"}],\"tasks\":[{\"name\":\"add-params\",\"params\":[{\"name\":\"a\",\"value\":\"$(params.pl-param-x)\"},{\"name\":\"b\",\"value\":\"$(params.pl-param-y)\"}],\"taskRef\":{\"name\":\"add-params\"}}]}}\n"
                },
                "creationTimestamp": "2020-06-05T04:14:26Z",
                "generation": 1,
                "labels": {
                    "tekton.dev/pipeline": "pipeline-with-missing-params"
                },
                "name": "pipelinerun-with-missing-params",
                "namespace": "default",
                "resourceVersion": "4162659",
                "selfLink": "/apis/tekton.dev/v1beta1/namespaces/default/pipelineruns/pipelinerun-with-missing-params",
                "uid": "0d6a7ed5-b464-430f-8dd6-22629cf3b901"
            },
            "spec": {
                "params": [
                    {
                        "name": "pl-param-x",
                        "value": "100"
                    }
                ],
                "pipelineRef": {
                    "name": "pipeline-with-missing-params"
                },
                "timeout": "1h0m0s"
            },
            "status": {
                "completionTime": "2020-06-05T04:14:31Z",
                "conditions": [
                    {
                        "lastTransitionTime": "2020-06-05T04:14:31Z",
                        "message": "TaskRun pipelinerun-with-missing-params-add-params-rnwqd has failed",
                        "reason": "Failed",
                        "status": "False",
                        "type": "Succeeded"
                    }
                ],
                "pipelineSpec": {
                    "params": [
                        {
                            "name": "pl-param-x",
                            "type": "string"
                        },
                        {
                            "name": "pl-param-y",
                            "type": "string"
                        }
                    ],
                    "tasks": [
                        {
                            "name": "add-params",
                            "params": [
                                {
                                    "name": "a",
                                    "value": "$(params.pl-param-x)"
                                },
                                {
                                    "name": "b",
                                    "value": "$(params.pl-param-y)"
                                }
                            ],
                            "taskRef": {
                                "kind": "Task",
                                "name": "add-params"
                            }
                        }
                    ]
                },
                "startTime": "2020-06-05T04:14:26Z",
                "taskRuns": {
                    "pipelinerun-with-missing-params-add-params-rnwqd": {
                        "pipelineTaskName": "add-params",
                        "status": {
                            "completionTime": "2020-06-05T04:14:31Z",
                            "conditions": [
                                {
                                    "lastTransitionTime": "2020-06-05T04:14:31Z",
                                    "message": "\"step-sum\" exited with code 1 (image: \"docker-pullable://bash@sha256:376bd611ec5dfc1248a2d21d921bd62d0b858344ce1516cd133249c0a814387d\"); for logs run: kubectl -n default logs pipelinerun-with-missing-params-add-params-rnwqd-pod-vr7zk -c step-sum\n",
                                    "reason": "Failed",
                                    "status": "False",
                                    "type": "Succeeded"
                                }
                            ],
                            "podName": "pipelinerun-with-missing-params-add-params-rnwqd-pod-vr7zk",
                            "startTime": "2020-06-05T04:14:26Z",
                            "steps": [
                                {
                                    "container": "step-sum",
                                    "imageID": "docker-pullable://bash@sha256:376bd611ec5dfc1248a2d21d921bd62d0b858344ce1516cd133249c0a814387d",
                                    "name": "sum",
                                    "terminated": {
                                        "containerID": "docker://4fa1027e8b653d9d9b696648cbc9a46c74d464c022cdde7b511d7d8ba39fc230",
                                        "exitCode": 1,
                                        "finishedAt": "2020-06-05T04:14:31Z",
                                        "reason": "Error",
                                        "startedAt": "2020-06-05T04:14:31Z"
                                    }
                                }
                            ],
                            "taskSpec": {
                                "params": [
                                    {
                                        "description": "The first integer",
                                        "name": "a",
                                        "type": "string"
                                    },
                                    {
                                        "description": "The second integer",
                                        "name": "b",
                                        "type": "string"
                                    }
                                ],
                                "steps": [
                                    {
                                        "image": "bash:latest",
                                        "name": "sum",
                                        "resources": {},
                                        "script": "#!/usr/bin/env bash\necho -n $(( \"$(inputs.params.a)\" + \"$(inputs.params.b)\" ))\n"
                                    }
                                ]
                            }
                        }
                    }
                }
            }
        }
    ],
    "kind": "List",
    "metadata": {
        "resourceVersion": "",
        "selfLink": ""
    }
}

@pritidesai
Copy link
Author

kubectl get pr
NAME                            SUCCEEDED   REASON   STARTTIME   COMPLETIONTIME
pipelinerun-with-missing-params   False       Failed   4m56s       4m51s

@pritidesai
Copy link
Author

kubectl get pods
NAME                                                       READY   STATUS   RESTARTS   AGE
pipelinerun-with-missing-params-add-params-rnwqd-pod-vr7zk   0/1     Error    0          5m26s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment