question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🚀 Feature: Make the AzureDevOpsEntityProvider multi project

See original GitHub issue

🔖 Feature description

Right now for the Azure DevOps EntityProvider you need to specify a project like so:

catalog:
  providers:
  azureDevOps:
    someId: 
      organization: 'MyOrg'
      project: 'MyProjectName'
      repository: '*' 
      path: catalog-info.yaml

What would be useful for companies with multiple projects is to use a wildcard just as for the repository specification:

catalog:
  providers:
  azureDevOps:
    someId: 
      organization: 'MyOrg'
      project: '*'
      repository: '*' 
      path: catalog-info.yaml

🎤 Context

In my use-case we have over 30 projects that change dynamically and I have seen multiple users in the issues having the same issue.

Related: #10431

✌️ Possible Implementation

It seems that the AzureDevOpsEntityProvider calls the codesearch API(https://github.com/backstage/backstage/blob/master/plugins/catalog-backend-module-azure/src/providers/AzureDevOpsEntityProvider.ts#L141) for Azure Devops here: https://github.com/backstage/backstage/blob/master/plugins/catalog-backend-module-azure/src/lib/azure.ts#L50

However, that call is opinionated towards a must-have project. That URL doesn’t need a project as stated in the docs: https://learn.microsoft.com/en-us/rest/api/azure/devops/search/code-search-results/fetch-code-search-results?view=azure-devops-rest-7.1&tabs=HTTP#examples

I would suggest that we use the baseurl from the start without a project:

  const searchUrl = `${searchBaseUrl}/${org}/${project}/_apis/search/codesearchresults?api-version=6.0-preview.1`;

to

  const searchUrl = `${searchBaseUrl}/${org}/_apis/search/codesearchresults?api-version=7.0-preview.1`;

And then, if there is a project specified, add it to the searchText property the same as with the repo:

 searchText: `path:${path} repo:${repo || '*'} proj: ${project|| '*'}`,

I tested these calls with postman, and they work. I’m uncertain if more things need to change.

I would love to contribute, but I don’t know how to debug the plugin effectively and change things around. If somebody can help me get started, that would be great!

👀 Have you spent some time to check if this feature request has been raised before?

  • I checked and didn’t find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
goenningcommented, Nov 21, 2022

@awanlin I thought project was required, but if it’s possible to send the project as part of the query, I agree with this change, especially because it’s backwards compatible as you say 👍

0reactions
awanlincommented, Nov 24, 2022

Hi @MarcBruins, you had asked about tests. You can usually find any existing tests in the same locaiton as the code but with test in the name just before the file extension. In your case you’d be looking at:

My gut tells me that you’ll want to add tests to azure.test.ts as that is where the bulk of your change is

To run these navigate to the folder plugins/catalog-backend-module-azure and run yarn test. This will run all the tests in this plugin. To run just a single test file navigate to the folder it’s in and then run yarn test name-of-test-file. For example to run just azure.test.ts you’d go to plugins/catalog-backend-module-azure/src/lib and then run yarn test azure.test.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

About projects and scaling your organization - Azure DevOps
Manage work across your organization · View projects in your organization · Limit visibility of projects · Use a single project · Use...
Read more >
efcore 6
NET Core tends to be in one single project, but EF Core is likely to be in multiple projects. Click on Add to...
Read more >
Allow Teams to work over multiple Projects (Teams at the ...
Can You please make some comments about the future of this feature in Azure DevOps. We need it as well. Why? small team;...
Read more >
How to use Angular environment files in your Azure DevOps ...
Start with an Angular app · Create Azure DevOps project · Create initial pipeline · Change to multi-stage pipeline · Configure build stage ......
Read more >
Nginx react app - Seba Online
Your deployed React application will be built and the build folder will be served from an ... When you run a multi-container web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found