我有一条管道
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: git-clone-pipeline
spec:
params:
- name: repo-url
type: string
workspaces:
- name: shared-workspace
tasks:
- name: clone-repository
taskRef:
name: git-clone
workspaces:
- name: output
workspace: shared-workspace
params:
- name: url
value: "$(params.repo-url)"
- name: deleteExisting
value: "true"
- name: build
taskRef:
name: gradle
runAfter:
- "clone-repository"
params:
- name: TASKS
value: build
- name: GRADLE_IMAGE
value: docker.io/library/gradle:jdk17-alpine@sha256:dd16ae381eed88d2b33f977b504fb37456e553a1b9c62100b8811e4d8dec99ff
- name: PROJECT_DIR
value: ./discount-api
workspaces:
- name: source
workspace: shared-workspace和管道运行的。
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: run-pipeline
namespace: tekton-pipelines
spec:
serviceAccountName: git-service-account
pipelineRef:
name: git-clone-pipeline
workspaces:
- name: shared-workspace
emptyDir: {}
params:
- name: repo-url
value: git@bitbucket.org:anandjaisy/discount.git和一个项目结构目录作为

在管道运行过程中面临问题
2022-06-18T08:17:57.775506334Z Directory '/workspace/source/discount-api' does not contain a Gradle build.此问题与未找到的文件有关。git-克隆任务已经克隆了集群中某个地方的代码。我怎么知道密码在哪?
kubectl get pods
run-pipeline-build-pod 0/1 Error 0 173m
run-pipeline-fetch-source-pod 0/1 Completed 0 173m
tekton-dashboard-b7b8599c6-wf7b2 1/1 Running 0 12d
tekton-pipelines-controller-674dd45d79-529pc 1/1 Running 0 12d
tekton-pipelines-webhook-86b8b9d87b-qmxzk 1/1 Running 0 12d
tekton-triggers-controller-6d769dddf7-847nt 1/1 Running 0 12d
tekton-triggers-core-interceptors-69c47c4bb7-77bvt 1/1 Running 0 12d
tekton-triggers-webhook-7c4fc7c74-lgm79 1/1 Running 0 12d如果我们这样做,登录POD,run-pipeline-build-pod会得到一个异常,如上。
kubectl exec --stdin --tty <Pod-name> -- /bin/bash上面的命令用于进入吊舱,但是,在上面的情况下,run-pipeline-fetch-source-pod已经完成,我们不能应用上面的代码。
如何解决这个文件问题?
发布于 2022-06-18 15:12:23
您正在使用emptyDir作为工作区。你应该用聚氯乙烯。您可以使用这样的方法修复您的PipelineRun:
workspaces:
- name: shared-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi工作空间由您的git克隆任务使用。在描述PipelineRun中的git-克隆荚时,您应该可以找到一个emptyDir类型的卷。也就是克隆数据的地方。
然后,在另一个pod中使用另一个任务(作为一个emptyDir )中的工作区:从零开始,在pod启动时没有数据。PVC将允许您在任务之间共享数据。
至于调试:一旦豆荚完成,就没有什么可做的了。
调试PipelineRuns时,如果它的退出速度太快,我将尝试更改失败的容器参数(编辑相应的任务),添加一些“睡眠86400”或其他类似的内容,而不是它通常的命令。然后重新启动一个PipelineRun。
在您的情况下,如果您已经有一个PVC作为您的工作空间:只要启动一个Pod (创建一个部署),附加由您的PipelineRun创建的PVC,检查其中的内容,
https://stackoverflow.com/questions/72668881
复制相似问题