gpt4 book ai didi

kubernetes - 如何等待 tekton pipelineRun 条件

转载 作者:行者123 更新时间:2023-12-05 06:59:34 24 4
gpt4 key购买 nike

我在 gitlab 管道中有以下代码,这会导致某种竞争条件:

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

tkn 命令立即退出,因为尚未创建 pipelineRun 对象。这个问题有一个很好的解决方案:

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

不幸的是,这没有按预期工作,因为 Running 似乎不是 pipelineRun 对象的有效条件。所以我的问题是: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"
)

但是在项目的其他地方可能还有这种性质的其他导入。

关于kubernetes - 如何等待 tekton pipelineRun 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64379343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com