【问题标题】:AWS CodePipeline github webhook not triggering on commitAWS CodePipeline github webhook 未在提交时触发
【发布时间】:2020-03-01 07:15:18
【问题描述】:

我设置了一个 AWS CodePipeline,它使用 github 作为源,CodeBuild 用于构建,并部署到 ElasticBeanstalk。

当一切都在控制台中设置好并且我是 github 帐户的管理员(我使用不同的帐户进行测试)时,我能够让它工作

我需要部署的实际代码属于我不是管理员的帐户,因此在this guide 之后,我收到了个人访问令牌并使用 CLI 更新了 CodePipeline。

一旦我使用 cli 更新了项目,提交代码时它不再被触发。

我不确定发生了什么变化,因为即使我使用控制台并将 webhook 直接设置为我正在测试的 github 帐户的管理员,它仍然无法正常工作。

这是我更新管道的 json:

{
    "pipeline": {
        "roleArn": "arn:aws:iam::xxxxxxx:role/service-role/AWSCodePipelineServiceRole-us-west-2-xxxxx-xxxx", 
        "stages": [
            {
                "name": "Source", 
                "actions": [
                    {
                        "inputArtifacts": [], 
                        "name": "Source", 
                        "actionTypeId": {
                            "category": "Source", 
                            "owner": "ThirdParty", 
                            "version": "1", 
                            "provider": "GitHub"
                        }, 
                        "outputArtifacts": [
                            {
                                "name": "SourceArtifact"
                            }
                        ], 
                        "configuration": {
                            "Owner": "xxx", 
                            "Repo": "xxx", 
                            "PollForSourceChanges": "false", 
                            "Branch": "stage"
                        }, 
                        "runOrder": 1
                    }
                ]
            }, 
            {
                "name": "Build", 
                "actions": [
                    {
                        "inputArtifacts": [
                            {
                                "name": "SourceArtifact"
                            }
                        ], 
                        "name": "Build", 
                        "actionTypeId": {
                            "category": "Build", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "CodeBuild"
                        }, 
                        "outputArtifacts": [
                            {
                                "name": "BuildArtifact"
                            }
                        ], 
                        "configuration": {
                            "ProjectName": "xxx-stage-codebuild"
                        }, 
                        "runOrder": 1
                    }
                ]
            }, 
            {
                "name": "Deploy", 
                "actions": [
                    {
                        "inputArtifacts": [
                            {
                                "name": "BuildArtifact"
                            }
                        ], 
                        "name": "Deploy", 
                        "actionTypeId": {
                            "category": "Deploy", 
                            "owner": "AWS", 
                            "version": "1", 
                            "provider": "ElasticBeanstalk"
                        }, 
                        "outputArtifacts": [], 
                        "configuration": {
                            "ApplicationName": "xxx", 
                            "EnvironmentName": "xxx-stage"
                        }, 
                        "runOrder": 1
                    }
                ]
            }
        ], 
        "artifactStore": {
            "type": "S3", 
            "location": "xxx-artifacts-stage"
        }, 
        "name": "xxx-stage", 
        "version": 15
    }
}

【问题讨论】:

    标签: github aws-cli aws-codepipeline git-webhooks


    【解决方案1】:

    要修复更新的 GitHub 源的 webhook,您需要执行以下步骤:

    1. 使用 [1] 中的步骤取消注册并删除与旧 GitHub 存储库关联的现有 webhook。

    2. 使用 [2] 中的步骤重新创建 webhook。

    参考:

    [1] 删除 GitHub 源的 Webhook - https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-webhooks-delete.html

    [2] 为 GitHub 源创建 Webhook - https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-webhooks-create.html

    如果您遇到任何挑战,请告诉我。

    【讨论】:

    • 我正在遵循创建指南,但在调用 register-webhook-with-third-party 时出现“未找到”错误。知道是什么原因造成的吗?
    猜你喜欢
    • 2019-03-02
    • 2018-11-16
    • 1970-01-01
    • 2020-08-08
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-07
    相关资源
    最近更新 更多