From 3f7bfe7b1153e2477587669bb8234b98e19b6bd7 Mon Sep 17 00:00:00 2001 From: Omer Farooq Date: Wed, 30 Dec 2020 13:11:35 +1300 Subject: [PATCH] remove url check to support on-prem ADO --- .../backend-common/src/reading/AzureUrlReader.ts | 8 +------- packages/integration/src/azure/core.test.ts | 12 ++++++++++++ packages/integration/src/azure/core.ts | 1 - 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/backend-common/src/reading/AzureUrlReader.ts b/packages/backend-common/src/reading/AzureUrlReader.ts index ca934ee42c..ea716a1d4a 100644 --- a/packages/backend-common/src/reading/AzureUrlReader.ts +++ b/packages/backend-common/src/reading/AzureUrlReader.ts @@ -47,13 +47,7 @@ export class AzureUrlReader implements UrlReader { constructor( private readonly options: AzureIntegrationConfig, private readonly deps: { treeResponseFactory: ReadTreeResponseFactory }, - ) { - if (options.host !== 'dev.azure.com') { - throw Error( - `Azure integration currently only supports 'dev.azure.com', tried to use host '${options.host}'`, - ); - } - } + ) {} async read(url: string): Promise { const builtUrl = getAzureFileFetchUrl(url); diff --git a/packages/integration/src/azure/core.test.ts b/packages/integration/src/azure/core.test.ts index 17041a9eb2..438e776eef 100644 --- a/packages/integration/src/azure/core.test.ts +++ b/packages/integration/src/azure/core.test.ts @@ -54,6 +54,18 @@ describe('azure core', () => { result: 'https://dev.azure.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml', }, + { + url: + 'https://api.com/org-name/project-name/_git/repo-name?path=my-template.yaml', + result: + 'https://api.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml', + }, + { + url: + 'https://api.com/org-name/project-name/_git/repo-name?path=my-template.yaml&version=GBmaster', + result: + 'https://api.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml&version=master', + }, ])('should handle happy path %#', async ({ url, result }) => { expect(getAzureFileFetchUrl(url)).toBe(result); }); diff --git a/packages/integration/src/azure/core.ts b/packages/integration/src/azure/core.ts index 44591f2509..7900774c79 100644 --- a/packages/integration/src/azure/core.ts +++ b/packages/integration/src/azure/core.ts @@ -43,7 +43,6 @@ export function getAzureFileFetchUrl(url: string): string { const ref = parsedUrl.searchParams.get('version')?.substr(2); if ( - parsedUrl.hostname !== 'dev.azure.com' || empty !== '' || userOrOrg === '' || project === '' ||