Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Note

Hook settings defined on lower levels override higher-level ones; otherwise, settings are inherited.

In this section

Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

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

  1. Go to your project and from the side menu click Project settings ⚙️ > Hooks. Yet Another Commit Checker is under the Pre Receive heading.

  2. From the Actions column, click the ellipsis (…) and select Enable from the the Status dropdown.

    See Configuration for settings information.

Enable per-repository settings

  1. Go to your repository and from the side menu click > Repository settings ⚙️ > Hooks. Yet Another Commit Checker is under the Pre Receive heading.

  2. From the Actions column, click the ellipsis (…) and select Enable from the the Status dropdown.

    See Configuration for settings information. 

  3. 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

  1. Open your project and from the side menu select Project settings ⚙️ > Merge checks. Yet Another Commit Checker is under the Merge checks heading.

  2. 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

  1. Open your repository and from the side menu select Repository settings ⚙️ > Merge checks. Yet Another Commit Checker is under the Merge checks heading.

  2. Click the ellipsis () and select Enable from the the Status dropdown.. 
    See Configuration for settings information.

  3. 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.

Tip

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 Checks

  • Repository - 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 (

Status
colourGreen
titleglobal setting push hook
Status
colourBlue
titleglobal setting merge check
Status
colourYellow
titleProject Hooks
Status
colourPurple
titleproject merge checks
Status
titlerepository hook
or
Status
colourRed
titlerepository merge check
).

YACC config updates 2.mp4

Configuration

General Configuration

Feature

Feature Locations

Description

Overriding global configuration

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

Bitbucket administrator defines who can override hook settings defined on a global level:

  • Global configuration only: Use global configuration for all enabled Project and Repository level hooks and ignore existing settings.

  • Selected group admins: Only selected user groups can change Project and Repository hook settings. All previously configured hooks remain unchanged.

  • All project/repo admins (default): Global settings can be overridden by users with the necessary permissions.

Limiting configuration changes does not modify or remove existing hooks configuration so that you can switch this option with no risk to existing configurations.

This option can be changed for Pre-receive hooks and Merge checks independently.

Scan All Commits in Pull Request

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourYellow
    titleProject hooks

  • Status
    titlerepository hooks

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

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourYellow
    titleProject hooks

  • Status
    titlerepository hooks

When enabled, the pre-receive hook displays an error but does not reject the push action.

Skip checks on cross-repository pull requests

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourYellow
    titleProject hooks

  • Status
    titlerepository hooks

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.

Info

Enable this option if:

  • You are upgrading from 1.x and want to mimic the method YACC originally used when performing cross checks for repository request merges.

  • Multiple repositories are involved in your workflow and you want to control when the push hook is invoked. With this option enabled, the push hook is not invoked as part of the merging process.

  • A push hook is invoked any time a commit is introduced into a new repository. If your workflow includes forking a repository, then the push hook can be triggered both when sent to the forked repository and after merging the pull request. With this option enabled, the hook is only invoked before the pull request process has started.

  • The pull request target and source repositories are different, you're using Jira ticket validation as part of your YACC config which is set to allow a Jira ticket in a context in which the commit is not in a PR, but to block a Jira ticket when the commit is in the PR process (for example with automated Jira transitions). Use this option to avoid blocking valid commits during the merge.

Commits

Commit Requirements

Feature

Feature Locations

Description

Require Committer Matches Valid User

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When enabled, YACC checks that the committer email matches any valid Bitbucket Server user.

Require Matching Committer Email

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When enabled, the committer email must match the email of a valid Bitbucket Server user.

Require Matching Committer Name

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourYellow
    titleProject hooks

  • Status
    titlerepository hooks

When enabled, the committer name must match the name of the Bitbucket Server user.

Committer Email Regex

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When a regex is present, the committer email must match the regex.

Commit Message Regex

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When a regex is present, the commit message must match the regex. Leading and trailing whitespace are ignored.
Example
[A-Z0-9\-]+: .*

