配置 Azure Pipelines


Red Hat Advanced Developer Suite - software supply chain 1.7

了解如何为安全 CI/CD 工作流配置 Azure CI。

Red Hat Advanced Developer Suite - software supply chain Documentation Team

摘要

本文档提供有关设置 Azure CI 以执行基本安全任务的说明,如漏洞扫描、镜像签名和测试生成。

前言

如果您在应用程序中使用 Azure Pipelines,则管道运行可能会因为缺少 secret 和环境变量而失败。如果没有它们,与 Quay、JFrog Artifactory 和 Red Hat Advanced Cluster Security (ACS)的集成将无法正常工作,破坏漏洞扫描、镜像签名和 SBOM 生成合规性等安全任务。

要防止这种情况,您需要在 Azure 中安全地存储 secret 和环境变量。本指南指导您完成这个过程,确保管道平稳运行。

此流程解释了如何在 Azure Pipelines 中添加 secret 和环境变量,并列出需要哪些变量。必须添加所有列出的变量,以确保 Azure Pipelines 与 RHADS - SSC 及相关的红帽产品正常工作。

先决条件

在配置 Azure Pipelines 前,请确定您有以下几项:

  • 管理员在 Bitbucket 或 GitHub 中访问您的存储库。
  • 管理员访问 Azure DevOps 项目和管道设置。
  • 用于从 Quay.io、JFrog Artifactory 或 Sonatype Nexus 中拉取容器镜像的 容器注册表凭证
  • 特定 Azure Pipelines 任务的 身份验证详情

    • 对于 ACS 安全任务

      • ROX Central 服务器端点
      • ROX API 令牌
    • 对于 SBOM 和工件签名任务

      • Cosign 签名密钥密码、私钥和公钥
      • Trustification API 和 issuer URL, client ID, client secret, and supported CycloneDX version
    注意

    凭证和其他详情已经经过 Base64 编码,因此您不需要再次编码它们。您可以在 RHADS - SSC 安装过程中创建的 private.env 文件中找到这些凭证。

流程

  1. 登录 https://dev.azure.com 并打开 Azure DevOps 项目。
  2. 在左侧导航面板中,选择 Pipelines,然后选择 Library
  3. 选择 Variable group 来创建新变量组。
  4. 输入变量组的名称,如 rhtap
  5. 在变量组编辑器中:

    1. 选择 Add 来添加新变量。
    2. Name 字段中输入密钥。例如,GITOPS_AUTH_PASSWORD
    3. Value 字段中,输入用于与 GitOps 存储库进行身份验证的值,以推送更新的镜像信息。
    4. 选中 Keep this value secret 复选框,以屏蔽 UI 和日志中的值。
  6. 重复步骤 5 以添加所有必需的 secret:

    Expand
    表 1.1. 镜像 registry 和 GitOps secret
    变量描述

    IMAGE_REGISTRY_PASSWORD

    用于访问容器镜像 registry 的密码。

    GITOPS_AUTH_PASSWORD

    系统用来为新构建镜像更新 GitOps 存储库的令牌。

    Expand
    表 1.2. ACS 和 SBOM 任务所需的 secret
    变量描述

    ROX_API_TOKEN

    用于访问 ROX 服务器的 API 令牌。

    COSIGN_SECRET_PASSWORD

    Cosign 签名密钥的密码。

    COSIGN_SECRET_KEY

    Cosign 的私钥。

    TRUSTIFICATION_OIDC_CLIENT_SECRET

    与客户端 ID 一起使用的客户端 secret,以向 Trustification Bombastic API 进行身份验证。

  1. 现在,添加常规环境变量,且不屏蔽它们的值。在变量组编辑器中:

    1. 选择 添加
    2. Name 字段中输入密钥。例如,IMAGE_REGISTRY_USER
    3. Value 字段中,输入值。在我们的示例中:用于访问容器镜像 registry 的用户名。
    4. 不要选择 Keep this value secret 复选框。
  2. 重复步骤 6 以添加所有必需的环境变量:

    Expand
    表 1.3. 镜像 registry 和 GitOps 变量
    变量描述

    IMAGE_REGISTRY_USER

    用于访问容器镜像 registry 的用户名。

    GITOPS_AUTH_USERNAME (可选)

    您的 OpenShift GitOps 用户名。Azure 需要此变量才能使用 Bitbucket。默认情况下,带有此变量的行在 azure-pipelines.yml 文件中被注释。要开始使用 Bitbucket,请取消对第 # GITOPS_AUTH_USERNAME: $(GITOPS_AUTH_USERNAME) 行的所有 5 实例的注释。

    Expand
    表 1.4. ACS 和 SBOM 任务所需的变量
    变量描述

    ROX_CENTRAL_ENDPOINT

    ROX Central 服务器的端点。

    COSIGN_PUBLIC_KEY

    Cosign 的公钥。

    TRUSTIFICATION_BOMBASTIC_API_URL

    SBOM 生成中使用的 Trustification Bombastic API 的 URL。

    TRUSTIFICATION_OIDC_ISSUER_URL

    与 Trustification Bombastic API 交互时用于身份验证的 OIDC 签发者 URL。

    TRUSTIFICATION_OIDC_CLIENT_ID

    用于使用 OIDC 向 Trustification Bombastic API 进行身份验证的客户端 ID。

    TRUSTIFICATION_SUPPORTED_CYCLONEDX_VERSION

    指定系统支持并生成的 CycloneDX SBOM 版本。

    可选 :如果您的 CI 供应商运行程序没有在与 RHADS - SSC 实例相同的集群中运行,则设置 Rekor 和 TUF 变量。

    Expand
    表 1.5. Rekor 和 TUF 变量
    变量描述

    REKOR_HOST

    您的 Rekor 服务器的 URL。

    TUF_MIRROR

    您的 TUF 服务的 URL。

  1. 选择 Save
  2. 授权管道使用此变量组:

    1. 选择 Pipeline 权限 标签页。
    2. 选择 Add pipeline
    3. 选择需要访问此变量组的管道,然后选择 Authorize selected pipelines
  3. 可选: 如果您将不同的名称用于 rhtap 以外的变量组,您必须更新 azure-pipelines.yml 文件中的变量组名称。

    variables:
        - group: <my-variable-group>
    Copy to Clipboard Toggle word wrap

验证

  1. 重新运行最新的管道。如果正确应用了 secret,管道将成功完成。运行后,验证 RHACS 或 SBOM 等任务是否显示预期的详情。





更新于 2025-09-08

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2026 Red Hat
返回顶部