4

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.

1 Answer 1

3

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")

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

Comments

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.