From bc5b26ea580d083f0f7797334d6c7e54c62b37db Mon Sep 17 00:00:00 2001 From: Tarak Nath Tatwa Date: Tue, 5 Sep 2023 10:50:17 +0530 Subject: [PATCH] feedback changes Signed-off-by: Tarak Nath Tatwa --- plugins/azure-devops/README.md | 6 ------ plugins/azure-devops/package.json | 1 - plugins/azure-devops/src/constants.ts | 2 -- plugins/azure-devops/src/plugin.ts | 2 -- .../src/utils/getAnnotationFromEntity.ts | 18 ------------------ 5 files changed, 29 deletions(-) diff --git a/plugins/azure-devops/README.md b/plugins/azure-devops/README.md index cc0f4c67f3..7eeae09813 100644 --- a/plugins/azure-devops/README.md +++ b/plugins/azure-devops/README.md @@ -61,12 +61,6 @@ spec: # ... ``` -```yaml -backstage.io/managed-by-location: https://dev.azure.com/{org}/{project}/_git/{repo}?path=/.catalog/component.yml -``` - -In cases where the annotations `dev.azure.com/project-repo` or `dev.azure.com/project` are not present, **the project and repository details can be obtained using the `backstage.io/managed-by-location` annotation**. This method comes into play when the URL within the location includes `dev.azure.com`, which then triggers the activation of the CICD tab. - #### Azure Pipelines Only If you are only using Azure Pipelines along with a different SCM tool then you can use the following two annotations to see Builds: diff --git a/plugins/azure-devops/package.json b/plugins/azure-devops/package.json index 29f5fc1eb6..9100f37091 100644 --- a/plugins/azure-devops/package.json +++ b/plugins/azure-devops/package.json @@ -40,7 +40,6 @@ "@material-ui/lab": "4.0.0-alpha.61", "@types/react": "^16.13.1 || ^17.0.0", "humanize-duration": "^3.27.0", - "git-url-parse": "^13.1.0", "luxon": "^3.0.0", "react-use": "^17.2.4" }, diff --git a/plugins/azure-devops/src/constants.ts b/plugins/azure-devops/src/constants.ts index bfc6603abf..95e5be4930 100644 --- a/plugins/azure-devops/src/constants.ts +++ b/plugins/azure-devops/src/constants.ts @@ -18,6 +18,4 @@ export const AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION = 'dev.azure.com/build-definition'; export const AZURE_DEVOPS_PROJECT_ANNOTATION = 'dev.azure.com/project'; export const AZURE_DEVOPS_REPO_ANNOTATION = 'dev.azure.com/project-repo'; -export const AZURE_DEVOPS_PROJECT_LOCATION = 'backstage.io/managed-by-location'; export const AZURE_DEVOPS_DEFAULT_TOP: number = 10; -export const AZURE_DEVOPS_URL_FORMAT = 'https://dev.azure.com'; diff --git a/plugins/azure-devops/src/plugin.ts b/plugins/azure-devops/src/plugin.ts index e6eb0556f6..4dd423f35a 100644 --- a/plugins/azure-devops/src/plugin.ts +++ b/plugins/azure-devops/src/plugin.ts @@ -37,7 +37,6 @@ import { import { AzureDevOpsClient } from './api/AzureDevOpsClient'; import { Entity } from '@backstage/catalog-model'; import { azureDevOpsApiRef } from './api/AzureDevOpsApi'; -import { isDevAzureLocation } from './utils/isAzureLocation'; /** @public */ export const isAzureDevOpsAvailable = (entity: Entity) => @@ -46,7 +45,6 @@ export const isAzureDevOpsAvailable = (entity: Entity) => /** @public */ export const isAzurePipelinesAvailable = (entity: Entity) => Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_REPO_ANNOTATION]) || - isDevAzureLocation(entity) || (Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION]) && Boolean( entity.metadata.annotations?.[AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION], diff --git a/plugins/azure-devops/src/utils/getAnnotationFromEntity.ts b/plugins/azure-devops/src/utils/getAnnotationFromEntity.ts index 70cff6da0d..3e73c9646c 100644 --- a/plugins/azure-devops/src/utils/getAnnotationFromEntity.ts +++ b/plugins/azure-devops/src/utils/getAnnotationFromEntity.ts @@ -18,12 +18,8 @@ import { AZURE_DEVOPS_BUILD_DEFINITION_ANNOTATION, AZURE_DEVOPS_PROJECT_ANNOTATION, AZURE_DEVOPS_REPO_ANNOTATION, - AZURE_DEVOPS_PROJECT_LOCATION, - AZURE_DEVOPS_URL_FORMAT, } from '../constants'; -import parseGitUrl from 'git-url-parse'; - import { Entity } from '@backstage/catalog-model'; export function getAnnotationFromEntity(entity: Entity): { @@ -42,20 +38,6 @@ export function getAnnotationFromEntity(entity: Entity): { const project = entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_ANNOTATION]; - const location = entity.metadata.annotations?.[AZURE_DEVOPS_PROJECT_LOCATION]; - const isAzureDevUrl = location?.includes(AZURE_DEVOPS_URL_FORMAT); - - if (!project && location && isAzureDevUrl) { - const { name: repo, owner } = parseGitUrl(location); - - const projArrData = owner.split('/'); - - const proj = projArrData[projArrData.length - 2]; - - const definition = undefined; - return { project: proj, repo, definition }; - } - if (!project) { throw new Error('Value for annotation dev.azure.com/project was not found'); }