Regenerate SSH keys for Bitbucket Data Center

このページの内容

お困りですか?

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

コミュニティに質問

It may happen that one or more SSH keys you used to authenticate Bamboo with Bitbucket Data Center source code repositories are missing (for example, when an SSH key expires due to the global expiry policy configured by an admin). In such a case, you can regenerate them directly in the Bamboo user interface or by using dedicated REST API endpoints.

On this page:

Regenerating the key for a single repository

When viewing the settings for linked, project, or plan repositories stored in Bitbucket Data Center, you may see an error message stating that Bamboo couldn’t access the repository. One of the potential reasons for this issue could be missing SSH keys.

To regenerate the SSH key for an affected repository, navigate to the repository configuration page and select Save repository without making any changes to the settings.

Bamboo will attempt to repair the connection to the repository. If the problem persists, it may mean that the repository may have been moved or deleted or that the respective instance of Bitbucket is inaccessible.

Learn more about configuring source code repositories

Bulk regenerating SSH keys

If SSH keys are missing from many repositories and potentially across multiple linked instances of Bitbucket Data Center, you can repair them in bulk using the following Bamboo REST API endpoints.

These operations performed by these endpoints will only add the missing keys and will not replace existing, working ones. Performing key repair operations requires Administrator permissions.

Depending on the number of Bitbucket Data Center instances and repositories to process, bulk key regeneration may take a long time to complete.

Regenerating keys for all linked instances of Bitbucket Data Center

To regenerate the keys for all affected repositories in all linked instances of Bitbucket Data Center, call the following Bamboo REST API endpoint:

POST /rest/stash/latest/bulk/keys/repair

Include an empty request body in your API call.

Regenerating keys for a specific instance of Bitbucket Data Center

To regenerate the keys for all affected repositories in a single, specific linked instance of Bitbucket Data Center, call the following Bamboo REST API endpoint:

POST /rest/stash/latest/bulk/keys/repair/<APPLICATION_LINK_ID>

Include an empty request body in your API call.

To obtain a particular application link ID, use the following command to get the list of all linked Bitbucket Data Center instances together with their application link IDs:

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

レスポンス

The responses to the previously described REST calls come in the form of an execution log with information about the processing status of each repository.

Optional filtering parameters

Both endpoints include optional filtering parameters in the request payload to help with narrowing the number of repositories to process:

パラメータータイプ説明 既定値
search文字列Case-insensitive phrase to search for in repository names.
skipLinkedブーリアンSkip linked repositories.false
skipPlanブーリアンSkip plan-based repositories.false
skipProjectブーリアンSkip project repositories.false
selectedProjectsarray[string]List of case-insensitive project keys whose project repositories should be included. By default, all projects are included.
selectedPlansarray[string]Case-insensitive list of plan keys whose plan repositories should be included. By default, all plans are included.

For example, the request payload may look like this:

{
    "search": "bamboo",
    "skipLinked": false,
    "skipProject": false,
    "skipPlan": true,
    "selectedProjects": ["PROJECTKEY1", "PROJECTKEY2"]
}
最終更新日 2023 年 11 月 6 日

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

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