9

AWS CodePipeline now supports GitHub WebHook, but by default
every time code is pushed(changed) on the master branch, CodePipeline is triggered.

However, I only want it to run when I actually publish a release.
So, I manually configured the auto-generated GitHub WebHook as follows:
(Uncheck Pushes, check Releases)

webhook

but after the configuration, CodePipeline is not kicked any more.
(When I check Pushes again, it starts watching every pushes again)

Does it only watch Pushes action?

If it does, is there any other way to kick CodePipeline by GitHub release actions?

1 Answer 1

13

CodePipeline's webhooks were designed to handle push events, but I think there's no reason why you shouldn't be able to configure the CodePipeline webhook to trigger on release events. No information from the webhook invocation is actually used as part of the source action, so you could trigger it from anything.

The reason it's not working is probably because of how your webhook filters are configured.

Take a look at the ListWebhooks API to see how your webhook is configured.

This page describes how the filters and authentication configuration is used to match github events to decide whether to trigger a pipeline execution or not.

Sign up to request clarification or add additional context in comments.

7 Comments

Thank you so much for your answer!!! Like you said, it was the filter that prevented my release webhook. ({"jsonPath": "$.ref", "matchEquals": "refs/heads/{Branch}"}) only exists in push webhook body. After I changed it to fit release webhook(like this -> {"jsonPath": "$.action", "matchEquals": "published"}), it worked like a charm!!
No problem! I enjoy developing features for CodePipeline and seeing creative ways our customers use them 🙂
@sora, could you please clarify, how to edit that JSON?
Take a look at the PutWebhook API (docs.aws.amazon.com/codepipeline/latest/APIReference/…). You might also be interested in ListWebhooks (docs.aws.amazon.com/codepipeline/latest/APIReference/…)
Neither create or publish github webhooks actually contain the commit that the tag points to, so how can this work with CodePipeline when you want it to act on that commit? The push event does, but you'd have to do a partial match on $.ref == "refs/tags/my-tag", then extract the tag name from that, which CodePipeline webhooks don't appear to support (only matchEquals with {Branch}). So how would that work?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.