requires the commit message to be in the form of:
PROJ-123: added new feature xyz

  • Multi-line Commit Message Regex - Multi-line commit messages can be matched by including newlines into the regex (like (.|\n)*), or by enabling Pattern.DOTALL by starting your regex with (?s).

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.

Note

To set Jira Issue Requirements through YACC, you must also configure a Jira Application Link in Bitbucket Server.

Jira Issue Requirements

Feature

Feature Location

Description

Jira App Link

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

Jira application links are used to:

  • Check Jira issues, the building blocks of a Jira project and can be anything from bugs to stories

  • Validate issue keys, used as identifiers for specific work items in a Jira project

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:

  • All - All available Jira application links are used to validate issue keys. Once an issue key is found, validation stops and returns issue data from the first matching Jira instance

  • Primary - The Jira application link configured as Primary at the time of commit is used to validate issue keys

  • Select Links - Only the selected Jira application links are used to validate issue keys

To create a Jira application link, see Link Bitbucket with Jira.

Require Valid Jira Issue(s)

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When enabled, commit messages must contain valid Jira issue IDs. Jira issue IDs are defined as any item that matches the regex [A-Z][A-Z_0-9]+-[0-9]+.

This can result in false positives if commit messages contain strings that look like Jira issues. For example, UTF-8. Enable Ignore Unknown Jira Project Keys to tell YACC to ignore items that do not contain a valid Jira Project key.

Require Matching Jira Issue In Branch Name

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

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 master) is automatically excluded.
Example
Sample commit message PROJ-123 Clean up leftover interfaces from PROJ-3

  • Allowed branch names: bugfix/PROJ-123, PROJ-123-cleanup, PROJ-3-update

  • Blocked branch names: fixes, feature/PROJ-12

Enable the Require Valid Jira Issue(s) option first to use this feature.

Ignore Unknown Jira Project Keys

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When enabled, any issue-like items that do not contain a valid Jira project key (for example, UTF-8) in the commit messages are ignored.

Issue JQL Matcher

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When a JQL query is present, detected Jira issues must match this query.
Example
assignee is not empty and status="in progress" and project=PROJ requires Jira issues be assigned, in progress, and from project PROJ.

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

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourYellow
    titleProject hooks

  • Status
    titlerepository hooks

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.
Example
master|(?:(?:bugfix|hotfix|feature)/[A-Z]+-\d+-.+) branch names must follow the Bitbucket Server Branching Model naming convention.

Leading and trailing whitespace are ignored.

Exclusions

Exclude

Feature

Feature Locations

Description

Exclude Commits From Bitbucket UI

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

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

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

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

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When present, commits are excluded from all requirements if part of the commit message matches this regex.
Example
^Revert \"|#skipchecks

Leading and trailing whitespace are ignored.

Exclude Branch by Regex

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

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.
Example
experimental/.*

Leading and trailing whitespace are ignored.

Exclude Service User Commits

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

When enabled, commits from service users (i.e., using SSH Access Keys) are excluded from commit requirements.

Exclude User

Exclude Group

  • Status
    colourGreen
    titleglobal setting push hook
    Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

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

  • Header

  • Committer Email Error

  • Committer Email Regex Error

  • Committer Name Error

  • Commit Regex Error

  • Issue JQL Matcher Error

  • No Jira Issue Error

  • Footer

  • Status
    colourGreen
    titleglobal setting push hook

  • Status
    colourBlue
    titleglobal setting merge check

  • Status
    colourYellow
    titleProject hooks

  • Status
    colourPurple
    titleProject merge checks

  • Status
    titlerepository hooks

  • Status
    colourRed
    titlerepository merge check

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

Info

Advanced options are configurations applied globally to all hooks (pre receive/merge hooks) and cannot be overridden in project/repo settings.

  • Configuration

    • Overridden username - 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 Overridden username 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.