搜索

21.4. 执行 OpenShift Operator 管道

download PDF

您可以使用以下方法运行 OpenShift Operator 管道。

提示

在以下示例中,根据您的要求删除或添加参数和工作区。

如果您使用 Red Hat OpenShift Local,以前称为 Red Hat CodeReady Containers (CRC)或 Red Hat OpenShift on IBM Power for ppc64le 架构,请将以下 tekton CLI 参数传递给每个 ci pipeline 命令以避免权限问题:

--pod-template templates/crc-pod-template.yml

故障排除

如果您的 OpenShift Pipelines operator 1.9 或更高版本无法正常工作,请按照以下步骤修复它:

先决条件

在创建自定义安全性上下文约束(SCC)前,请确保您具有集群的管理员特权。

流程

要使 OpenShift Pipelines operator 1.9 或更高版本正常工作,并在需要特权升级的 ci-pipeline 中执行一部分任务,创建一个自定义安全性上下文约束(SCC),并使用下列命令将它链接到 pipeline 服务帐户:

  1. 创建新 SCC:

    oc apply -f ansible/roles/operator-pipeline/templates/openshift/openshift-pipelines-custom-scc.yml
  2. 将新 SCC 添加到 ci-pipeline 服务帐户:

    oc adm policy add-scc-to-user pipelines-custom-scc -z pipeline

其他资源

如需有关 SCC 的更多信息,请参阅关于安全性上下文约束

21.4.1. 运行 Minimal 管道

流程

在终端窗口中运行以下命令:

GIT_REPO_URL=<Git URL to your certified-operators fork >
BUNDLE_PATH=<path to the bundle in the Git Repo> (For example - operators/my-operator/1.2.8)

tkn pipeline start operator-ci-pipeline \
  --param git_repo_url=$GIT_REPO_URL \
  --param git_branch=main \
  --param bundle_path=$BUNDLE_PATH \
  --param env=prod \
  --workspace name=pipeline,volumeClaimTemplateFile=templates/workspace-template.yml \
  --showlog

运行命令后,管道会提示您提供额外的参数。接受所有默认值以完成管道执行。

以下被设置为 default,不需要显式包含,但如果 kubeconfig secret 在不同名称下创建,则可以被覆盖。

--param kubeconfig_secret_name=kubeconfig \
--param kubeconfig_secret_key=kubeconfig

如果您在 ppc64le 和 s390x 架构上运行 ci 管道,请从默认值 quay.io/redhat-isv/operator-pipelines-images:released 改为 quay.io/redhat-isv/operator-pipelines-images:multi-arch

故障排除

如果您在使用 SSH URL 时收到 Permission Denied 错误,请尝试 GITHUB HTTPS URL。

21.4.2. 使用镜像摘要固定运行管道

先决条件

执行 启用摘要固定的指令

流程

在终端窗口中运行以下命令:

GIT_REPO_URL=<Git URL to your certified-operators fork >
BUNDLE_PATH=<path to the bundle in the Git Repo> (ie: operators/my-operator/1.2.8)
GIT_USERNAME=<your github username>
GIT_EMAIL=<your github email address>

tkn pipeline start operator-ci-pipeline \
  --param git_repo_url=$GIT_REPO_URL \
  --param git_branch=main \
  --param bundle_path=$BUNDLE_PATH \
  --param env=prod \
  --param pin_digests=true \
  --param git_username=$GIT_USERNAME \
  --param git_email=$GIT_EMAIL \
  --workspace name=pipeline,volumeClaimTemplateFile=templates/workspace-template.yml \
  --workspace name=ssh-dir,secret=github-ssh-credentials \
  --showlog

故障排除

当您收到错误 - 无法读取 https://github.com的 Username 时,请提供 --param git_repo_url 的 SSH github URL。

21.4.3. 使用私有容器 registry 运行管道

先决条件

使用私有容器 registry 执行包含在 下的指令。

流程

在终端窗口中运行以下命令:

GIT_REPO_URL=<Git URL to your certified-operators fork >
BUNDLE_PATH=<path to the bundle in the Git Repo> (ie: operators/my-operator/1.2.8)
GIT_USERNAME=<your github username>
GIT_EMAIL=<your github email address>
REGISTRY=<your image registry.  ie: quay.io>
IMAGE_NAMESPACE=<namespace in the container registry>

tkn pipeline start operator-ci-pipeline \
  --param git_repo_url=$GIT_REPO_URL \
  --param git_branch=main \
  --param bundle_path=$BUNDLE_PATH \
  --param env=prod \
  --param pin_digests=true \
  --param git_username=$GIT_USERNAME \
  --param git_email=$GIT_EMAIL \
  --param registry=$REGISTRY \
  --param image_namespace=$IMAGE_NAMESPACE \
  --workspace name=pipeline,volumeClaimTemplateFile=templates/workspace-template.yml \
  --workspace name=ssh-dir,secret=github-ssh-credentials \
  --workspace name=registry-credentials,secret=registry-docker config-secret \
  --showlog \
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.