I am trying to create a AWS codepipeline which will be trigger when certain files are uploaded on specific folders on the MonoRepo. for eg: I have a monorepo with my frontend in Folder_A (reponame/apps/folder_A)and Backend on Folder_B(reponame/apps/folder_B). If I make changes to a file inside Folder_A and push, AWS codepipeline (Codepipeline for Folder_A) should be triggered.
This is how I planned to implement the solution. Whenever there is a PR, the webhook payload is sent to AWS API Gateway which then triggers lambda and pushes payload to lambda. The code in lambda will identify the path of the file changed and triggers respective AWS code pipeline. But I am unable to get the information on which folder was updates on the webhook payload i.e path of the file changed on bitbucket. I am looking for a way to get the filepath on webhook payload.
Hi @Madan Shah
Welcome to the community.
I'm afraid Bitbucket Cloud Webhooks does not include file paths as payloads while triggering an event (e.g. push, pull request updates).
You can check this link for more information about Bitbucket Cloud Webhooks' available payloads. - https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/ (See "Trigger webhooks" section)
As a workaround, I believe your use-case is doable by using Bitbucket Pipelines.
Bitbucket Pipelines is a CI/CD tool within your repository where you can run scripts/commands to build, test, and deploy your code.
Based on your use case, assuming your mono-repositories are located in a single repository on Bitbucket Cloud:
You can set up a Pipelines YAML configuration that triggers by default and by using Conditional Steps.
Using Conditional steps, you can execute a step only if one of the modified files matches the expression in includePaths.
Here's a sample YAML file where you can use the default Pipelines trigger and Conditional steps:
pipelines: default: - step: name: "Monorepo 1" condition: changesets: includePaths: - "apps/folder_A/**" script: - echo "Execute commands here (e.g. running a CodePipeline script/command)" - step: name: "Monorepo 2" condition: changesets: includePaths: - "apps/folder_B/**" script: - echo "Execute commands here (e.g. running a CodePipeline script/command)"
The above YAML configuration will trigger a Pipelines build each time you push a commit in the branch where you pushed the YAML configuration (initially, it will be your main branch).
However, a step will be paused if the file changes made or pushed are not within the specified path (or includePaths).
Here are some links that will help you get started with Bitbucket Pipelines:
You can give it a try and let me know how it goes.
Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events