スマート ミラーリング

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

Bamboo provides support for Smart Mirroring in Bitbucket Data Center. Smart Mirroring allows you to use local repositories for storing your repository data to avoid having to wait when cloning a repository from a remote location. 

For more on Smart Mirroring, see Mirrors.

Prerequisites

  • Bitbucket Data Center 7.5 以降
  • routing from Bamboo to your Bitbucket Data Center instance
  • routing between agent and mirror


To enable Smart Mirroring in Bamboo: 

  1. From the Bamboo header select  > Build resources > Linked repositories.
  2. Select your Bitbucket Data Center repository. 
  3. In the Edit repository section, select Advanced options.
  4. From the Mirror drop-down list, select your mirror location.

    Repository mirror location selection

Bulk update of Smart Mirroring settings for repositories

Starting from Bamboo 6.10.3, you can update the mirrors for all repositories of a single Bitbucket Data Center.


Click here for details...

You can update the Mirror field value by using the following REST endpoint:

POST /rest/stash/latest/bulk/APPLICATION_LINK_ID/mirror  

  • APPLICATION_LINK_ID: the ID of a linked Bitbucket Data Center instance. Read below for more info on how to find it.
Payload format
  1. Perform a dry run (without an actual update), and reset all repositories to the master node. This will allow you to disable the usage of mirrors for all Bitbucket Data Center repositories in Bamboo.

    {
    	resetToPrimary:true,
    	dryRun:true
    }

    Here's a sample output:

    {
      "size": 21,
      "limit": 21,
      "lastPage": true,
      "start": 0,
      "values": [
        {
          "id": 1770061851,
          "name": "Bamboo Version Stable",
          "global": false,
          "selfUrl": "http://BAMBOO_URL/chain/admin/config/editChainRepository.action?buildKey=ZJM-VCT",
          "oldMirrorId": "",
          "oldMirrorName": "",
          "newMirrorId": "primary",
          "newMirrorName": "Primary"
        },
        {
          "id": 2357198853,
          "name": "bamboo-stash-plugin",
          "global": true,
          "selfUrl": "http://BAMBOO_URL/admin/editLinkedRepository.action?repositoryId=2357198853",
          "newMirrorId": "primary",
          "newMirrorName": "Primary"
        },
        {
          "id": 1642397765,
          "name": "bamboo-doc-code",
          "global": true,
          "selfUrl": "http://BAMBOO_URL/admin/editLinkedRepository.action?repositoryId=1642397765",
          "newMirrorId": "primary",
          "newMirrorName": "Primary"
        },
        {
          "id": 1775861823,
          "name": "bamboo-some-code",
          "global": true,
          "selfUrl": "http://BAMBOO_URL/admin/editLinkedRepository.action?repositoryId=1775861823",
          "oldMirrorId": "",
          "oldMirrorName": "",
          "newMirrorId": "primary",
          "newMirrorName": "Primary"
        },
        {
          "id": 2439381015,
          "name": "static assets",
          "global": false,
          "selfUrl": "http://BAMBOO_URL/chain/admin/config/editChainRepository.action?buildKey=TEST-CIWEBDRIVERCDN",
          "newMirrorId": "primary",
          "newMirrorName": "Primary"
        },
        {
          "id": 1738702849,
          "name": "atlassian-plugin",
          "global": true,
          "selfUrl": "http://BAMBOO_URL/admin/editLinkedRepository.action?repositoryId=1738702849",
          "oldMirrorId": "BFHH-O74T-KDGH-CT47",
          "oldMirrorName": "US East Mirror",
          "newMirrorId": "primary",
          "newMirrorName": "Primary"
        }
    ]
  2. Update all Bitbucket Data Center repositories, so they start using the provided mirror.

    {
    	mirrorId:"MIRROR_ID",
    	ignoreErrors: true
    }

    This will tell all repositories linked to a given Bitbucket Data Center Application Link to use the provided mirror. The ignoreErrors flag allows to skip updating repositories that aren't supported by the given mirror. The response will contain all affected repositories.

Obtaining the Bitbucket Data Center application link value

Use the following snippet to print the list of all Bitbucket Data Center instances known to Bamboo, together with their Application Link IDs:

curl -H "Content-Type: application/json" -H "Accept: application/json" http://BAMBOO_URL/rest/stash/latest/servers


Obtaining the Mirror ID value:

Use the following snippet to print the mirror servers that are configured in Bitbucket Data Center, together with their IDs:

curl -H "Accept: application/json" https://BITBUCKET_SERVER_URL/rest/mirroring/latest/mirrorServers

Downgrading from Bitbucket Data Center license to a regular license may cause problems. In the unlikely event of such a downgrade, we recommend switching all repositories to primary before switching versions.

最終更新日: 2024 年 1 月 19 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.