The following scenario assumes that a software design document must be created before a new code change can be pushed The design document must exists and it must have the correct status (e.g. reviewed)

Common Settings

The common settings of a rule are needed to provide developers information about the configured rule in error situations.

OptionValueDescription
TitleSoftware design document is neededIs needed to identify the rule in the error messages
Error messageNo valid software design document has been found for the give code change (issue: %key)Gives the user further information about the error situation
HintPlease create a software design document for the issue %key% and please ask your team lead to approve the design document.Gives the user the information about how they can solves the issue.


Page selection based on CQL

Based on the CQL you can identify the software design document you would like to check. In the folder Software Design Documents you will find 3 software design documents with different characteristics. This 3 pages are listed in the table below and you will also 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 page structure. 

PageIssue key (e.g. commit message)Identified by Query-ExampleDescription
New Example Feature - Just for DemonstrationDEM-1label = "%key%" and label = "software-design"Match the given page, because both labels match
DEM-2 - Software Design Document - Fix of bug 4711DEM-2title ~ "%key%" and title ~ "Software Design"Match the given page, because the page title contains both strings
DEM-3 - More Bitbucket hooksDEM-3title ~ "%key%" and label = "software-design"Match the given page, because the page title contains the issue key ant the label "software-design" is given


Skip CQL

Also it should not be allowed to push, if no page has been found by a CQL. For that please ensure, that the option "If no page matches the CQL, the rule will be skipped. The rule will be validated only, if a page has been found." is unset.

Page properties configuration

Now let's evaluate the page properties of the above detected pages. The requested page properties in the hook are for all three pages the same, but the real page properties are different (please check the related pages and you will see).

PageMerge will beIssue key (e.g. commit message)Properties-ExampleDescription
New Example Feature - Just for Demonstration

REJECT

DEM-1
issue~%key%
design+
status=created
reviewed by=software team lead
review-status=approved
JAVA


The push will be rejected, because:

  • the status is in "progress" and not "created"
  • Nobody has done the review
  • the review-status is not set
DEM-2 - Software Design Document - Fix of bug 4711

ACCEPT

DEM-2

The push is allowed, because:

  • the issue key is correct in the page
  • the property design is not empty
  • the status of the page is "created"
  • the approval has been done by the user "software team lead"
  • the review status is "approved"
DEM-3 - More Bitbucket hooks

REJECT

DEM-3

The push will be rejected, because the review-status is "needs rework"


Page properties strategy

To have a valid software design document all requested properties must match. So it is needed to set the option "All key pairs must match"


Example configuration