我知道我们可以从AWS控制台启用CodeBuild钩子,但是我们能在yml中启用来自cloudformation的webhook吗?
codebuild.yml
Resources:
CodeBuildProject:
Type: AWS::CodeBuild::Project
DependsOn:
- CodeBuildSourceCredential
.
.
Properties:
Source:
Type: GITHUB
Location: https://github.com/path/project.git
BuildSpec: buildspec.yml
.
.
Triggers:
Webhook: true
FilterGroups:
- - Type: EVENT
Pattern: PUSH
CodeBuildSourceCredential:
Type: 'AWS::CodeBuild::SourceCredential'
Properties:
Token: '<TokenString>'
ServerType: GITHUB
AuthType: PERSONAL_ACCESS_TOKEN
我试图创建这个堆栈,但它似乎不起作用,堆栈因此错误而失败。
Failed to call CreateWebhook, reason: Unable to create webhook at this time. Please try again later. (Service: AWSCodeBuild; Status Code: 400; Error Code: OAuthProviderException; Request ID: xxxxxx-5ddf-xxxx-88a1-xxxxxx; Proxy: null)
发布于 2020-07-30 18:21:36
下面是一个示例CloudFormation模板片段:
Resources:
Project:
Type: AWS::CodeBuild::Project
Properties:
Name: CFN-Project
# Other properties ............................................
Source:
Location: https://github.com/shariqmus/private-repo.git
Type: GITHUB
Auth:
Type: OAUTH
Resource: !Ref GitHubToken # Personal Access Token
SourceVersion: master # Branch name
Triggers:
Webhook: true
FilterGroups:
- - Type: EVENT
Pattern: PUSH
ExcludeMatchedPattern: false
- Type: HEAD_REF
Pattern: refs/heads/master # 'master' is Branch name
ExcludeMatchedPattern: false
发布于 2020-07-29 00:17:43
根据错误消息,您似乎还没有设置AWS::CodeBuild::SourceCredential,您的问题也没有提供有关使用该资源的任何细节。
AWS::CodeBuild::SourceCredential
是GitHub、GitHub企业或Bitbucket所必需的:
有关用于、GitHub企业或Bitbucket存储库的GitHub凭据的信息。我们强烈建议您使用AWS秘密管理器来存储凭据。
创建AWS::CodeBuild::SourceCredential
后,必须使CodeBuildProject
依赖于凭据。例如:
MySourceCreds:
Type: 'AWS::CodeBuild::SourceCredential'
# other parameters
CodeBuildProject:
Type: AWS::CodeBuild::Project
DependsOn: MySourceCreds
# other parameters
https://stackoverflow.com/questions/63143638
复制相似问题