After the configuration possibilities have been described in general, these possibilities are additionally described with examples. I would like to point out that the following CQL queries are only examples and must of course be adapted to your use case or your Confluence page structure.
Merge-Hook - Test reports are required
The following scenario assumes that a test report must be created before a new code change can be integrated. A merge hook is configured accordingly, which checks whether a test report exists for the respective issue and is in the correct status.
Page selection based on CQL
In the Test-Reports folder you will find the following 3 Test-Report sample pages. Also you will find examples of how these can be identified by the CQL. However, it is clear that other CQLs may be necessary in your company to identify the corresponding pages. It depends on your structure.
|Page||Issue key (e.g. commit message)||Identified by Query-Example||Description|
|New Example Feature - Just for Test Demonstration||DEM-1||label = "%key%" and label = "test-report"||Match the given page, because both labels match|
|DEM-2 Test Report - Fix of bug 4711||DEM-2||title ~ "%key%" and title ~ "Test Report"||Match the given page, because the page title contains both strings|
|DEM-3 More Bitbucket hooks||DEM-3||title ~ "%key%" and label = "test-report"||Match the given page, because the page title contains the issue key ant the label "test-report" is given|
Page properties configuration
Now let's evaluate the page properties of the above detected pages. The page properties are for all three pages the same, but the page properties are different (please check the related pages and you will see).
|Page||Merge will be||Issue key (e.g. commit message)||Properties-Example||Description|
|New Example Feature - Just for Test Demonstration|
The merge is allowed, because:
|DEM-2 Test Report - Fix of bug 4711|
The merge will be rejected, because:
|DEM-3 More Bitbucket hooks|
The merge will be rejected, because the approval-status is "needs rework"