0.4.4 • Published 18 days ago

@backstage/plugin-azure-devops v0.4.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
18 days ago

Azure DevOps Plugin

Website: https://dev.azure.com/

Azure DevOps Builds Example

Setup

The following sections will help you get the Azure DevOps plugin setup and running

Configuration

The Azure DevOps plugin requires the following YAML to be added to your app-config.yaml:

azureDevOps:
  host: dev.azure.com
  token: ${AZURE_TOKEN}
  organization: my-company

Configuration Details:

  • host and token can be the same as the ones used for the integration section
  • AZURE_TOKEN environment variable must be set to a Personal Access Token with read access to both Code and Build
  • organization is your Azure DevOps Organization name or for Azure DevOps Server (on-premise) this will be your Collection name

Backend

Here's how to get the backend up and running:

  1. First we need to add the @backstage/plugin-azure-devops-backend package to your backend:

    # From the Backstage root directory
    cd packages/backend
    yarn add @backstage/plugin-azure-devops-backend
  2. Then we will create a new file named packages/backend/src/plugins/azure-devops.ts, and add the following to it:

    import { createRouter } from '@backstage/plugin-azure-devops-backend';
    import { Router } from 'express';
    import type { PluginEnvironment } from '../types';
    
    export default function createPlugin({
      logger,
      config,
    }: PluginEnvironment): Promise<Router> {
      return createRouter({ logger, config });
    }
  3. Next we wire this into the overall backend router, edit packages/backend/src/index.ts:

    import azureDevOps from './plugins/azuredevops';
    // ...
    async function main() {
      // ...
      const azureDevOpsEnv = useHotMemoize(module, () => createEnv('azure-devops'));
      apiRouter.use('/azure-devops', await azureDevOps(azureDevOpsEnv));
  4. Now run yarn start-backend from the repo root

  5. Finally open http://localhost:7000/api/azure-devops/health in a browser and it should return {"status":"ok"}

Frontend

To get the frontend 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:

    # From your Backstage root directory
    cd packages/app
    yarn add @backstage/plugin-azure-devops
  2. Second we need to add the EntityAzurePipelinesContent extension to the entity page in your app:

    // 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 = (
      <EntitySwitch>
        // ...
        <EntitySwitch.Case if={isAzureDevOpsAvailable}>
           // Set defaultLimit to the max number of builds you would like to be able to see
           // the default if not set is 10
           <EntityAzurePipelinesContent defaultLimit={25} />
        </EntitySwitch.Case>
        // ...
      </EntitySwitch>

Entity Annotation

You need to add the following annotation to any entities you want to be able to use the Azure Devops plugin with:

dev.azure.com/project-repo: <project-name>/<repo-name>

Let's break this down a little: <project-name> will be the name of your Team Project and <repo-name> will be the name of your repository which needs to be part of the Team Project you entered for <project-name>.

Here's what that will look like in action:

# 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
  # ...

Features

  • Lists the top n builds for a given repository where n is the value configured for top

Limitations

  • Currently multiple organizations is not supported
0.4.4

21 days ago

0.4.3

24 days ago

0.4.3-next.1

1 month ago

0.4.3-next.0

1 month ago

0.4.2

1 month ago

0.4.1

2 months ago

0.4.0

2 months ago

0.4.0-next.2

2 months ago

0.4.0-next.1

2 months ago

0.4.0-next.0

2 months ago

0.3.12

3 months ago

0.3.12-next.3

3 months ago

0.3.12-next.2

3 months ago

0.3.12-next.1

3 months ago

0.3.12-next.0

4 months ago

0.3.11

4 months ago

0.3.11-next.2

4 months ago

0.3.11-next.1

4 months ago

0.3.11-next.0

5 months ago

0.3.10

5 months ago

0.3.10-next.3

5 months ago

0.3.10-next.2

5 months ago

0.3.10-next.1

5 months ago

0.3.8-next.1

6 months ago

0.3.8-next.2

6 months ago

0.3.3-next.0

10 months ago

0.3.3-next.1

9 months ago

0.3.8-next.0

7 months ago

0.3.7-next.1

7 months ago

0.3.7-next.0

8 months ago

0.3.7-next.2

7 months ago

0.3.6-next.1

8 months ago

0.3.6-next.2

8 months ago

0.3.6-next.3

8 months ago

0.3.6

8 months ago

0.3.5

9 months ago

0.3.8

6 months ago

0.3.7

7 months ago

0.3.2

10 months ago

0.3.4

9 months ago

0.3.3

9 months ago

0.3.2-next.2

10 months ago

0.3.2-next.1

10 months ago

0.3.5-next.0

9 months ago

0.3.9

6 months ago

0.3.10-next.0

6 months ago

0.3.1-next.2

11 months ago

0.3.1-next.3

11 months ago

0.3.1

11 months ago

0.3.2-next.0

11 months ago

0.2.9-next.1

1 year ago

0.3.0-next.2

1 year ago

0.3.1-next.0

12 months ago

0.3.1-next.1

12 months ago

0.3.0

12 months ago

0.2.9-next.0

1 year ago

0.2.8-next.3

1 year ago

0.2.8

1 year ago

0.2.8-next.1

1 year ago

0.2.8-next.0

1 year ago

0.2.8-next.2

1 year ago

0.2.7-next.2

1 year ago

0.2.7-next.1

1 year ago

0.2.7-next.0

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5-next.2

1 year ago

0.2.5-next.1

1 year ago

0.2.6-next.0

1 year ago

0.2.6-next.1

1 year ago

0.2.6-next.2

1 year ago

0.2.5

1 year ago

0.2.5-next.0

1 year ago

0.2.3-next.2

1 year ago

0.2.3-next.1

1 year ago

0.2.3-next.0

1 year ago

0.2.3-next.4

1 year ago

0.2.3-next.3

1 year ago

0.2.2-next.1

2 years ago

0.2.2-next.0

2 years ago

0.2.1

2 years ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.4

1 year ago

0.2.1-next.1

2 years ago

0.2.1-next.2

2 years ago

0.2.1-next.0

2 years ago

0.2.0-next.3

2 years ago

0.2.0-next.2

2 years ago

0.2.0-next.1

2 years ago

0.2.0-next.0

2 years ago

0.2.0

2 years ago

0.1.22-next.1

2 years ago

0.1.22-next.0

2 years ago

0.1.24-next.1

2 years ago

0.1.24-next.0

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.23-next.3

2 years ago

0.1.23-next.2

2 years ago

0.1.23-next.1

2 years ago

0.1.23-next.0

2 years ago

0.1.21-next.2

2 years ago

0.1.21-next.0

2 years ago

0.1.21-next.1

2 years ago

0.1.21

2 years ago

0.1.18-next.0

2 years ago

0.1.20

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.20-next.1

2 years ago

0.1.20-next.0

2 years ago

0.1.17

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.14-next.0

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.6

2 years ago

0.1.13-next.0

2 years ago

0.1.11-next.0

2 years ago

0.1.16

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago