

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# AFT 中源代码版本控制的替代方案
<a name="aft-alternative-vcs"></a>

AFT AWS CodeCommit 用于源代码版本控制系统 (VCS)，它允许其他[CodeConnections](https://docs.aws.amazon.com//dtconsole/latest/userguide/supported-versions-connections.html)满足您的业务需求或现有架构的系统。

如果您是首次部署 AFT，并且没有现有的 CodeCommit存储库，则必须指定外部 VCS 提供商，这是 AFT 部署先决条件的一部分。

**AFT 支持以下源代码控制替代方案：**
+ GitHub
+ GitHub 企业服务器
+ BitBucket
+ GitLab
+ GitLab 自我管理

**注意**  
如果您指定 AWS CodeCommit 为 VCS，则无需执行任何其他步骤。AFT 会使用默认名称在您的环境中创建必要的 `git` 存储库。但是，您可以根据需要覆盖默认存储库名称，以符合您的组织标准。 CodeCommit

## 使用 AFT 设置替代源代码版本控制系统（自定义 VCS）
<a name="aft-alternate-vcs-steps"></a>

要为 AFT 部署设置替代源代码版本控制系统，请按照以下步骤操作。

**步骤 1：在支持的第三方版本控制系统（VCS）中创建 `git` 存储库。**

如果您不使用 AWS CodeCommit，则必须在 AFT 支持的第三方 VCS 提供商环境中为以下项目创建`git`存储库。
+ **AFT 账户申请。**[提供示例代码](https://github.com/aws-ia/terraform-aws-control_tower_account_factory/tree/main/sources/aft-customizations-repos/aft-account-request)。有关 AFT 账户请求的更多信息，请参阅 [使用 AFT 预置新账户](aft-provision-account.md)。
+ **AFT 账户预置自定义。**[提供示例代码](https://github.com/aws-ia/terraform-aws-control_tower_account_factory/tree/main/sources/aft-customizations-repos/aft-account-provisioning-customizations)。有关 AFT 账户预置自定义的更多信息，请参阅 [创建 AFT 账户预置自定义状态机](aft-provisioning-framework.md#aft-create-customizations)。
+ **AFT 全局自定义。**[提供示例代码](https://github.com/aws-ia/terraform-aws-control_tower_account_factory/tree/main/sources/aft-customizations-repos/aft-global-customizations)。有关 AFT 全局自定义的更多信息，请参阅 [账户自定义](aft-account-customization-options.md)。
+ **AFT 账户自定义。**[提供示例代码](https://github.com/aws-ia/terraform-aws-control_tower_account_factory/tree/main/sources/aft-customizations-repos/aft-account-customizations)。有关 AFT 账户自定义的更多信息，请参阅 [账户自定义](aft-account-customization-options.md)。

**步骤 2：指定 AFT 部署所需的 VCS 配置参数**

作为 AFT 部署的一部分，需要使用以下输入参数来配置 VCS 提供商。
+ **vcs\_provid** er：如果您未使用 AWS CodeCommit，请根据您的用例将 VCS 提供程序指定为`"bitbucket"``"github"``"githubenterprise"``"gitlab"`、、或。
+ **github\_enterprise\_url：仅适用于 GitHub 企业客户，请指定 URL**。 GitHub 
+ **账户\_request\_repo\_name**：对于 AWS CodeCommit 用户，此值设置为。`aft-account-request`在 AFT 支持的第三方 VCS 提供商环境中，使用您的实际存储库名称更新此输入值。对于 Github BitBucket GitLab、 GitHub Enterprise GitLab 和 Self-Managed，存储库名称的格式`[Org]/[Repo]`必须为。
+ **account\_customizations\_repo\_name**：对于 AWS CodeCommit 用户，此值设置为。`aft-account-customizations`在 AFT 支持的第三方 VCS 提供商环境中，使用您的存储库名称更新此输入值。对于 Github BitBucket GitLab、 GitHub Enterprise GitLab 和 Self-Managed，存储库名称的格式`[Org]/[Repo]`必须为。
+ **account\_provisioning\_customizations\_repo\_name**：对于 AWS CodeCommit 用户，此值设置为 `aft-account-provisioning-customizations`。在 AFT 支持的第三方 VCS 提供商环境中，使用您的存储库名称更新此输入值。对于 Github BitBucket GitLab、 GitHub Enterprise GitLab 和 Self-Managed，存储库名称的格式`[Org]/[Repo]`必须为。
+ **global\_customizations\_repo\_name**：对于 AWS CodeCommit 用户，此值设置为。`aft-global-customizations`在 AFT 支持的第三方 VCS 提供商环境中，使用您的存储库名称更新此输入值。对于 Github BitBucket GitLab、 GitHub Enterprise GitLab 和 Self-Managed，存储库名称的格式`[Org]/[Repo]`必须为。
+ **account\_request\_repo\_branch**：默认情况下，该分支为 `main`，但该值可以被覆盖。

默认情况下，AFT 来自每个 `git` 存储库的 `main` 分支。您可以使用其他输入参数覆盖该分支名称值。有关输入参数的更多信息，请参阅 [AFT Terraform module](https://github.com/aws-ia/terraform-aws-control_tower_account_factory/blob/main/README.md#inputs) 中的自述文件。

**对于现有 AWS CodeCommit 客户**  
 如果您使用新名称为 AFT 创建 CodeCommit 存储库，则可以通过更新这些输入参数的值来更新存储库名称。

**步骤 3：完成第三方 VCS 提供商的 AWS CodeCommit 连接**

部署运行时，AFT 要么创建所需的 AWS CodeCommit 存储库，要么为您选择的第三方 VCS 提供商创建 AWS CodeCommit 连接。如果是后者，则必须手动登录 AFT 管理账户的控制台才能完成待处理的 CodeCommit 连接。有关完成 CodeCommit 连接的更多说明，请参阅[AWS CodeCommit 文档](https://docs.aws.amazon.com//dtconsole/latest/userguide/connections-update.html)。