Last active
May 27, 2020 22:06
-
-
Save pritidesai/931936e2bd61c50df29fdc767442b494 to your computer and use it in GitHub Desktop.
This file contains 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/v1beta1 | |
kind: Task | |
metadata: | |
name: sum-two-ints | |
annotations: | |
description: | | |
A simple task that sums the two provided integers | |
spec: | |
params: | |
- name: a | |
type: string | |
default: "1" | |
description: The first integer | |
- name: b | |
type: string | |
default: "1" | |
description: The second integer | |
results: | |
- name: sum-result | |
description: The sum of the two provided integers | |
steps: | |
- name: sum | |
image: bash:latest | |
script: | | |
#!/usr/bin/env bash | |
echo $(params.a) | |
echo $(params.b) | |
# echo -n $(( "$(params.a)" + "$(params.b)" )) | tee $(results.sum-result.path) | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: Task | |
metadata: | |
name: format-result | |
spec: | |
params: | |
- name: result | |
type: string | |
steps: | |
- name: print-sum | |
image: ubuntu | |
script: echo -n "*** Result = $(params.result) ***" | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: Pipeline | |
metadata: | |
name: sum-and-print-pipeline | |
spec: | |
params: | |
- name: a | |
type: string | |
default: "1" | |
- name: b | |
type: string | |
default: "1" | |
tasks: | |
- name: sum-inputs | |
taskRef: | |
name: sum-two-ints | |
params: | |
- name: a | |
value: "$(params.a)" | |
- name: b | |
value: "$(params.b)" | |
- name: print-sum | |
taskRef: | |
name: format-result | |
params: | |
- name: result | |
value: "$(tasks.sum-inputs.results.sum-result)" | |
--- | |
apiVersion: tekton.dev/v1beta1 | |
kind: PipelineRun | |
metadata: | |
name: sum-and-print-pipeline-run | |
spec: | |
pipelineRef: | |
name: sum-and-print-pipeline | |
params: | |
- name: a | |
value: "100" | |
- name: b | |
value: "1000" | |
--- |
{
"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\":\"sum-and-print-pipeline\",\"namespace\":\"default\"},\"spec\":{\"params\":[{\"default\":\"1\",\"name\":\"a\",\"type\":\"string\"},{\"default\":\"1\",\"name\":\"b\",\"type\":\"string\"}],\"tasks\":[{\"name\":\"sum-inputs\",\"params\":[{\"name\":\"a\",\"value\":\"$(params.a)\"},{\"name\":\"b\",\"value\":\"$(params.b)\"}],\"taskRef\":{\"name\":\"sum-two-ints\"}},{\"name\":\"print-sum\",\"params\":[{\"name\":\"result\",\"value\":\"$(tasks.sum-inputs.results.sum-result)\"}],\"taskRef\":{\"name\":\"format-result\"}}]}}\n"
},
"creationTimestamp": "2020-05-27T17:13:57Z",
"generation": 1,
"labels": {
"tekton.dev/pipeline": "sum-and-print-pipeline"
},
"name": "sum-and-print-pipeline-run",
"namespace": "default",
"resourceVersion": "3865787",
"selfLink": "/apis/tekton.dev/v1beta1/namespaces/default/pipelineruns/sum-and-print-pipeline-run",
"uid": "a2d77a34-9853-46f7-9f00-45e1a76865e4"
},
"spec": {
"params": [
{
"name": "a",
"value": "100"
},
{
"name": "b",
"value": "1000"
}
],
"pipelineRef": {
"name": "sum-and-print-pipeline"
},
"timeout": "1h0m0s"
},
"status": {
"completionTime": "2020-05-27T17:14:09Z",
"conditions": [
{
"lastTransitionTime": "2020-05-27T17:14:09Z",
"message": "unable to find result referenced by param \"result\" in \"print-sum\": Could not find result with name sum-result for task run sum-inputs",
"reason": "InvalidTaskResultReference",
"status": "False",
"type": "Succeeded"
}
],
"pipelineSpec": {
"params": [
{
"default": "1",
"name": "a",
"type": "string"
},
{
"default": "1",
"name": "b",
"type": "string"
}
],
"tasks": [
{
"name": "sum-inputs",
"params": [
{
"name": "a",
"value": "$(params.a)"
},
{
"name": "b",
"value": "$(params.b)"
}
],
"taskRef": {
"kind": "Task",
"name": "sum-two-ints"
}
},
{
"name": "print-sum",
"params": [
{
"name": "result",
"value": "$(tasks.sum-inputs.results.sum-result)"
}
],
"taskRef": {
"kind": "Task",
"name": "format-result"
}
}
]
},
"startTime": "2020-05-27T17:13:57Z",
"taskRuns": {
"sum-and-print-pipeline-run-sum-inputs-5n2jl": {
"pipelineTaskName": "sum-inputs",
"status": {
"completionTime": "2020-05-27T17:14:09Z",
"conditions": [
{
"lastTransitionTime": "2020-05-27T17:14:09Z",
"message": "All Steps have completed executing",
"reason": "Succeeded",
"status": "True",
"type": "Succeeded"
}
],
"podName": "sum-and-print-pipeline-run-sum-inputs-fhcjx-pod-5jhvd",
"startTime": "2020-05-27T17:13:58Z",
"steps": [
{
"container": "step-sum",
"imageID": "docker-pullable://bash@sha256:145e00f05adb8b2fcf914380f2efeeb0efeda8b3fb4025b1118146311099933f",
"name": "sum",
"terminated": {
"containerID": "docker://ea4f25e6741d19b39f6013c0fbb52a44450ebb22ba8569c26c64cf53acb7c8d5",
"exitCode": 0,
"finishedAt": "2020-05-27T17:14:08Z",
"reason": "Completed",
"startedAt": "2020-05-27T17:14:08Z"
}
}
],
"taskSpec": {
"params": [
{
"default": "1",
"description": "The first integer",
"name": "a",
"type": "string"
},
{
"default": "1",
"description": "The second integer",
"name": "b",
"type": "string"
}
],
"results": [
{
"description": "The sum of the two provided integers",
"name": "sum-result"
}
],
"steps": [
{
"image": "bash:latest",
"name": "sum",
"resources": {},
"script": "#!/usr/bin/env bash\necho $(params.a)\necho $(params.b)\n"
}
]
}
}
}
}
}
}
],
"kind": "List",
"metadata": {
"resourceVersion": "",
"selfLink": ""
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pod is created for
sum-inputs
without any failure: