Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between HEAD_REF vs BASE_REF in AWS Codebuild git webhook?

I want to set a build webhook when a PullRequest is opened from dev branch to master branch. AWS Codebuild has a webhook based on HEAD_REF and BASE_REF which lacks detailed documentation.

What do they stand for?

like image 575
qpzm Avatar asked Mar 29 '19 06:03

qpzm


1 Answers

Thank you for using AWS CodeBuild. For pull request scenarios, HEAD_REF filters on the git reference name of the source branch in the webhook payload that triggers the webhook build, you can find the branch name in "pull_request" -> "head" -> "ref" field in the payload. BASE_REF filters on the git reference name of the destination branch in the payload, you can find the name in "pull_request" -> "base" -> "ref" field.

So for your use case (triggering build when a pr is opened from dev to master branch), you can put the reference name for master branch (e.g. "^refs/heads/master$") in BASE_REF, and reference name for dev branch (e.g. "^refs/heads/dev$") in HEAD_REF. Note the value you put for those two fitlers are regex, so you don't have to use the full name :)

like image 169
Linghao Zhu Avatar answered Oct 17 '22 14:10

Linghao Zhu