使用 CloudFormation 配置 GitHub 支持的 CodePipeline

Provisioning GitHub-backed CodePipeline using CloudFormation

我正在尝试使用 CloudFormation 创建我的 CodePipeline。我遇到的问题是,一旦它被创建并尝试 运行,它立即给我错误:

Invalid action configuration The GitHub repository "MyOrg/MyRepo" or branch "MyBranch" does not exist.

事实上他们都这样做。我可以单击编辑,select 我的源代码管理,连接到 GitHub,然后 select 确切的存储库和分支,它工作正常。但是当直接在管道的 CloudFormation 配置之后启动管道时,它总是给我这个错误。

我使用 CloudFormation 使用新配置的管道 aws codepipeline get-pipeline 导出了管道配置 JSON,然后在控制台中使用 [=19= 更新配置后立即再次执行此操作] 两者完全相同。

确保 Configuration property for your CodePipeline's GitHub Source Action contains all four required properties as listed in the documentation:

  • Owner
  • Repo
  • Branch
  • OAuthToken

仔细检查您提供的值是否正确,尤其是 OAuthToken,它近似于基于 AWS 控制台的 CodePipeline 设置中的 "Connect To GitHub" 步骤。

要从 GitHub 获取有效的 OAuthToken 以在此处输入,您需要 create a New personal access token with repo and admin:repo_hook scopes enabled, as described in the documentation troubleshooting 页面。