搜索

1.6. 运行管道

download PDF

PipelineRun 资源启动管道,并将其与 Git 和用于特定调用的镜像资源相关联。它为管道中的每个任务自动创建并启动 TaskRun 资源。

流程

  1. 启动后端应用程序的管道:

    $ tkn pipeline start build-and-deploy \
        -w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/openshift/pipelines-tutorial/pipelines-1.15/01_pipeline/03_persistent_volume_claim.yaml \
        -p deployment-name=pipelines-vote-api \
        -p git-url=https://github.com/openshift/pipelines-vote-api.git \
        -p IMAGE='image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/pipelines-vote-api' \
        --use-param-defaults

    上一命令使用卷声明模板,该模板为管道执行创建持久性卷声明。

  2. 要跟踪管道运行的进度,请输入以下命令:

    $ tkn pipelinerun logs <pipelinerun_id> -f

    上述命令中的 <pipelinerun_id> 是上一命令输出返回的 PipelineRun 的 ID。

  3. 启动前端应用程序的管道:

    $ tkn pipeline start build-and-deploy \
        -w name=shared-workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/openshift/pipelines-tutorial/pipelines-1.15/01_pipeline/03_persistent_volume_claim.yaml \
        -p deployment-name=pipelines-vote-ui \
        -p git-url=https://github.com/openshift/pipelines-vote-ui.git \
        -p IMAGE='image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/pipelines-vote-ui' \
        --use-param-defaults
  4. 要跟踪管道运行的进度,请输入以下命令:

    $ tkn pipelinerun logs <pipelinerun_id> -f

    上述命令中的 <pipelinerun_id> 是上一命令输出返回的 PipelineRun 的 ID。

  5. 几分钟后,使用 tkn pipelinerun list 命令列出所有管道运行来验证管道是否成功运行:

    $ tkn pipelinerun list

    输出列出了管道运行:

     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
  6. 获取应用程序路由:

    $ oc get route pipelines-vote-ui --template='http://{{.spec.host}}'

    记录上一个命令的输出。您可以使用此路由来访问应用程序。

  7. 要重新运行最后的管道运行,请使用上一管道的管道资源和服务帐户运行:

    $ tkn pipeline start build-and-deploy --last
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.