Configuration overview - Yet Another Commit Checker
Quick start
Download the plugin from Atlassian Marketplace.
Install YACC plugin into Bitbucket Server.
To set Jira Issue Requirements through YACC, you must also configure a Jira Application Link in Bitbucket Server.
Configure YACC globally, per project, or repository.
Modes of operation
YACC can be configured globally, by project, or by repository. There are two modes of operation which can be enabled independently:
Hook – YACC checks all commits when they are pushed or added to the repository.
Merge checks – Checks are only performed for pull requests. For an unsuccessful check, the pull request is blocked from being merged.
Settings inheritance
You can define YACC settings on three levels:
Global: These settings are applied for all projects and repositories by default (if not overridden).
Project: These settings work on the project level for all repositories where the YACC hook is configured to
Inherited
(default).Repository: When the YACC hook is explicitly set to
Enabled
for a repository, the settings only affect that specific repository level.
Hook settings defined on lower levels override higher-level ones; otherwise, settings are inherited.
In this section
Global settings
To configure global settings, click Administration at the top of the page, then click YACC Configuration under the ADD-ONS heading from the Bitbucket Administration page side menu.
See Configuration for settings information.
Pre-receive hook settings
Enable per-project settings
Go to your project and from the side menu click Project settings > Hooks. Yet Another Commit Checker is under the Pre Receive heading.
From the Actions column, click the ellipsis (…) and select Enable from the the Status dropdown.
See Configuration for settings information.
Enable per-repository settings
Go to your repository and from the side menu click > Repository settings > Hooks. Yet Another Commit Checker is under the Pre Receive heading.
From the Actions column, click the ellipsis (…) and select Enable from the the Status dropdown.
See Configuration for settings information.
The hook can also be configured via the Bitbucket REST API.
See Using repository hooks for additional information.
Merge check settings
Enable per-project settings
Open your project and from the side menu select Project settings > Merge checks. Yet Another Commit Checker is under the Merge checks heading.
From the Actions column, click the ellipsis (…) and select Enable from the the Status dropdown.
See Configuration for settings information.
Enable per-repository merge check settings
Open your repository and from the side menu select Repository settings > Merge checks. Yet Another Commit Checker is under the Merge checks heading.
Click the ellipsis (…) and select Enable from the the Status dropdown..
See Configuration for settings information.The merge check can also be configured via the Bitbucket REST API.
See Checks for merging pull requests for additional information.
Configuration settings
YACC settings are grouped into tabs, where you can configure the different aspects of the hook.
Where are the configuration settings?
Global - Go to Administration > YACC Configuration. Choose from Global Setting - Push Hook, Global Setting - Merge Check, and Advanced Options. Use the Push hook or Merge Check toggle to enable or disable.
Project: settings work on the project level for all repositories where the YACC hook is configured to
Inherited
(default)
Go to Project Settings > Hooks
Go to Project Settings > Merge ChecksRepository - settings applied at the repository level override global settings. Select the repository you want to change, then from the left panel click
Repository settings > Hooks
Repository settings > Merge Checks
From any location, click Learn More to open the Yet Another Commit Checker documentation.
All YACC Configuration pages contain different options, depending on where you are configuring the settings (global setting push hookglobal setting merge checkProject Hooksproject merge checks repository hookor repository merge check).
Configuration
General Configuration
Feature | Feature Locations | Description |
---|---|---|
Overriding global configuration |
| Bitbucket administrator defines who can override hook settings defined on a global level:
|
Scan All Commits in Pull Request |
| When enabled, the pre-receive hook scans all commits in a Pull Request on a merge attempt, even if they have been scanned before. |
Enable dry run mode |
| When enabled, the pre-receive hook displays an error but does not reject the push action. |
Skip checks on cross-repository pull requests |
| When enabled, YACC skips the checks for cross repository request merges. Normally a check is performed on one repository, and then on the other. With this feature enabled, the second check is removed. |
Commits
Commit Requirements
Feature | Feature Locations | Description |
---|---|---|
Require Committer Matches Valid User |
| When enabled, YACC checks that the committer email matches any valid Bitbucket Server user. |
Require Matching Committer Email |
| When enabled, the committer email must match the email of a valid Bitbucket Server user. |
Require Matching Committer Name |
| When enabled, the committer name must match the name of the Bitbucket Server user. |
Committer Email Regex |
| When a regex is present, the committer email must match the regex. |
Commit Message Regex |
| When a regex is present, the commit message must match the regex. Leading and trailing whitespace are ignored. requires the commit message to be in the form of:
See Regex is not working for debugging details. |
Jira Issues
The Jira Issues tab allows you to set how Bitbucket responds to Jira issues in commit messages.
Jira Issue Requirements
Feature | Feature Location | Description |
---|---|---|
Jira App Link |
| Jira application links are used to:
When you have multiple application links to your Jira instances, the YACC Jira App Link feature allows you to determine which application links it uses to validate issue keys. The App Link feature has three options:
|
Require Valid Jira Issue(s) |
| When enabled, commit messages must contain valid Jira issue IDs. Jira issue IDs are defined as any item that matches the regex
This can result in false positives if commit messages contain strings that look like Jira issues. For example, |
Require Matching Jira Issue In Branch Name |
| When enabled, issue keys in the commit message are checked against the branch name. The commit is rejected if the branch name does not contain an issue key. The default branch (typically
|
Ignore Unknown Jira Project Keys |
| When enabled, any issue-like items that do not contain a valid Jira project key (for example, |
Issue JQL Matcher |
| When a JQL query is present, detected Jira issues must match this query. |
Additional topics
See Jira Advanced Searching for documentation regarding writing and testing JQL queries.
See Jira authentication failed message article in the Troubleshooting section.
Branches
The Branches tab is used to set branch naming requirements.
Branch Requirements
Feature | Feature Locations | Description |
---|---|---|
Branch Name Regex |
| When present, only branches with names that match this regex can be created. This also affects branches created within the Bitbucket Server UI. This only affects new branches and branches created within the Bitbucket UI; existing branches that do not match this regex are allowed. |
Exclusions
Exclude
Feature | Feature Locations | Description |
---|---|---|
Exclude Personal Repositories |
| When enabled, commits and PRs to personal repositories are not included in checks by YACC. Excluding personal repos allows your organization to define additional rules on the global level without encountering exceptions for repos that are not required to adhere to those rules. |
Exclude Commits From Bitbucket UI |
| When enabled, YACC skips validation of changes made through the Bitbucket UI. This includes edits from the built-in web editor and the Apply suggestion feature. The latter does not display a rejection message and does not allow repeat attempts even after correcting the commit message (Bitbucket bug report), so it may be useful not to validate such changes. |
Exclude Merge Commits |
| When enabled, merge commits are excluded from commit requirements. This includes merge commits pushed through the command line and merges made via the Pull Request UI. |
Exclude Commit by Regex |
| When present, commits are excluded from all requirements if part of the commit message matches this regex. |
Exclude Branch by Regex |
| When present, commits on branches that match the specified regex are excluded from all checks. Branch regex exclusion is applied before the Branch Name Regex option; i.e., branch creation is never blocked when a branch matches the Exclude Branch pattern. |
Exclude Service User Commits |
| When enabled, commits from service users (i.e., using SSH Access Keys) are excluded from commit requirements. |
Exclude User Exclude Group |
| Select from the dropdown lists of Bitbucket User Names or Groups. Commits from these users or members of these groups are excluded from commit requirements. |
Error Messages
Error Message Customization
Feature | Feature Locations | Description |
---|---|---|
Error Messages
|
| The Error Messages tab allows you to customize various messages produced by the YACC hook. For each entry, you can add a customized error message that replaces the default error message. |
Example message
To add a customized error message to help ensure internal policies were being followed, a heading message could look like this:
Your commit message does not conform to organizational requirements. Contact your Bitbucket repository administrator for details
Add your message to the appropriate field; in this case, the Header field and click Enable.
When triggered, Bitbucket displays the custom error message:
Advanced Options
Configuration
Jira Authentication User - By default, YACC uses the user account associated with the committer to make a connection to Jira to validate issues, run JQL queries, etc. This can cause authentication issues when the user pushing the code does not have read access to the corresponding Jira project. Examples include commits from continuous integration or commits made through SSH access keys.
The specified username is used for all Jira queries if this parameter is configured. There must be a valid Bitbucket username associated with a Jira account.
The Jira Authentication User parameter can only be specified in the global settings. The setting is shared between the pre-receive hook and the merge check.
Jira Issues
Allow Lower Case Jira Issue Keys - When enabled, the Require Valid Jira Issue(s) configuration uses case insensitive matching to find Jira tickets.
Click Save Advanced Options after any changes.