qiita.com
こちらに従ってCodePipelineがGitHubのRelease作成で発火するようになりました。感謝。
1点作業する中で疑問に思ったこととその調査結果メモを備忘録として残しておこうと思います。
疑問に思ったこと
「webhook設定の変更(AWS側)」で行っているaws codepipeline put-webhook
において、WebHookが複数存在する時は、全てのwebhook分更新用jsonは用意しないといけないのか?
結論
更新したいwebhook分だけでOK
結論に至るまで
aws codepipeline list-webhooks --region "ap-northeast-1"
を実行
{ "webhooks": [ { "definition": { "name": "hoge1--Source--hoge1", "targetPipeline": "pipeline1", "targetAction": "Source", "filters": [ { "jsonPath": "$.ref", "matchEquals": "refs/heads/{Branch}" } ], "authentication": "GITHUB_HMAC", "authenticationConfiguration": { "SecretToken": "TOKEN" } }, "url": "URL", "arn": "ARN", "tags": [] }, { "definition": { "name": "hoge2--Source--hoge2", "targetPipeline": "pipeline2", "targetAction": "Source", "filters": [ { "jsonPath": "$.ref", "matchEquals": "refs/heads/{Branch}" } ], "authentication": "GITHUB_HMAC", "authenticationConfiguration": { "SecretToken": "TOKEN" } }, "url": "URL", "arn": "ARN", "tags": [] } ] }
二つwebhookが存在している・・・
- 更新するwebhook用のjsonファイルを用意する
Qiitaの記事を元に
{ "webhook": { "name": "hoge1--Source--hoge1", "targetPipeline": "pipeline1", "targetAction": "Source", "filters": [{ "jsonPath": "$.action", "matchEquals": "published" }], "authentication": "GITHUB_HMAC", "authenticationConfiguration": { "SecretToken": "TOKEN" } } }
のようなjsonファイルを用意。
hoge2--Source--hoge2
の方のwebhookは特に変更したくないのでこのjsonファイルには何も記述せず。
webhook-putコマンドを実行
Qiitaの記事に記載されている通り、aws codepipeline put-webhook --cli-input-json file://webhook_config.json --region "ap-northeast-1"
を実行。再度
aws codepipeline list-webhooks --region "ap-northeast-1"
を実行
{ "webhooks": [ { "definition": { "name": "hoge1--Source--hoge1", "targetPipeline": "pipeline1", "targetAction": "Source", "filters": [ { "jsonPath": "$.action", "matchEquals": "published" } ], "authentication": "GITHUB_HMAC", "authenticationConfiguration": { "SecretToken": "TOKEN" } }, "url": "URL", "arn": "ARN", "tags": [] }, { "definition": { "name": "hoge2--Source--hoge2", "targetPipeline": "pipeline2", "targetAction": "Source", "filters": [ { "jsonPath": "$.ref", "matchEquals": "refs/heads/{Branch}" } ], "authentication": "GITHUB_HMAC", "authenticationConfiguration": { "SecretToken": "TOKEN" } }, "url": "URL", "arn": "ARN", "tags": [] } ] }
put-pipelineで指定したjsonでは記述していなかったhoge2--Source--hoge2
のwebhookには何も影響なし!
putって言うからjsonファイルの中身が正になって記載していなかったwebhookの情報が消えるのかも?どうしようか・・?と悩んでいましたが、そんな心配は不要でした!