From 2890f47517645ebbb465f117127bf25ffd002e2e Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Wed, 23 Nov 2022 16:32:42 +0100 Subject: [PATCH 01/12] add changes to make it multiproject Signed-off-by: Marc Bruins --- .changeset/ninety-hats-serve.md | 5 +++++ docs/integrations/azure/discovery.md | 7 ++++++- plugins/catalog-backend-module-azure/src/lib/azure.ts | 7 +++++-- .../src/providers/AzureDevOpsEntityProvider.ts | 11 ++++++----- 4 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 .changeset/ninety-hats-serve.md diff --git a/.changeset/ninety-hats-serve.md b/.changeset/ninety-hats-serve.md new file mode 100644 index 0000000000..637d56d47e --- /dev/null +++ b/.changeset/ninety-hats-serve.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-azure': minor +--- + +This will add the ability to use Azure DevOps with multi project with a single value which is a new feature as previously this had to be done manually for each project that you wanted to add diff --git a/docs/integrations/azure/discovery.md b/docs/integrations/azure/discovery.md index 2156f60814..18686ebdc3 100644 --- a/docs/integrations/azure/discovery.md +++ b/docs/integrations/azure/discovery.md @@ -47,6 +47,11 @@ catalog: frequency: { minutes: 30 } # supports ISO duration, "human duration" as used in code timeout: { minutes: 3 } + yourSecondProviderId: # identifies your dataset / provider independent of config changes + organization: myorg + project: '*' # this will match all projects + repository: '*' # this will match all repos + path: /catalog-info.yaml anotherProviderId: # another identifier organization: myorg project: myproject @@ -62,7 +67,7 @@ The parameters available are: - **`host:`** _(optional)_ Leave empty for Cloud hosted, otherwise set to your self-hosted instance host. - **`organization:`** Your Organization slug (or Collection for on-premise users). Required. -- **`project:`** Your project slug. Required. +- **`project:`** Your project slug. Required. Wildcards are supported as show on the examples above. If not set, all projects will be searched. - **`repository:`** _(optional)_ The repository name. Wildcards are supported as show on the examples above. If not set, all repositories will be searched. - **`path:`** _(optional)_ Where to find catalog-info.yaml files. Defaults to /catalog-info.yaml. - **`schedule`** _(optional)_: diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.ts b/plugins/catalog-backend-module-azure/src/lib/azure.ts index 316c9b0b8c..0c96d133d3 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.ts @@ -31,6 +31,9 @@ export interface CodeSearchResultItem { repository: { name: string; }; + project: { + name: string; + }; } const isCloud = (host: string) => host === 'dev.azure.com'; @@ -47,7 +50,7 @@ export async function codeSearch( const searchBaseUrl = isCloud(azureConfig.host) ? 'https://almsearch.dev.azure.com' : `https://${azureConfig.host}`; - const searchUrl = `${searchBaseUrl}/${org}/${project}/_apis/search/codesearchresults?api-version=6.0-preview.1`; + const searchUrl = `${searchBaseUrl}/${org}/_apis/search/codesearchresults?api-version=6.0-preview.1`; let items: CodeSearchResultItem[] = []; let hasMorePages = true; @@ -59,7 +62,7 @@ export async function codeSearch( }), method: 'POST', body: JSON.stringify({ - searchText: `path:${path} repo:${repo || '*'}`, + searchText: `path:${path} repo:${repo || '*'} proj:${project || '*'}`, $skip: items.length, $top: PAGE_SIZE, }), diff --git a/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts b/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts index b824d176ee..87ddde78d3 100644 --- a/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts +++ b/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts @@ -166,17 +166,18 @@ export class AzureDevOpsEntityProvider implements EntityProvider { } private createLocationSpec(file: CodeSearchResultItem): LocationSpec { + const target = this.createObjectUrl(file); + return { type: 'url', - target: this.createObjectUrl(file), + target: target, presence: 'required', }; } private createObjectUrl(file: CodeSearchResultItem): string { - const baseUrl = `https://${this.config.host}/${this.config.organization}/${this.config.project}`; - return encodeURI( - `${baseUrl}/_git/${file.repository.name}?path=${file.path}`, - ); + const baseUrl = `https://${this.config.host}/${this.config.organization}`; + const encodedUri = `${baseUrl}/${file.project.name}/_git/${file.repository.name}?path=${file.path}`; + return encodedUri; } } From 68787714bf8a23e43f59a5b32ef66910995b8fa6 Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Fri, 25 Nov 2022 06:38:20 +0100 Subject: [PATCH 02/12] add project to tests Signed-off-by: Marc Bruins --- .../src/lib/azure.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts index 16f5067197..7c3fc0f9e3 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts @@ -64,6 +64,9 @@ describe('azure', () => { repository: { name: 'backstage', }, + project: { + name: '*', + }, }, { fileName: 'catalog-info.yaml', @@ -71,6 +74,9 @@ describe('azure', () => { repository: { name: 'ios-app', }, + project: { + name: '*', + }, }, ], }; @@ -151,6 +157,9 @@ describe('azure', () => { repository: { name: 'backstage', }, + project: { + name: '*', + }, }, ], }; @@ -190,6 +199,9 @@ describe('azure', () => { repository: { name: 'backstage', }, + project: { + name: '*', + }, })); }; From 73beead7480466607d9abe83c97aa204722f07d2 Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Fri, 25 Nov 2022 06:44:47 +0100 Subject: [PATCH 03/12] add project to tests expects Signed-off-by: Marc Bruins --- .../catalog-backend-module-azure/src/lib/azure.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts index 7c3fc0f9e3..14cd1d082f 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts @@ -33,7 +33,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:*', + searchText: 'path:/catalog-info.yaml repo:* proj:*', $skip: 0, $top: 1000, }); @@ -87,7 +87,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:*', + searchText: 'path:/catalog-info.yaml repo:* proj:*', $skip: 0, $top: 1000, }); @@ -127,7 +127,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:backstage', + searchText: 'path:/catalog-info.yaml repo:backstage: proj:*', $skip: 0, $top: 1000, }); @@ -170,7 +170,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:*', + searchText: 'path:/catalog-info.yaml repo:* proj:*', $skip: 0, $top: 1000, }); From 206b9062a0d155f8cf833abe6d9496f89b5c2196 Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Fri, 25 Nov 2022 07:29:48 +0100 Subject: [PATCH 04/12] remove unnecessary , Signed-off-by: Marc Bruins --- plugins/catalog-backend-module-azure/src/lib/azure.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts index 14cd1d082f..ec6ef654b6 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts @@ -65,7 +65,7 @@ describe('azure', () => { name: 'backstage', }, project: { - name: '*', + name: 'backstage', }, }, { @@ -75,7 +75,7 @@ describe('azure', () => { name: 'ios-app', }, project: { - name: '*', + name: 'backstage', }, }, ], @@ -87,7 +87,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:* proj:*', + searchText: 'path:/catalog-info.yaml repo:* proj:backstage', $skip: 0, $top: 1000, }); From 3825687f5aed23c17e434315f77cc068ef71d58e Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Sat, 24 Dec 2022 18:43:24 +0100 Subject: [PATCH 05/12] Update docs and fix tests Signed-off-by: Marc Bruins --- docs/integrations/azure/discovery.md | 2 +- .../providers/AzureDevOpsEntityProvider.test.ts | 15 +++++++++++++++ .../src/providers/AzureDevOpsEntityProvider.ts | 7 ++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/integrations/azure/discovery.md b/docs/integrations/azure/discovery.md index 18686ebdc3..a7ddd9c4a9 100644 --- a/docs/integrations/azure/discovery.md +++ b/docs/integrations/azure/discovery.md @@ -149,7 +149,7 @@ When using a custom pattern, the target is composed of five parts: - The base instance URL, `https://dev.azure.com` in this case - The organization name which is required, `myorg` in this case -- The project name which is required, `myproject` in this case +- The project name which is optional, `myproject` in this case. This defaults to \*, which scans all the projects where the token has access to. - The repository blob to scan, which accepts \* wildcard tokens and must be added after `_git/`. This can simply be `*` to scan all repositories in the project. diff --git a/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.test.ts b/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.test.ts index f7a63f259e..dff1164899 100644 --- a/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.test.ts +++ b/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.test.ts @@ -164,6 +164,9 @@ describe('AzureDevOpsEntityProvider', () => { repository: { name: 'myrepo', }, + project: { + name: 'myproject', + }, }, ], 'https://dev.azure.com/myorganization/myproject', @@ -189,6 +192,9 @@ describe('AzureDevOpsEntityProvider', () => { repository: { name: 'myrepo', }, + project: { + name: 'myproject', + }, }, { fileName: 'catalog-info.yaml', @@ -196,6 +202,9 @@ describe('AzureDevOpsEntityProvider', () => { repository: { name: 'myotherrepo', }, + project: { + name: 'myproject', + }, }, ], 'https://dev.azure.com/myorganization/myproject', @@ -277,6 +286,9 @@ describe('AzureDevOpsEntityProvider', () => { repository: { name: 'myrepo', }, + project: { + name: 'myproject', + }, }, { fileName: 'catalog-info.yaml', @@ -284,6 +296,9 @@ describe('AzureDevOpsEntityProvider', () => { repository: { name: 'myotherrepo', }, + project: { + name: 'myproject', + }, }, ], 'https://dev.azure.com/myorganization/myproject', diff --git a/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts b/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts index 87ddde78d3..c9ad3fb05b 100644 --- a/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts +++ b/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts @@ -176,8 +176,9 @@ export class AzureDevOpsEntityProvider implements EntityProvider { } private createObjectUrl(file: CodeSearchResultItem): string { - const baseUrl = `https://${this.config.host}/${this.config.organization}`; - const encodedUri = `${baseUrl}/${file.project.name}/_git/${file.repository.name}?path=${file.path}`; - return encodedUri; + const baseUrl = `https://${this.config.host}/${this.config.organization}/${file.project.name}`; + return encodeURI( + `${baseUrl}/_git/${file.repository.name}?path=${file.path}`, + ); } } From 51bc158294b057147b950c64c076b36ae93aa67b Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Thu, 19 Jan 2023 14:12:42 +0100 Subject: [PATCH 06/12] add project schema to tests Signed-off-by: Marc Bruins --- .../src/lib/azure.test.ts | 3 +++ .../processors/AzureDevOpsDiscoveryProcessor.test.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts index ec6ef654b6..4a68603246 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts @@ -114,6 +114,9 @@ describe('azure', () => { { fileName: 'catalog-info.yaml', path: '/catalog-info.yaml', + project: { + name: '*', + }, repository: { name: 'backstage', }, diff --git a/plugins/catalog-backend-module-azure/src/processors/AzureDevOpsDiscoveryProcessor.test.ts b/plugins/catalog-backend-module-azure/src/processors/AzureDevOpsDiscoveryProcessor.test.ts index 9000b177fa..38df737179 100644 --- a/plugins/catalog-backend-module-azure/src/processors/AzureDevOpsDiscoveryProcessor.test.ts +++ b/plugins/catalog-backend-module-azure/src/processors/AzureDevOpsDiscoveryProcessor.test.ts @@ -135,6 +135,9 @@ describe('AzureDevOpsDiscoveryProcessor', () => { { fileName: 'catalog-info.yaml', path: '/catalog-info.yaml', + project: { + name: '*', + }, repository: { name: 'backstage', }, @@ -142,6 +145,9 @@ describe('AzureDevOpsDiscoveryProcessor', () => { { fileName: 'catalog-info.yaml', path: '/src/catalog-info.yaml', + project: { + name: '*', + }, repository: { name: 'ios-app', }, @@ -191,6 +197,9 @@ describe('AzureDevOpsDiscoveryProcessor', () => { repository: { name: 'backstage', }, + project: { + name: '*', + }, }, ]); const emitter = jest.fn(); @@ -229,6 +238,9 @@ describe('AzureDevOpsDiscoveryProcessor', () => { repository: { name: 'backstage', }, + project: { + name: '*', + }, }, ]); const emitter = jest.fn(); From 0c0cdef24fa8de8bb80adcbd18c4b182b1d6fe43 Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Thu, 19 Jan 2023 14:13:36 +0100 Subject: [PATCH 07/12] change to patch upgrade Signed-off-by: Marc Bruins --- .changeset/ninety-hats-serve.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/ninety-hats-serve.md b/.changeset/ninety-hats-serve.md index 637d56d47e..9d9828f54c 100644 --- a/.changeset/ninety-hats-serve.md +++ b/.changeset/ninety-hats-serve.md @@ -1,5 +1,5 @@ --- -'@backstage/plugin-catalog-backend-module-azure': minor +'@backstage/plugin-catalog-backend-module-azure': patch --- This will add the ability to use Azure DevOps with multi project with a single value which is a new feature as previously this had to be done manually for each project that you wanted to add From 0cf553dcd1e8f7e121cd85cb12ae1ef9f8d0a37f Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Tue, 24 Jan 2023 15:11:49 +0100 Subject: [PATCH 08/12] update docs Signed-off-by: Marc Bruins --- .changeset/ninety-hats-serve.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.changeset/ninety-hats-serve.md b/.changeset/ninety-hats-serve.md index 9d9828f54c..762e53c242 100644 --- a/.changeset/ninety-hats-serve.md +++ b/.changeset/ninety-hats-serve.md @@ -2,4 +2,29 @@ '@backstage/plugin-catalog-backend-module-azure': patch --- -This will add the ability to use Azure DevOps with multi project with a single value which is a new feature as previously this had to be done manually for each project that you wanted to add +This will add the ability to use Azure DevOps with multi project with a single value which is a new feature as previously this had to be done manually for each project that you wanted to add. + +Right now you would have to fill in multiple values in the config to use multiple projects: + +``` +yourFirstProviderId: # identifies your dataset / provider independent of config changes + organization: myorg + project: 'firstProject' # this will match the firstProject project + repository: '*' # this will match all repos + path: /catalog-info.yaml +yourSecondProviderId: # identifies your dataset / provider independent of config changes + organization: myorg + project: 'secondProject' # this will match the secondProject project + repository: '*' # this will match all repos + path: /catalog-info.yaml +``` + +With this change you can actually have all projects available where your PAT determines which you have access to, so that includes multiple projects: + +``` +yourFirstProviderId: # identifies your dataset / provider independent of config changes + organization: myorg + project: '*' # this will match all projects where your PAT has access to + repository: '*' # this will match all repos + path: /catalog-info.yaml +``` From e8db0fe4cee7f130a2c4416c05208be1ecac263b Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Tue, 24 Jan 2023 15:14:41 +0100 Subject: [PATCH 09/12] update docs Signed-off-by: Marc Bruins --- docs/integrations/azure/discovery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/azure/discovery.md b/docs/integrations/azure/discovery.md index a7ddd9c4a9..7d53e21a89 100644 --- a/docs/integrations/azure/discovery.md +++ b/docs/integrations/azure/discovery.md @@ -67,7 +67,7 @@ The parameters available are: - **`host:`** _(optional)_ Leave empty for Cloud hosted, otherwise set to your self-hosted instance host. - **`organization:`** Your Organization slug (or Collection for on-premise users). Required. -- **`project:`** Your project slug. Required. Wildcards are supported as show on the examples above. If not set, all projects will be searched. +- **`project:`** _(optional)_ Your project slug. Wildcards are supported as show on the examples above. If not set, all projects will be searched. - **`repository:`** _(optional)_ The repository name. Wildcards are supported as show on the examples above. If not set, all repositories will be searched. - **`path:`** _(optional)_ Where to find catalog-info.yaml files. Defaults to /catalog-info.yaml. - **`schedule`** _(optional)_: From f9f81aaf5881a929528c98968f94e3c03027c6f3 Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Thu, 26 Jan 2023 20:04:59 +0100 Subject: [PATCH 10/12] update tests Signed-off-by: Marc Bruins --- .../src/lib/azure.test.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts index 4a68603246..47a3bc4fcb 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts @@ -33,7 +33,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:* proj:*', + searchText: 'path:/catalog-info.yaml repo:* proj:engineering', $skip: 0, $top: 1000, }); @@ -87,7 +87,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:* proj:backstage', + searchText: 'path:/catalog-info.yaml repo:* proj:engineering', $skip: 0, $top: 1000, }); @@ -130,7 +130,8 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:backstage: proj:*', + searchText: + 'path:/catalog-info.yaml repo:backstage: proj:engineering', $skip: 0, $top: 1000, }); @@ -173,7 +174,7 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ - searchText: 'path:/catalog-info.yaml repo:* proj:*', + searchText: 'path:/catalog-info.yaml repo:* proj:engineering', $skip: 0, $top: 1000, }); @@ -214,7 +215,8 @@ describe('azure', () => { (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toMatchObject({ - searchText: 'path:/catalog-info.yaml repo:backstage', + searchText: + 'proj:engineering path:/catalog-info.yaml repo:backstage', $top: 1000, }); From 2ad2119e4481880e4ce40a2094d5b6bf0bc3d550 Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Thu, 26 Jan 2023 20:22:52 +0100 Subject: [PATCH 11/12] update test url Signed-off-by: Marc Bruins --- .../src/lib/azure.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts index 47a3bc4fcb..10a7482387 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts @@ -29,7 +29,7 @@ describe('azure', () => { server.use( rest.post( - `https://almsearch.dev.azure.com/shopify/engineering/_apis/search/codesearchresults`, + `https://almsearch.dev.azure.com/shopify/_apis/search/codesearchresults`, (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ @@ -83,7 +83,7 @@ describe('azure', () => { server.use( rest.post( - `https://almsearch.dev.azure.com/shopify/engineering/_apis/search/codesearchresults`, + `https://almsearch.dev.azure.com/shopify/_apis/search/codesearchresults`, (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ @@ -126,7 +126,7 @@ describe('azure', () => { server.use( rest.post( - `https://almsearch.dev.azure.com/shopify/engineering/_apis/search/codesearchresults`, + `https://almsearch.dev.azure.com/shopify/_apis/search/codesearchresults`, (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ @@ -170,7 +170,7 @@ describe('azure', () => { server.use( rest.post( - `https://azuredevops.mycompany.com/shopify/engineering/_apis/search/codesearchresults`, + `https://azuredevops.mycompany.com/shopify/_apis/search/codesearchresults`, (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ @@ -204,19 +204,19 @@ describe('azure', () => { name: 'backstage', }, project: { - name: '*', + name: 'engineering', }, })); }; server.use( rest.post( - `https://almsearch.dev.azure.com/shopify/engineering/_apis/search/codesearchresults`, + `https://almsearch.dev.azure.com/shopify/_apis/search/codesearchresults`, (req, res, ctx) => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toMatchObject({ searchText: - 'proj:engineering path:/catalog-info.yaml repo:backstage', + 'path:/catalog-info.yaml repo:backstage proj:engineering', $top: 1000, }); From 6ad70dbf68c8166a714435a8405afbdf13fe7dd3 Mon Sep 17 00:00:00 2001 From: Marc Bruins Date: Thu, 26 Jan 2023 20:28:47 +0100 Subject: [PATCH 12/12] remove double quote Signed-off-by: Marc Bruins --- plugins/catalog-backend-module-azure/src/lib/azure.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts index 10a7482387..f26208353a 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.test.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.test.ts @@ -131,7 +131,7 @@ describe('azure', () => { expect(req.headers.get('Authorization')).toBe('Basic OkFCQw=='); expect(req.body).toEqual({ searchText: - 'path:/catalog-info.yaml repo:backstage: proj:engineering', + 'path:/catalog-info.yaml repo:backstage proj:engineering', $skip: 0, $top: 1000, });