AWS Codepipeline Github Webhook未通过cloudformation注册

pro*_*ard 3 amazon-web-services aws-codepipeline github-webhook

我正在尝试通过使用cloudformation设置AWS代码管道并使用github作为源。github存储库由一个组织拥有,我对此具有管理员访问权限。

我能够创建webhook并通过代码管道UI成功创建了整个服务。但是,当我尝试通过Cloudformation Document做同样的事情时,它返回错误

Webhook could not be registered with GitHub. Error cause: Not found [StatusCode: 404, Body: {"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/hooks/#create-a-hook"}]

我两次都使用了相同的凭据(cloudformation中的OAuth令牌和codepipeline UI中的实际登录弹出窗口),但是当我通过Cloudformation进行操作时,它失败了。

我怀疑我的cloudformation文档是问题所在。但是,当我创建自己的存储库时,cloudformation成功创建了webhook并创建了完整的代码管道服务。

以下是我为了解错误原因所做的测试摘要。

  1. Codepipeline用户界面。组织Github回购。它要求登录github。使用我的管理员凭据登录=>成功创建了Webhook和服务。
  2. Cloudformation。组织Github回购。已启用repo并admin:repo_hook启用了来自管理员凭据的OAuth令牌。=>给出上面的错误
  3. Cloudformation。个人Github回购。已使用来自管理员凭据的Oauth令牌,repo并已admin:repo_hook启用=>成功创建了Webhook和服务

以下是我创建Webhook的cloudformation文档的一部分。

  AppPipelineWebhook:
    Type: 'AWS::CodePipeline::Webhook'
    Properties:
      Authentication: GITHUB_HMAC
      AuthenticationConfiguration:
        SecretToken: !Ref GitHubSecret
      Filters:
        - JsonPath: $.ref
          MatchEquals: 'refs/heads/{Branch}'
      TargetPipeline: !Ref cfSSMAutomationDev
      TargetAction: SourceAction
      Name: AppPipelineWebhook
      TargetPipelineVersion: !GetAtt cfSSMAutomationDev.Version
      RegisterWithThirdParty: true
Run Code Online (Sandbox Code Playgroud)

所以我不确定是什么问题。我怀疑OAuth令牌需要更多特权。有人对此有类似的经验吗?任何建议深表感谢

小智 8

通过查看我使用的代码管道UI配置存储库,我什至面临着同样的问题

{
  "Configuration": {
    "Owner": "myUserName",
    "Repo": "orgname/repository-name",
  }
}
Run Code Online (Sandbox Code Playgroud)

因此cloudformation正在检查不存在的存储库myUserName / orgname / repository-name。

按照以下解决方案解决了问题:

{
  "Configuration": {
    "Owner": "orgname",
    "Repo": "repository-name",
  }
}
Run Code Online (Sandbox Code Playgroud)

私人仓库-> ownerName:YourUserName
组织仓库 -> ownerName:OrganisationName