3

I have the following code within a gitlab pipeline which results in some kind of race condition:

kubectl apply -f pipelineRun.yaml
tkn pipelinerun logs -f pipeline-run

The tkn command immediately exits, since the pipelineRun object is not yet created. There is one very nice solution for this problem:

kubectl apply -f pipelineRun.yaml
kubectl wait --for=condition=Running --timeout=60s pipelinerun/pipeline-run
tkn pipelinerun logs -f pipeline-run

Unfortunately this is not working as expected, since Running seems to be no valid condition for a pipelineRun object. So my question is: what are the valid conditions of a pipelineRun object?

mhubig
  • 73
  • 9

2 Answers2

0

I didn't search too far and wide, but it looks like they only have two condition types imported from the knative.dev project?

https://github.com/tektoncd/pipeline/blob/main/vendor/knative.dev/pkg/apis/condition_types.go#L32

The link above is for the imported condition types from the pipeline source code of which it looks like Tekton only uses "Ready" and "Succeeded".

const (
    // ConditionReady specifies that the resource is ready.
    // For long-running resources.
    ConditionReady ConditionType = "Ready"
    // ConditionSucceeded specifies that the resource has finished.
    // For resource which run to completion.
    ConditionSucceeded ConditionType = "Succeeded"
)

But there may be other imports of this nature elsewhere in the project.

4m1r
  • 12,234
  • 9
  • 46
  • 58
  • This is a question and a link. How do you intend this to answer the question at the top of this page? – Yunnosch Jun 29 '21 at 19:57
  • The question is intended to imply, "maybe there are more?" and the link is intended to be a definite answer to the question. As in, "This is an answer". – 4m1r Jun 29 '21 at 20:16
  • So the question is not meant rhetoric, answering in itself. Then your posts only answers via link, making it link-only, which in turn is not considered an answer on StackOverflow. Please at least summarise the actual answer, instead of only linking. – Yunnosch Jun 29 '21 at 20:42
  • Ah, good point. Didn't know that link only answers were verboten. – 4m1r Jun 30 '21 at 14:12
  • Thanks for augmenting the link. However, I still do not get how this is supposed to answer the question or solve the problem. Do you need a [mred] to track down the problem completly? – Yunnosch Jun 30 '21 at 14:18
  • q: "what are the valid conditions of a pipelineRun object?" a: 'it looks like Tekton only uses "Ready" and "Succeeded".' am I missing something? what is an 'mred'? – 4m1r Jun 30 '21 at 15:10
  • Sorry. mred is a typo should be mre which should have caused the link [mre]. – Yunnosch Jun 30 '21 at 15:17
  • added the code block in reference. thanks. – 4m1r Jun 30 '21 at 15:48
0

Tekton TaskRuns and PipelineRun only use a condition of type Succeeded.

Example:

conditions:
  - lastTransitionTime: "2020-05-04T02:19:14Z"
    message: "Tasks Completed: 4, Skipped: 0"
    reason: Succeeded
    status: "True"
    type: Succeeded

The different status and messages available for the Succeeded condition are available in the documentation:

As a side note, there is an activity timeout available in the API. That timeout is not surfaced to the CLI options though. You could create a tkn feature request for that.

andreaf
  • 51
  • 2