This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.4.5. 运行 Pipeline
PipelineRun
资源启动管道,并将其与 Git 和用于特定调用的镜像资源相关联。它为管道中的每个任务自动创建并启动 TaskRun
资源。
流程
启动后端应用程序的管道:
tkn pipeline start build-and-deploy \ -w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-3/01_pipeline/03_persistent_volume_claim.yaml \ -p deployment-name=vote-api \ -p git-url=http://github.com/openshift-pipelines/vote-api.git \ -p IMAGE=image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/vote-api \
$ tkn pipeline start build-and-deploy \ -w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-3/01_pipeline/03_persistent_volume_claim.yaml \ -p deployment-name=vote-api \ -p git-url=http://github.com/openshift-pipelines/vote-api.git \ -p IMAGE=image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/vote-api \
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 上一命令使用卷声明模板,该模板为管道执行创建持久性卷声明。
要跟踪管道运行的进度,请输入以下命令:
tkn pipelinerun logs <pipelinerun_id> -f
$ tkn pipelinerun logs <pipelinerun_id> -f
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 上述命令中的 <pipelinerun_id> 是上一命令输出返回的
PipelineRun
的 ID。启动前端应用程序的 Pipeline:
tkn pipeline start build-and-deploy \ -w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-3/01_pipeline/03_persistent_volume_claim.yaml \ -p deployment-name=vote-ui \ -p git-url=http://github.com/openshift-pipelines/vote-ui.git \ -p IMAGE=image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/vote-ui \
$ tkn pipeline start build-and-deploy \ -w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-3/01_pipeline/03_persistent_volume_claim.yaml \ -p deployment-name=vote-ui \ -p git-url=http://github.com/openshift-pipelines/vote-ui.git \ -p IMAGE=image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/vote-ui \
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 要跟踪管道运行的进度,请输入以下命令:
tkn pipelinerun logs <pipelinerun_id> -f
$ tkn pipelinerun logs <pipelinerun_id> -f
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 上述命令中的 <pipelinerun_id> 是上一命令输出返回的
PipelineRun
的 ID。几分钟后,使用
tkn pipelinerun list
命令列出所有 PipelineRuns 来验证 Pipeline 是否成功运行:tkn pipelinerun list
$ tkn pipelinerun list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出中列出了 PipelineRuns:
NAME STARTED DURATION STATUS build-and-deploy-run-xy7rw 1 hour ago 2 minutes Succeeded build-and-deploy-run-z2rz8 1 hour ago 19 minutes Succeeded
NAME STARTED DURATION STATUS build-and-deploy-run-xy7rw 1 hour ago 2 minutes Succeeded build-and-deploy-run-z2rz8 1 hour ago 19 minutes Succeeded
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 获取应用程序路由:
oc get route vote-ui --template='http://{{.spec.host}}'
$ oc get route vote-ui --template='http://{{.spec.host}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 记录上一个命令的输出。您可以使用此路由来访问应用程序。
要重新运行最后的管道运行,请使用上一管道的管道资源和服务帐户运行:
tkn pipeline start build-and-deploy --last
$ tkn pipeline start build-and-deploy --last
Copy to Clipboard Copied! Toggle word wrap Toggle overflow