在 GitLab 和 Bitbucket 中配置 Tekton Webhook
Red Hat Trusted Application Pipeline 1.5
当选择 Tekton 作为 CI 供应商时,了解如何在源代码存储库中添加 webhook。
摘要
本文档提供了有关在选择 Tekton 作为 CI 供应商时将 webhook 添加到源代码存储库中的说明。
前言
在创建应用程序时将 Tekton 选择为 CI 供应商时,您必须将 webhook 添加到源代码存储库中,如 GitLab 或 Bitbucket。当代码被更新时,这些 Webhook 会在 RHDH 中自动触发管道运行。此集成可确保您的管道始终与您的代码更改同步。
第 1 章 配置 GitLab Webhook 以启用自动管道触发器
在 GitLab 中设置 webhook,以在代码更新时自动触发管道运行。
先决条件
- 您必须在 RHTAP 安装过程中集成 GitLab。
您有一个源存储库。查找应用程序的源代码:
- 在 RHDH 平台上,导航到 Catalog,选择相应的应用程序,其中 GitLab 配置为存储库主机。
- 前往 Overview 选项卡,再选择 View Source 以打开托管应用程序的源代码的存储库。
-
您有一个 Webhook URL 和 Secret Token。您可以在
private.env
文件中找到这些凭证。
流程
导航到 GitLab 源存储库。
- 在 Red Hat Developer Hub 平台上,导航到 Catalog,选择将 GitLab 配置为存储库主机的应用程序。
- 前往 Overview 选项卡,再选择 View Source 以打开源代码的存储库。
- 进入 Settings > Webhooks。
- 在 URL 字段中输入 Webhook URL。
- 在 Secret Token 字段中,输入 secret 令牌。
在 Trigger 部分中:
- 选择 Push events。
- 选择 Merge request events。
- 单击 Add Webhook。
验证
- 将任何更改提交到 GitLab 中的源存储库。
- 导航到 RHDH 中的 CI 选项卡。
- 验证您的代码推送是否触发了管道运行。
第 2 章 配置 Bitbucket Webhook 以启用自动管道触发器
在 Bitbucket 中设置 webhook,以在代码更新时自动触发管道运行。
先决条件
- 您必须在 RHTAP 安装过程中集成 Bitbucket。
您有一个源存储库。查找应用程序的源代码:
- 在 RHDH 平台上,导航到 Catalog,选择适当的应用程序,其中 Bitbucket 配置为存储库主机。
- 前往 Overview 选项卡,再选择 View Source 以打开托管应用程序的源代码的存储库。
-
您必须具有 Webhook URL。您可以在
private.env
文件中找到这些凭证。
流程
- 导航到您的 Bitbucket 源存储库。
- 进入 Repository settings > Webhooks,然后选择 Add webhook。
- 在 Title 字段中,输入适当的标题。
- 在 URL 字段中输入 Webhook URL。
.在 Trigger 部分中:
- 选择 Push。
- 选择 Merged。
- 选择 Save。
验证
- 在 Bitbucket 存储库中进行代码更改并推送更改。
- 导航到 RHDH 中的 CI 选项卡。
- 验证在代码更新后触发管道运行。
更新于 2025-05-01
法律通告
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.