Plan not starting with a tag trigger
Asked by Christoph Leiter:

Hello,

we're running a Bamboo 9.2.4 and Bitbucket 8.13.0 installation with test licenses. Bitbucket and Bamboo are linked to each other.  
We are facing an issue with triggering the plan with tag creation in Bitbucket.  

We created a simple Bamboo project with a small build plan:  
1. Stage just checks out a file from a Bitbucket Repo A, edit the same and checking it in again  
2. Stage does the same, but with a file in Repo B  
Both the repos are linked repos.  

The plan shall be triggered by a tag creation in the repositories.  
A build is triggered within a few seconds for repo B whenever the tag was created in a local repo and pushed to the origin. It does not work after creating the tag in Bitbucket GUI.

For repo A triggering the plan does never work: Neither creating the tag in a local repo and pushing it, nor creating it in Bitbucket triggers the plan.  

I saw <https://confluence.atlassian.com/bamkb/bamboo-repository-polling-trigger-does-not-start-the-build-immediately-1255451860.html>, added the Java classes, but the mentioned log messages did not appear.  

Why does a tag in repo B triggers the plan, whereas a tag in repo A does not?  
Why does a tag creation in repo B via Bitbucket GUI doesn't trigger the plan?

Regards,

Chris


Answers:
author: alok m
body: The issue you're encountering with Bamboo not triggering builds on tag creation in Bitbucket can be influenced by several factors. Given the discrepancy in behavior between Repo A and Repo B, along with the method of tag creation (local vs. Bitbucket GUI), here are some potential reasons and troubleshooting steps:

1. **Repository Configuration in Bamboo**

* **Repository Settings**: Ensure that both repositories are correctly configured in Bamboo, with the correct URLs and credentials. Any discrepancy in the repository setup could lead to inconsistent behavior.
* **Polling Interval**: Check the polling interval for each repository in Bamboo. If it's set too high, there might be a delay in detecting changes. However, since Repo B triggers immediately, this might not be the primary issue but is worth verifying.

2. **Bamboo's Plan Trigger Configuration**

* **Trigger Type**: Verify that the build plan is configured to trigger on changes detected in the repository, including tag creation. In Bamboo, you might need to explicitly specify that you want the plan to trigger on tag events.
* **Permissions**: Confirm that Bamboo has sufficient permissions to access and receive webhook events from Bitbucket for both repositories. Insufficient permissions could prevent Bamboo from detecting events in Repo A.

3. **Bitbucket Configuration**

* **Webhooks**: Check Bitbucket's webhook configurations for both repositories. Ensure that webhooks are correctly configured to send events to Bamboo upon tag creation. The behavior suggests that webhooks might be correctly set up for Repo B but not for Repo A or not configured to trigger on tag creation through the GUI.
* **Tags Creation Method**: Creating tags through the Bitbucket GUI might not emit the same webhook events as creating them locally and pushing them. Verify if Bitbucket is configured to send webhook events for tags created via the GUI.

4. **Network and Access Issues**

* **Network Accessibility**: Ensure that there are no network issues preventing Bamboo from receiving webhook events from Bitbucket. Firewalls, VPNs, or network policies could potentially block or interfere with these requests.
* **Service Hooks Plugin**: For older versions of Bitbucket, the functionality for triggering builds in Bamboo might rely on the Service Hooks plugin. Verify that it's installed and configured correctly, though this is less likely the issue since you're using a newer version of Bitbucket.

5. **Log Files and Debugging**

* **Bamboo Logs**: Since you mentioned adding Java classes from an Atlassian knowledge base article and not seeing expected log messages, ensure that Bamboo's logging level is set to debug for the relevant classes. This can help uncover hidden issues.
* **Bitbucket Logs**: Similarly, check Bitbucket's logs for any errors or messages related to webhook firing or failures to send events to Bamboo.

**Next Steps**

Given the inconsistencies and the troubleshooting steps above, I recommend:

1. **Re-Examine Webhook Configurations**: Especially for Repo A and for tag creation via the Bitbucket GUI.
2. **Permissions Review**: Ensure both Bitbucket and Bamboo have appropriate permissions set for both repositories and the integration points.

This issue might involve nuanced configuration details specific to your setup, so these steps are intended to guide your investigation.

comments: author: Christoph Leiter
body: Wow! Thanks a lot for the detailed answer.  
In our test installation we managed to get along with moving repo A's items into repo B and triggering by creating the tag locally.

The test installation was a kind of sandbox for project which is now scheduled for 2025.

Until then we don't have any further capacity to investigate using your answer. But I'll keep that in mind - for sure! As this is guides me to find the root cause, I accept the answer. In case find the reason, I'll update here.