0.1.0 • Published 1 year ago

@kellyson/plugin-pact-broker v0.1.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
1 year ago

Pact-Broker Plugin

Website: https://docs.pact.io/

Screenshots

Setup

  1. If you have a standalone app (you didn't clone this repo), then do
# From your Backstage root directory
yarn add --cwd packages/app @backstage/plugin-pact-broker
  1. Add the EntityPactBrokerContentTab extension to the entity page in your app:
// In packages/app/src/components/catalog/EntityPage.tsx
import {
  EntityPactBrokerContentTab,
  isPactBrokerAvailable,
} from '@backstage/plugin-pact-broker';

// For example in the website entity section
const websiteEntityPage = (
  <EntityLayout>
    
    ...

    <EntityLayout.Route if={isPactBrokerAvailable} path="/pact-broker-frontend" title="Pacts">
      <EntityPactBrokerContent />
    </EntityLayout.Route> 

  </EntityLayout>
  1. Add proxy config:
  • If you are using Pactflow service:
# In app-config.yaml
proxy:
  '/pactbroker':
    target: https://{ACCOUNT_NAME}.pactflow.io # by example: https://xyz.pactflow.io
    headers:
      Authorization: Bearer {PACTFLOW_API_TOKEN}

Note: Get and provide a PACTFLOW_API_TOKEN as an environment variable (see the Pactflow docs).

  • If you are using self-hosting Pact Broker:
# In app-config.yaml
'/pactbroker':
    target: {YOUR_PACT_BROKER_URL_HOST} # by example: http:// localhost:9080
    headers:
      Authorization: Basic {PACT_BROKER_TOKEN}

Note: Get and provide a PACT_BROKER_TOKEN as an environment variable (see the RFC 7617).

  1. Add an annotation to your respective catalog-info.yaml files, with the format pactbroker/consumer-provider: <consumerName>:<providerName> (See reference in ADR002).
# Example catalog-info.yaml entity definition file
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  # ...
  annotations:
    pactbroker/consumer-provider: 'ExampleApp-ExampleAPI'
spec:
  type: service
  # ...

Features

  • List all published pacts between consumer and provider
  • Pagination for pacts