Как зарегистрировать созданный веб-крючок в AWS CLI? - PullRequest
0 голосов
/ 08 июня 2018

Я успешно создал веб-крючок с именем webhook1.Но я не могу его зарегистрировать.

https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-webhooks-create.html

webhook.json

{  
    "webhook":{  
        "name":"webhook1",
        "targetPipeline":"pipeline-1",
        "targetAction":"src",
        "filters":[  
            {  
                "jsonPath":"$.ref",
                "matchEquals":"refs/heads/{Branch}"
            }
        ],
        "authentication":"UNAUTHENTICATED",
        "authenticationConfiguration":{}
    }
}

$ aws codepipeline put-webhook --cli-input-json file://webhook.json --region "us-east-2"

{
    "webhook": {
        "arn": "arn:aws:codepipeline:us-east-2:12:webhook:webhook1",
        "url": "https://us-east-2.webhooks.aws/trigger?t=ey",
        "definition": {
            "name": "webhook1",
            "filters": [
                {
                    "matchEquals": "refs/heads/{Branch}",
                    "jsonPath": "$.ref"
                }
            ],
            "targetAction": "src",
            "authentication": "UNAUTHENTICATED",
            "targetPipeline": "pipeline-1",
            "authenticationConfiguration": {}
        }
    }
}

$ aws codepipeline register-webhook-with-сторонний --webhook-name webhook1

An error occurred (WebhookNotFoundException) when calling the RegisterWebhookWithThirdParty operation:

$ aws codepipeline register-webhook-with-сторонний --webhook-name "webhook1"

An error occurred (WebhookNotFoundException) when calling the RegisterWebhookWithThirdParty operation:

$ aws codepipeline list-webhooks --region us-east-2

{
    "webhooks": [
        {
            "definition": {
                "filters": [
                    {
                        "jsonPath": "$.ref",
                        "matchEquals": "refs/heads/{Branch}"
                    }
                ],
                "name": "webhook1",
                "targetPipeline": "pipeline-1",
                "authenticationConfiguration": {},
                "authentication": "UNAUTHENTICATED",
                "targetAction": "src"
            },
            "url": "https://us-east-2.webhooks.aws/trigger?t=ey",
            "arn": "arn:aws:codepipeline:us-east-2:12:webhook:webhook1"
        }
    ]
}

С GITHUB_HMAC та же проблема.

$ aws --version

aws-cli/1.15.33 Python/3.5.2 Linux/4.10.0-38-generic botocore/1.10.33

1 Ответ

0 голосов
/ 13 августа 2018

Я заметил, что в ваших put-webhook и list-webhooks вы включили регион в команду: --region "us-east-2".

Однако при вызове register-webhook-with-третьей стороны вы 'не передавая регион, так что, вероятно, по умолчанию используется другой регион.

Если вы включите регион в команду register-webhook-with-стороннего, это, вероятно, будет работать.

...