Merge pull request #11735 from jpitapeva/fix/catalog_azure_server_2020_

Fix/catalog azure server 2020
This commit is contained in:
Ben Lambert
2022-06-01 14:46:55 +02:00
committed by GitHub
3 changed files with 33 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/integration': patch
---
Updated to support deployments of Azure DevOps Server under TFS or similar sub path
@@ -142,6 +142,30 @@ describe('AzureUrl', () => {
);
});
it('should work with the old tfs long URL', () => {
const url = AzureUrl.fromRepoUrl(
'http://my-host/tfs/projects/my-project/_git/my-repo',
);
expect(url.getOwner()).toBe('tfs/projects');
expect(url.getProject()).toBe('my-project');
expect(url.getRepo()).toBe('my-repo');
expect(url.getRef()).toBeUndefined();
expect(url.getPath()).toBeUndefined();
});
it('should work with the old tfs long URL form with a path and ref', () => {
const url = AzureUrl.fromRepoUrl(
'http://my-host/tfs/projects/my-project/_git/my-repo?path=%2Ffolder&version=GBtest-branch',
);
expect(url.getOwner()).toBe('tfs/projects');
expect(url.getProject()).toBe('my-project');
expect(url.getRepo()).toBe('my-repo');
expect(url.getRef()).toBe('test-branch');
expect(url.getPath()).toBe('/folder');
});
it('should reject non-branch refs', () => {
expect(() =>
AzureUrl.fromRepoUrl(
@@ -37,6 +37,10 @@ export class AzureUrl {
owner = parts[1];
project = parts[2];
repo = parts[4];
} else if (parts[4] === '_git') {
owner = `${parts[1]}/${parts[2]}`;
project = parts[3];
repo = parts[5];
}
if (!owner || !project || !repo) {