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" | |
--- |
Author
pritidesai
commented
May 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment