feedback changes

Signed-off-by: Tarak Nath Tatwa <bikashcric1995@gmail.com>
This commit is contained in:
Tarak Nath Tatwa
2023-09-05 10:50:17 +05:30
parent 921b7ef641
commit bc5b26ea58
5 changed files with 0 additions and 29 deletions
-6
View File
@@ -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:
-1
View File
@@ -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"
},
-2
View File
@@ -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';
-2
View File
@@ -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],
@@ -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');
}