Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Backstage Template for Postman Metadata #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use the official lightweight Node.js 14 image.
# https://hub.docker.com/_/node
FROM node:14-slim

# Create and change to the app directory.
WORKDIR /usr/src/app

# Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change.
COPY packages/postman-backend/package*.json ./

# Install production dependencies.
RUN npm install --only=production

# Copy local code to the container image.
COPY packages/postman-backend/ ./

# Copy the new backstage template file into the Docker image
COPY templates/api-creation-postman-template.yaml /templates/

EXPOSE 7000

# Run the web service on container startup.
CMD [ "npm", "start" ]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ This plugin is designed to integrate Postman functionality into your Backstage a
- [Collections (Use collection tag or IDs)](#collections-use-collection-tag-or-ids)
- [Monitors (Use monitor ID or name)](#monitors-use-monitor-id-or-name)

## New Backstage Template for Postman Integration

To streamline the process of integrating Postman with Backstage, we have introduced a new Backstage template named `api-creation-postman-template.yaml`. This template simplifies the setup process by providing a pre-configured structure for adding Postman metadata to your Backstage entities.

### How to Use the Template

To use the `api-creation-postman-template.yaml` template, follow these steps:

1. Ensure the template file is located in your repository's `templates` directory.
2. When creating a new API entity in Backstage, select the `api-creation-postman-template.yaml` from the list of available templates.
3. Fill in the required fields, such as API name, workspace ID, and repository URL. The template includes comments to guide you through this process.
4. Once the entity is created, the Postman metadata will be automatically integrated, allowing for seamless interaction with Postman resources directly from Backstage.

For more information and to view the template, please refer to the [api-creation-postman-template.yaml](templates/api-creation-postman-template.yaml) file in the repository.

This new template aims to make the integration of Postman metadata into Backstage entities as straightforward as possible, reducing the manual effort required and ensuring a consistent approach across your Backstage instance.

# Disclaimer and Plugin Compatibility
These backstage plugins are not officially supported by Postman and are intended for Backstage users to integrate Postman into their API documentation easily.
Expand Down
69 changes: 69 additions & 0 deletions templates/api-creation-postman-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
apiVersion: backstage.io/v1beta2
kind: Template
metadata:
name: api-creation-postman-template
title: Postman API Creation
description: Template for creating APIs with Postman metadata in Backstage
spec:
owner: team-postman
type: service

parameters:
- title: API Information
required:
- name
- description
- owner
properties:
name:
title: Name
type: string
description: Unique name of the API
description:
title: Description
type: string
description: Description of the API
owner:
title: Owner
type: string
description: Owner of the API (team or individual)

- title: Postman Metadata
required:
- apiId
- collectionId
- monitorId
properties:
apiId:
title: API ID
type: string
description: The ID of the API in Postman
collectionId:
title: Collection ID
type: string
description: The ID of the Postman collection associated with this API
monitorId:
title: Monitor ID
type: string
description: The ID of the Postman monitor associated with this API

steps:
- id: fetch-base
name: Fetch Base Template
action: fetch:template
input:
url: ./template.yaml
values:
name: '{{ parameters.name }}'
description: '{{ parameters.description }}'
owner: '{{ parameters.owner }}'
apiId: '{{ parameters.apiId }}'
collectionId: '{{ parameters.collectionId }}'
monitorId: '{{ parameters.monitorId }}'

- id: register
name: Register the API in Backstage
action: catalog:register
input:
repoContentsUrl: '{{ parameters.repoContentsUrl }}'
catalogInfoPath: '/catalog-info.yaml'