pipeline: Task results do not get passed to conditions
Expected Behavior
Conditions receive Task results as condition parameters.
Actual Behavior
Task results do not get passed properly
Containers:
step-condition-check-condition-1:
Container ID: containerd://4c1637ec361f853159205654e67425ca7ef4b14b3da8f1b3b6316a539e12d21e
Image: python:alpine3.6
Image ID: docker.io/library/python@sha256:766a961bf699491995cc29e20958ef11fd63741ff41dcc70ec34355b39d52971
Port: <none>
Host Port: <none>
Command:
/tekton/tools/entrypoint
Args:
-wait_file
/tekton/downward/ready
-wait_file_content
-post_file
/tekton/tools/0
-termination_path
/tekton/termination
-entrypoint
sh
--
-c
EXITCODE=$(python -c "import sys; input1=str.rstrip(sys.argv[1]); input2=str.rstrip(sys.argv[2]); print(0) if (input1 == 'heads') else print(1)" '$(tasks.flip-coin.results.output)' 'heads'); exit $EXITCODE
Steps to Reproduce the Problem
Can be reproduced from this yaml
apiVersion: tekton.dev/v1alpha1
kind: Condition
metadata:
name: condition-1
spec:
check:
args:
- EXITCODE=$(python -c "import sys; input1=str.rstrip(sys.argv[1]); input2=str.rstrip(sys.argv[2]); print(0) if (input1 == 'heads') else
print(1)" '$(params.flip-coin)' 'heads'); exit $EXITCODE
command:
- sh
- -c
image: python:alpine3.6
params:
- name: flip-coin
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: flip-coin
spec:
results:
- description: /tmp/output
name: output
steps:
- args:
- python -c "import random; result = 'heads' if random.randint(0,1) == 0 else
'tails'; result='heads'; print(result)" | tee $(results.output.path)
command:
- sh
- -c
image: python:alpine3.6
name: flip-coin
---
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: condition-check
spec:
params:
- name: flip-coin
results:
- description: /tmp/output
name: output
steps:
- args:
- EXITCODE=$(python -c "import sys; input1=str.rstrip(sys.argv[1]); input2=str.rstrip(sys.argv[2]); print(input1) if (input1 == 'heads') else
print(input1)" '$(params.flip-coin)' 'heads'); echo $EXITCODE | tee $(results.output.path)
command:
- sh
- -c
image: python:alpine3.6
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: generate-random-number
spec:
results:
- description: /tmp/output
name: output
steps:
- args:
- python -c "import random; print(random.randint($0, $1))" | tee $2
- '0'
- '9'
- $(results.output.path)
command:
- sh
- -c
image: python:alpine3.6
name: generate-random-number
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
annotations:
pipelines.kubeflow.org/pipeline_spec: '{"description": "Shows how to use dsl.Condition().",
"name": "Conditional execution pipeline"}'
name: flip-cond-gen
spec:
params: []
tasks:
- name: flip-coin
params: []
taskRef:
name: flip-coin
- name: condition-check
params:
- name: flip-coin
value: $(tasks.flip-coin.results.output)
taskRef:
name: condition-check
- conditions:
- conditionRef: condition-1
params:
- name: flip-coin
value: $(tasks.flip-coin.results.output)
name: generate-random-number
params: []
taskRef:
name: generate-random-number
Additional Info
-
Kubernetes version:
Output of
kubectl version:
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.8", GitCommit:"211047e9a1922595eaa3a1127ed365e9299a6c23", GitTreeState:"clean", BuildDate:"2019-10-15T12:11:03Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.8+IKS", GitCommit:"c6910e70b932ed9ffe5baedade2274a72925660f", GitTreeState:"clean", BuildDate:"2020-03-13T14:13:41Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
-
Tekton Pipeline version:
Client version: 0.8.0 Pipeline version: v0.11.0-rc2
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (10 by maintainers)
Now I have this:
Preparing a PR for it.
thanks @othomann !!!