Create PagerDuty Service

Action ID: pagerduty:service:create
NPM Package:

@pagerduty/backstage-plugin-scaffolder-actions

Description

Creates a new PagerDuty service with specified name, description, and escalation policy.

Input Schema

PropertyTypeDescriptionRequired
namestringName of the service
descriptionstringDescription of the service
alertGroupingstringAlert grouping parameters
escalationPolicyIdstringEscalation policy ID

Output Schema

PropertyTypeDescriptionRequired
serviceIdstringPagerDuty Service ID
serviceUrlstringPagerDuty Service URL
integrationKeystringBackstage Integration Key

Usage Examples

Basic service creation with required fields

Creates a PagerDuty service for a new component using the required inputs. Use this when you need a service created during initial scaffolding and want to log the resulting URL and ID. This example fetches project files with fetch:template and logs outputs with debug:log.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        componentId: ${{ parameters.componentId }}
        description: ${{ parameters.description }}

  - id: pdService
    action: pagerduty:service:create
    input:
      name: ${{ parameters.componentId }}
      description: ${{ parameters.description }}
      escalationPolicyId: ${{ parameters.pagerdutyEscalationPolicyId }}

  - id: log-pd
    action: debug:log
    input:
      message: "PagerDuty service created: ${{ steps.pdService.outputs.serviceUrl }} (id ${{ steps.pdService.outputs.serviceId }})"

Service with intelligent alert grouping

Creates a PagerDuty service with intelligent alert grouping enabled. Use this when the service is expected to produce high-volume alerts and you want PagerDuty to group related events.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        name: ${{ parameters.componentId }}-${{ parameters.environment }}
        owner: ${{ parameters.owner }}

  - id: pdService
    action: pagerduty:service:create
    input:
      name: ${{ parameters.componentId }}-${{ parameters.environment }}
      description: "${{ parameters.componentId }} service for ${{ parameters.environment }} environment"
      escalationPolicyId: ${{ parameters.pagerdutyEscalationPolicyId }}
      alertGrouping: intelligent

  - id: log-pd
    action: debug:log
    input:
      message: "PD integration key created for service ${{ steps.pdService.outputs.serviceId }}"

Create separate services for staging and production

Creates two PagerDuty services for the same component, one for staging and one for production, each with its own escalation policy. Use this when environments have different on-call rotations.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        componentId: ${{ parameters.componentId }}

  - id: pdStaging
    action: pagerduty:service:create
    input:
      name: "${{ parameters.componentId }}-staging"
      description: "Staging environment for ${{ parameters.componentId }}"
      escalationPolicyId: "PSTAGE12" # example staging escalation policy ID

  - id: pdProd
    action: pagerduty:service:create
    input:
      name: "${{ parameters.componentId }}-prod"
      description: "Production environment for ${{ parameters.componentId }}"
      escalationPolicyId: "PPROD987" # example production escalation policy ID
      alertGrouping: time

  - id: log-pd
    action: debug:log
    input:
      message: |
        Staging PD: ${{ steps.pdStaging.outputs.serviceUrl }} (id ${{ steps.pdStaging.outputs.serviceId }})
        Production PD: ${{ steps.pdProd.outputs.serviceUrl }} (id ${{ steps.pdProd.outputs.serviceId }})

Create a service and render the integration key into deployment values

Creates a PagerDuty service and then writes the integration key into a Helm values file using a follow-up fetch:template overlay. Use this to wire the PD integration into your deploy pipeline.

Copy
steps:
  - id: fetch-app
    action: fetch:template
    input:
      url: ./app
      targetPath: .
      values:
        componentId: ${{ parameters.componentId }}
        owner: ${{ parameters.owner }}

  - id: pdService
    action: pagerduty:service:create
    input:
      name: "${{ parameters.componentId }}-prod"
      description: "Production service for ${{ parameters.componentId }}"
      escalationPolicyId: ${{ parameters.pagerdutyEscalationPolicyId }}
      alertGrouping: time

  - id: render-pagerduty-values
    action: fetch:template
    input:
      url: ./overlays/pagerduty
      targetPath: ./deploy
      values:
        serviceName: "${{ parameters.componentId }}-prod"
        pdIntegrationKey: ${{ steps.pdService.outputs.integrationKey }}
        pdServiceUrl: ${{ steps.pdService.outputs.serviceUrl }}

  - id: log-pd
    action: debug:log
    input:
      message: "Wrote PD integration for ${{ parameters.componentId }} to ./deploy values"

Team-owned component with time-based alert grouping and catalog metadata

Creates a PagerDuty service with time-based alert grouping and renders catalog metadata that includes the PD service URL, using fetch:template. Use this when you want the Backstage catalog file to reference the created PD service.

Copy
steps:
  - id: pdService
    action: pagerduty:service:create
    input:
      name: "${{ parameters.owner }}-${{ parameters.componentId }}"
      description: "Owned by ${{ parameters.owner }}. PagerDuty service for ${{ parameters.componentId }}"
      escalationPolicyId: "PEXP1234"
      alertGrouping: time

  - id: render-catalog
    action: fetch:template
    input:
      url: ./catalog
      targetPath: .
      values:
        componentId: ${{ parameters.componentId }}
        owner: ${{ parameters.owner }}
        pagerDutyServiceUrl: ${{ steps.pdService.outputs.serviceUrl }}

  - id: log-pd
    action: debug:log
    input:
      message: "Catalog prepared with PD URL for ${{ parameters.componentId }}: ${{ steps.pdService.outputs.serviceUrl }}"