Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify file_path while triggering AWS codebuil

I have created AWS codebuild pipeline. It triggers automatically whenever I push to the Master branch. Now, I want to trigger it only when something is changed in Dockerfile. Below is my project structure:

casestudy
|
|
|->Docker->Dockerfile
|-> Infrastructure -> infrastructure-files

Below is the screenshot of codebuild webhook filter: enter image description here

If I push something to Dockerfile, the build is not getting triggered.

Kindly note that if I remove the file_path filter the build triggers with every push on the master branch. My code is placed on GIthub.

like image 294
Geetika Avatar asked Oct 26 '25 01:10

Geetika


1 Answers

I believe you want file_path = docker/Dockerfile

or perhaps, to prevent things like otherdir/docker/Dockerfile from triggering it, file_path = ^docker/Dockerfile

If you go through the Github web interface and view the repository's webhooks (Settings->Webhooks) and click "Edit" next to the webhook created by CodeBuild and then scroll down to the bottom where it says "Recent Deliveries", by clicking the "..." next to one of those you can actually see the request sent to the webhook. You will see in there the list of files modified by the commit, and they will not have a leading slash (e.g. "docker/Dockerfile")

like image 159
Robert Antonucci Avatar answered Oct 29 '25 19:10

Robert Antonucci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!