Smart Mirrors allow you to use local mirror instances for git operations, which can significantly increase speed and performance for distributed teams working with large repositories.

Webhook to Jenkins can be configured to use this mirror as it requires URL clones for each build.

Currently, Smart Mirrors only works with the Git Plugin.

Setup

When Smart Mirror is configured correctly, Bitbucket shows the mirror as an option when providing a clone URL:

Choose your mirror and use the Clone URL to configure your Jenkins job.

Log in to your Bitbucket repository, navigate to Repository Settings > Hooks > Enable, or click the Edit setting for Webhooks to Jenkins Server icon. Select the mirror from the Mirror Server dropdown in the Jenkins Instance(s) tab.

The Mirror Server dropdown does not appear if Smart Mirror has not been configured.

Selecting a mirror changes the plugin behavior by triggering Jenkins only when the selected mirror is synchronized with the primary server. The Clone URL changes accordingly to the selected mirror.

The Primary option must be selected if you need to revert to normal behavior.