# Azure DevOps Plugin Website: [https://dev.azure.com/](https://dev.azure.com/) ## Features ### Azure Pipelines Lists the top _n_ builds for a given Azure Repo where _n_ is a configurable value ![Azure Pipelines Builds Example](./docs/azure-devops-builds.png) ### Azure Repos Lists the top _n_ Active, Completed, or Abandoned Pull Requests for a given repository where _n_ is a configurable value ![Azure Repos Pull Requests Example](./docs/azure-devops-pull-requests.png) ### Azure Repos Git Tags Lists all Git Tags for a given repository ![Azure Repos Git Tags Example](./docs/azure-devops-git-tags.png) ### Azure Readme Readme for a given repository ![Azure Readme Example](./docs/azure-devops-readme.png) ## Setup The following sections will help you get the Azure DevOps plugin setup and running ### Azure DevOps Backend You need to setup the [Azure DevOps backend plugin](https://github.com/backstage/backstage/tree/master/plugins/azure-devops-backend) before you move forward with any of these steps if you haven't already ### Entity Annotation To be able to use the Azure DevOps plugin you need to add the following annotation to any entities you want to use it with: ```yaml dev.azure.com/project-repo: / ``` Let's break this down a little: `` will be the name of your Team Project and `` will be the name of your repository which needs to be part of the Team Project you entered for ``. Here's what that will look like in action: ```yaml # Example catalog-info.yaml entity definition file apiVersion: backstage.io/v1alpha1 kind: Component metadata: # ... annotations: dev.azure.com/project-repo: my-project/my-repo spec: type: service # ... ``` #### 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: ```yaml dev.azure.com/project: dev.azure.com/build-definition: ``` In this case `` will be the name of your Team Project and `` will be the name of the Build Definition you would like to see Builds for, and it's possible to add more Builds separated by a comma. If the Build Definition name has spaces in it make sure to put quotes around it. ### Azure Pipelines Component To get the Azure Pipelines component working you'll need to do the following two steps: 1. First we need to add the `@backstage/plugin-azure-devops` package to your frontend app: ```bash # From your Backstage root directory yarn add --cwd packages/app @backstage/plugin-azure-devops ``` 2. Second we need to add the `EntityAzurePipelinesContent` extension to the entity page in your app. How to do this will depend on which annotation you are using in your entities: 1. If you are using the `dev.azure.com/project-repo` annotation then you'll want to do the following: ```tsx // In packages/app/src/components/catalog/EntityPage.tsx import { EntityAzurePipelinesContent, isAzureDevOpsAvailable, } from '@backstage/plugin-azure-devops'; // For example in the CI/CD section const cicdContent = ( // ... // ... ``` 2. If you are using the `dev.azure.com/project` and `dev.azure.com/build-definition` annotations then you'll want to do this: ```tsx // In packages/app/src/components/catalog/EntityPage.tsx import { EntityAzurePipelinesContent, isAzurePipelinesAvailable, } from '@backstage/plugin-azure-devops'; // For example in the CI/CD section const cicdContent = ( // ... // ... ``` **Notes:** - The `if` prop is optional on the `EntitySwitch.Case`, you can remove it if you always want to see the tab even if the entity being viewed does not have the needed annotation - The `defaultLimit` property on the `EntityAzurePipelinesContent` will set the max number of Builds you would like to see, if not set this will default to 10 ### Azure Repos Component To get the Azure Repos component working you'll need to do the following two steps: 1. First we need to add the @backstage/plugin-azure-devops package to your frontend app: ```bash # From your Backstage root directory yarn add --cwd packages/app @backstage/plugin-azure-devops ``` 2. Second we need to add the `EntityAzurePullRequestsContent` extension to the entity page in your app: ```tsx // In packages/app/src/components/catalog/EntityPage.tsx import { EntityAzurePullRequestsContent, isAzureDevOpsAvailable, } from '@backstage/plugin-azure-devops'; // For example in the Service section const serviceEntityPage = ( // ... // ... ``` **Notes:** - You'll need to add the `EntityLayout.Route` above from step 2 to all the entity sections you want to see Pull Requests in. For example if you wanted to see Pull Requests when looking at Website entities then you would need to add this to the `websiteEntityPage` section. - The `if` prop is optional on the `EntityLayout.Route`, you can remove it if you always want to see the tab even if the entity being viewed does not have the needed annotation - The `defaultLimit` property on the `EntityAzurePullRequestsContent` will set the max number of Pull Requests you would like to see, if not set this will default to 10 ### Git Tags Component To get the Git Tags component working you'll need to do the following two steps: 1. First we need to add the @backstage/plugin-azure-devops package to your frontend app: ```bash # From your Backstage root directory yarn add --cwd packages/app @backstage/plugin-azure-devops ``` 2. Second we need to add the `EntityAzureGitTagsContent` extension to the entity page in your app: ```tsx // In packages/app/src/components/catalog/EntityPage.tsx import { EntityAzureGitTagsContent, isAzureDevOpsAvailable, } from '@backstage/plugin-azure-devops'; // For example in the Service section const serviceEntityPage = ( // ... // ... ``` **Notes:** - You'll need to add the `EntityLayout.Route` above from step 2 to all the entity sections you want to see Git Tags in. For example if you wanted to see Git Tags when looking at Website entities then you would need to add this to the `websiteEntityPage` section. - The `if` prop is optional on the `EntityLayout.Route`, you can remove it if you always want to see the tab even if the entity being viewed does not have the needed annotation ### Git README To get the README component working you'll need to do the following two steps: 1. First we need to add the @backstage/plugin-azure-devops package to your frontend app: ```bash # From your Backstage root directory yarn add --cwd packages/app @backstage/plugin-azure-devops ``` 2. Second we need to add the `EntityAzureReadmeCard` extension to the entity page in your app: ```tsx // In packages/app/src/components/catalog/EntityPage.tsx import { EntityAzureReadmeCard, isAzureDevOpsAvailable, } from '@backstage/plugin-azure-devops'; // As it is a card, you can customize it the way you prefer // For example in the Service section const overviewContent = ( ... ); ``` **Notes:** - You'll need to add the `EntitySwitch.Case` above from step 2 to all the entity sections you want to see Readme in. For example if you wanted to see Readme when looking at Website entities then you would need to add this to the `websiteEntityPage` section. - The `if` prop is optional on the `EntitySwitch.Case`, you can remove it if you always want to see the tab even if the entity being viewed does not have the needed annotation - The `maxHeight` property on the `EntityAzureReadmeCard` will set the maximum screen size you would like to see, if not set it will default to 100% ## Limitations - Currently multiple organizations are not supported - Mixing Azure DevOps Services (cloud) and Azure DevOps Server (on-premise) is not supported