Subversion repository path does not exist error message in the Bamboo logs
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When Bamboo tries to detect branches in Subversion (SVN) repositories, if the repository URLs are incorrectly set, or if different users follow distinct repository structures, the paths Bamboo tries to search for branches might not exist and we'll see error messages in the logs:
Path <repo>/trunk/branches does not exist. Please check configuration of SVN repository. No branches found.
Environment
All supported Bamboo versions using Subversion repositories with automatic branch detection enabled.
Diagnosis
The following errors can be seen in the Bamboo logs:
Path svn+ssh://<repository_path>/trunk/branches does not exist. Please check configuration of SVN repository. No branches found.
svn branch detected: svn+ssh://<repository_path>/branches/<branch_name>, but doesn't start with root svn+ssh://<repository_path>/trunk/
Cause
This comes from Bamboo trying to detect branches on SVN repositories that are misconfigured or follow a different structure than SVN's default one, so the paths Bamboo tries to detect branches on don't exist.
Bamboo branch detection for Subversion repositories
- Unless you specify the branch detection path manually, Bamboo will search for branches under the repository's root URL, at the /branch and /branches subfolders. If the repository root URL is pointing to a branch already (instead of the repository), it won't find any /branch nor /branches folders within that branch, thus we'll see the errors in the logs.
- If a repository is defined in Bamboo with the branch path pointing to /branches/some_branch, Bamboo checks the branch path (/branches/some_branch) and understands that path as where the branches reside. Then, when performing branch detection, it removes the /some_branch portion and searches under /branches.
- When a repo is configured to have a branch path inside /trunk, Bamboo doesn't recognize "trunk" as being a branch folder (as per the usual Subversion convention), therefore, it tries to find a /branches folder inside /trunk. As per the usual convention, branches aren't stored under /trunk, but under /branches instead, with /trunk/ being the main development line only.
Misconfiguration examples
- Repositories with the repository root URL pointing to a branch rather than to the repository itself. E.g.,
svn.com/reponame/trunk
instead ofsvn.com/reponame
. - At a plan level, Manually define branch detection is checked and a wrong path for detection has been provided. This can also happen at a Linked Repository level when the repository root URL is wrong.
Solution
Repository root URL updates
The best approach is to update the repository root URL for the repository and point it to the repository itself rather than a branch. The branch to be used should be selected using the Branch name and Branch path fields.
However, there are other options, although less recommended.
Repository URL pointing to /trunk
For example, svn+ssh://server/svn/myRepo/build/trunk/
Solution: check the Manual define branch detection path option and leave the path empty. This is enough for Bamboo to search for branches using the Root URL only.
Repository URL pointing to a branch
For example, svn+ssh://server/svn/myRepo/build/trunk/myBranch
Solution: check the Manual define branch detection path option and leave the path empty. This is enough for Bamboo to search for branches using the Root URL only.
Manually define the branch detection path
Another option is to either check the Manual define branch detection path box under the repository's configuration and point it to the folder where branches are located (e.g., /branches), or uncheck Automatically detect root URL for branches under Advanced options, and point it to the branches folder.
You can also use the following SQL query to retrieve the repository data from the database, to have a better look at what's misconfigured and needs to be updated:
select VCS_LOCATION_ID AS REPO_ID,
NAME AS REPO_NAME,
DESCRIPTION AS REPO_DESC,
SUBSTRING(XML_DEFINITION_DATA, CHARINDEX('repositoryRoot</string><string>', XML_DEFINITION_DATA) + LEN('repositoryRoot</string><string>'), CHARINDEX('</string></entry></serverConfiguration',XML_DEFINITION_DATA) - (CHARINDEX('repositoryRoot</string><string>', XML_DEFINITION_DATA) + LEN('repositoryRoot</string><string>')) ) AS REPO_ROOT_URL,
CASE WHEN XML_DEFINITION_DATA LIKE '%svn.branch.displayName%'
THEN (SUBSTRING(XML_DEFINITION_DATA, CHARINDEX('branch.displayName</string><string>', XML_DEFINITION_DATA) + LEN('branch.displayName</string><string>'), CHARINDEX('</string></entry><entry><string>repository.svn.branch.path',XML_DEFINITION_DATA) - (CHARINDEX('branch.displayName</string><string>', XML_DEFINITION_DATA) + LEN('branch.displayName</string><string>')) ))
ELSE '' END AS BRANCH_NAME,
CASE WHEN XML_DEFINITION_DATA LIKE '%repository.svn.branch.path</string><string>%'
THEN (SUBSTRING(XML_DEFINITION_DATA, CHARINDEX('repository.svn.branch.path</string><string>', XML_DEFINITION_DATA) + LEN('repository.svn.branch.path</string><string>'), CHARINDEX('</string></entry></branchConfiguration>',XML_DEFINITION_DATA) - (CHARINDEX('repository.svn.branch.path</string><string>', XML_DEFINITION_DATA) + LEN('repository.svn.branch.path</string><string>')) ))
ELSE '' END AS BRANCH_PATH,
CASE WHEN XML_DEFINITION_DATA LIKE '%branch.detection.path%'
THEN (SUBSTRING(XML_DEFINITION_DATA, CHARINDEX('branch.detection.path</string><string>', XML_DEFINITION_DATA) + LEN('branch.detection.path</string><string>'), CHARINDEX('</string></entry></branchDetectionConfiguration',XML_DEFINITION_DATA) - (CHARINDEX('branch.detection.path</string><string>', XML_DEFINITION_DATA) + LEN('branch.detection.path</string><string>')) ))
ELSE '' END AS MANUAL_BRANCH_DETECTION
from VCS_LOCATION
where PLUGIN_KEY = 'com.atlassian.bamboo.plugin.system.repository:svnv2'
and VCS_LOCATION.PARENT_ID IS NULL
and IS_GLOBAL = 1
and MARKED_FOR_DELETION = 0
This was tested on MySQL. If you use a different database management system, you’ll need to translate the query above into your DBMS’s syntax.
This will output the following columns for your review:
- REPO_ID: the ID of the repository.
- REPO_NAME: the name of the repository, so you can identify it in the Linked Repositories list.
- REPO_DESC: the description (in case there is any), to help you differentiate repositories with similar names.
- REPO_ROOT_URL: the repository root URL. This is one of the fields you should check.
- BRANCH_NAME: the selected branch for the repository.
- BRANCH_PATH: the path for the selected branch.
MANUAL_BRANCH_DETECTION: if the repository has the Manually define branch detection path checked, this column shows which path is configured. If empty, that option is not marked.
Please note that this will only retrieve linked repositories (the global ones). It doesn't include repositories that the users manually created within the plan level.