问题描述
我在gitlab管道中有以下代码,这会导致某种竞争状况:
kubectl apply -f pipelineRun.yaml
tkn pipelinerun logs -f pipeline-run
由于尚未创建pipelineRun对象,因此tkn
命令立即退出。这个问题有一个非常好的解决方案:
kubectl apply -f pipelineRun.yaml
kubectl wait --for=condition=Running --timeout=60s pipelinerun/pipeline-run
tkn pipelinerun logs -f pipeline-run
不幸的是,这无法按预期方式工作,因为Running
对于pipelineRun对象似乎不是有效的 condition 。所以我的问题是:pipelineRun对象的有效条件是什么?
解决方法
我没有搜索太远,但看起来他们只有两种从 knative.dev 项目导入的条件类型?
https://github.com/tektoncd/pipeline/blob/main/vendor/knative.dev/pkg/apis/condition_types.go#L32
上面的链接是从管道源代码中导入的条件类型,看起来Tekton只使用了“Ready”和“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"
)
但是在项目的其他地方可能还有其他这种性质的导入。