PR Feedback

Signed-off-by: R-Beck-2020 <78100403+R-Beck-2020@users.noreply.github.com>
This commit is contained in:
R-Beck-2020
2024-01-11 16:06:53 +00:00
parent 8c9f3a1e19
commit c4f43d5cc8
8 changed files with 37 additions and 6 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/plugin-azure-devops': minor
---
Prefer dev.azure.com/build-definition annotation when it is provided, as it is more specific than dev.azure.com/project-repo
Prefer `dev.azure.com/build-definition` annotation when it is provided, as it is more specific than `dev.azure.com/project-repo`. This can also be used as a filter for mono-repos.
+19
View File
@@ -61,6 +61,25 @@ spec:
# ...
```
#### Mono repos
If you have multiple entities within a single repo, you will need to specify which pipelines belong to each entity.
```yaml
dev.azure.com/project-repo: <my-project>/<my-repo>
dev.azure.com/build-definition: <build-definition-name>
```
#### Pipeline in different project to repo
If your pipeline is in a different project to the source code, you will need to specify this in the project annotation.
```yaml
dev.azure.com/project-repo: <project1>/<my-repo>
dev.azure.com/build-definition: <build-definition-name>
dev.azure.com/project: <project2>
```
#### 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:
@@ -99,7 +99,7 @@ describe('useBuildRuns', () => {
renderHook(() => useBuildRuns(entity), {
wrapper: Wrapper,
}),
).toThrow('"dev.azure.com" annotations are missing');
).toThrow('Expected "dev.azure.com" annotations were not found');
});
it('should return throw when annotation invalid', async () => {
@@ -103,7 +103,7 @@ describe('useGitTags', () => {
renderHook(() => useGitTags(entity), {
wrapper: Wrapper,
}),
).toThrow('"dev.azure.com" annotations are missing');
).toThrow('Expected "dev.azure.com" annotations were not found');
});
it('should return throw when annotation invalid', async () => {
@@ -102,7 +102,7 @@ describe('usePullRequests', () => {
renderHook(() => usePullRequests(entity), {
wrapper: Wrapper,
}),
).toThrow('"dev.azure.com" annotations are missing');
).toThrow('Expected "dev.azure.com" annotations were not found');
});
it('should return throw when annotation invalid', async () => {
@@ -81,7 +81,7 @@ describe('useReadme', () => {
renderHook(() => useReadme(entity), {
wrapper: Wrapper,
}),
).toThrow('"dev.azure.com" annotations are missing');
).toThrow('Expected "dev.azure.com" annotations were not found');
});
it('should return throw when annotation invalid', async () => {
+12
View File
@@ -69,6 +69,18 @@ describe('azure-devops', () => {
expect(isAzurePipelinesAvailable(entity)).toBe(true);
});
it('should be false when no annotations are present', () => {
const entity: Entity = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
metadata: {
namespace: 'default',
name: 'sample',
},
};
expect(isAzurePipelinesAvailable(entity)).toBe(false);
});
it('should be false when only project annotation is present', () => {
const entity: Entity = {
apiVersion: 'backstage.io/v1alpha1',
@@ -71,7 +71,7 @@ export function getAnnotationValuesFromEntity(entity: Entity): {
}
}
throw new Error('"dev.azure.com" annotations are missing');
throw new Error('Expected "dev.azure.com" annotations were not found');
}
function getProjectRepo(annotations?: Record<string, string>): {