Back to Backstage

@backstage/plugin-scaffolder-backend-module-azure

plugins/scaffolder-backend-module-azure/README.md

1.51.0-next.24.7 KB
Original Source

@backstage/plugin-scaffolder-backend-module-azure

The Azure DevOps module for @backstage/plugin-scaffolder-backend.

This module provides scaffolder actions for Azure DevOps integration.

Installation

bash
# From your Backstage root directory
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-azure

Then add it to your backend:

ts
import { createBackend } from '@backstage/backend-defaults';

const backend = createBackend();

// ... other plugins

backend.add(import('@backstage/plugin-scaffolder-backend'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-azure'));

backend.start();

Actions

publish:azure

Initializes a git repository with the content in the workspace and publishes it to Azure DevOps.

Input Parameters

ParameterTypeRequiredDescription
repoUrlstringYesRepository URL in the format: dev.azure.com?organization=<org>&project=<project>&repo=<repo>
descriptionstringNoRepository description
defaultBranchstringNoDefault branch for the repository. Default: master
sourcePathstringNoPath within the workspace to use as repository root. If omitted, the entire workspace will be published
tokenstringNoPersonal Access Token for Azure DevOps authentication
gitCommitMessagestringNoInitial commit message. Default: initial commit
gitAuthorNamestringNoAuthor name for the commit. Default: Scaffolder
gitAuthorEmailstringNoAuthor email for the commit
signCommitbooleanNoSign the commit with the configured PGP private key

Output Parameters

ParameterTypeDescription
remoteUrlstringURL to the repository
repoContentsUrlstringURL to the root of the repository (web)
repositoryIdstringID of the created repository
commitHashstringGit commit hash of the initial commit

Examples

Basic usage:

yaml
steps:
  - id: publish
    action: publish:azure
    name: Publish to Azure DevOps
    input:
      repoUrl: 'dev.azure.com?organization=myorg&project=myproject&repo=myrepo'

With custom branch and commit message:

yaml
steps:
  - id: publish
    action: publish:azure
    name: Publish to Azure DevOps
    input:
      repoUrl: 'dev.azure.com?organization=myorg&project=myproject&repo=myrepo'
      defaultBranch: main
      gitCommitMessage: 'Initial project setup'

With author information:

yaml
steps:
  - id: publish
    action: publish:azure
    name: Publish to Azure DevOps
    input:
      repoUrl: 'dev.azure.com?organization=myorg&project=myproject&repo=myrepo'
      gitAuthorName: 'John Doe'
      gitAuthorEmail: '[email protected]'

Using a specific source path:

yaml
steps:
  - id: publish
    action: publish:azure
    name: Publish to Azure DevOps
    input:
      repoUrl: 'dev.azure.com?organization=myorg&project=myproject&repo=myrepo'
      sourcePath: 'packages/my-app'

With authentication token:

yaml
steps:
  - id: publish
    action: publish:azure
    name: Publish to Azure DevOps
    input:
      repoUrl: 'dev.azure.com?organization=myorg&project=myproject&repo=myrepo'
      token: ${{ secrets.AZURE_TOKEN }}

Configuration

To use this module, you need to configure Azure DevOps integration in your app-config.yaml:

yaml
integrations:
  azure:
    - host: dev.azure.com
      credentials:
        - personalAccessToken: ${AZURE_TOKEN}

For more information on Azure DevOps integration, see the Azure DevOps integration documentation.