Merge branch 'master' into feature/gitlab-auth-provider

This commit is contained in:
Tom Opdebeeck
2021-08-13 11:32:11 +02:00
1006 changed files with 26541 additions and 9608 deletions
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-app-api': patch
---
Fix a bug in `FlatRoutes` that prevented outlets from working with the root route, as well as matching root routes too broadly.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-import': patch
---
Fix importing yaml files from URLs with trailing query parameters.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
chore: bump `eslint` to `7.30.0`
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-xcmetrics': patch
---
Enable browsing detailed build information such as host configuration, errors, warnings, metadata and a timeline for all targets
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Add Buffer to `ProvidePlugin` since this is no longer provided in `webpack@5`
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-jenkins': patch
---
Make `isJenkinsAvailable` recognise both the old and the new Jenkins annotation.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-xcmetrics': patch
---
Internal refactoring
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
- Move out the `cookiecutter` templating to its own module that is depended on by the `scaffolder-backend` plugin. No breaking change yet, but we will drop first class support for `cookiecutter` in the future and it will become an opt-in feature.
@@ -1,5 +0,0 @@
---
'@backstage/plugin-techdocs': patch
---
Handle error responses in `getTechDocsMetadata` and `getEntityMetadata` such that `<TechDocsPageHeader>` doesn't throw errors.
-8
View File
@@ -1,8 +0,0 @@
---
'@backstage/create-app': patch
'@backstage/plugin-scaffolder-backend': patch
---
Moved sample software templates to the [backstage/software-templates](https://github.com/backstage/software-templates) repository. If you previously referenced the sample templates straight from `scaffolder-backend` plugin in the main [backstage/backstage](https://github.com/backstage/backstage) repository in your `app-config.yaml`, these references will need to be updated.
See https://github.com/backstage/software-templates
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/backend-common': patch
'@backstage/integration': patch
---
Add AWS S3 URL Reader
+7
View File
@@ -1,5 +1,6 @@
abc
accessors
Anddddd
Apdex
api
Api
@@ -14,6 +15,7 @@ Avro
backrub
Bigtable
Billett
Bitbucket
Bitrise
Blackbox
bool
@@ -74,6 +76,7 @@ dockerode
Docusaurus
env
Env
elasticsearch
esbuild
eslint
etag
@@ -82,6 +85,8 @@ facto
failover
Fargate
Figma
firehydrant
FireHydrant
Firekube
Fiverr
gitbeaker
@@ -212,6 +217,7 @@ repos
rerender
Reusability
reusability
roadmaps
rollbar
Rollbar
Rollup
@@ -220,6 +226,7 @@ Routable
rst
rsync
ruleset
runbook
sam
sanitization
scaffolded
@@ -50,4 +50,5 @@ jobs:
# projetToken intentionally shared to allow collaborators to run Chromatic on forks
# https://www.chromatic.com/docs/custom-ci-provider#run-chromatic-on-external-forks-of-open-source-projects
projectToken: 9tzak77m9nj
storybookBuildDir: 'packages/storybook/dist'
workingDir: 'packages/storybook'
storybookBuildDir: 'dist'
+1 -1
View File
@@ -109,7 +109,7 @@ jobs:
run: node scripts/verify-links.js
- name: prettier
run: yarn prettier:check
run: yarn prettier:check '!ADOPTERS.md'
- name: lock
run: yarn lock:check
+7
View File
@@ -25,6 +25,13 @@ jobs:
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
steps:
# In order to have the create-app template function as if it was downloaded from NPM
# we need to make sure we checkout files with LF line endings only
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2
- name: use node.js ${{ matrix.node-version }}
+54
View File
@@ -0,0 +1,54 @@
name: Prettier
on:
push:
branches:
- master
jobs:
autofix-markdown:
name: Autofix Markdown files using Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Fetch changes to previous commit - required for 'only_changed' in Prettier action
fetch-depth: 0
# Beginning of yarn setup, keep in sync between all workflows, see ci.yml
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: cache all node_modules
id: cache-modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-v${{ matrix.node-version }}-node_modules-${{ hashFiles('yarn.lock', '**/package.json') }}
- name: find location of global yarn cache
id: yarn-cache
if: steps.cache-modules.outputs.cache-hit != 'true'
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: cache global yarn cache
uses: actions/cache@v2
if: steps.cache-modules.outputs.cache-hit != 'true'
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install
run: yarn install --frozen-lockfile
# End of yarn setup
- name: Run Prettier on ADOPTERS.md
uses: creyD/prettier_action@v3.1
with:
# Modifies commit only if prettier autofixed the ADOPTERS.md
prettier_options: --config docs/prettier.config.js --write ADOPTERS.md
only_changed: true
commit_message: 'Autofix ADOPTERS.md using Prettier'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1 -3
View File
@@ -1,5 +1,3 @@
{
"ignoredFiles": [
"docs/assets/**/*.svg"
]
"ignoredFiles": ["docs/assets/**/*.svg"]
}
+44 -40
View File
@@ -1,40 +1,44 @@
| Organization | Contact | Description of Use |
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Spotify](https://www.spotify.com) | [@leemills83](https://github.com/leemills83) | Main interface towards all of Spotify's infrastructure and technical documentation. |
| [bol.com](https://www.bol.com) | [@sagacity](https://github.com/sagacity) | Initial work being done to unify platform tooling. |
| [DFDS](https://www.dfds.com) | [@carlsendk](https://github.com/carlsendk) | V2 self-service platform. |
| [Roadie](https://roadie.io) | [@dtuite](https://github.com/dtuite) | Hosted, managed Backstage with easy set-up |
| [Roku](https://www.roku.com) | [@timurista](https://github.com/timurista) | Initial work on Cloud engineering service platform. |
| [SDA SE](https://sda.se) | [@Fox32](https://github.com/Fox32) | Central place for developing and sharing services in our insurance ecosystem. |
| [H-E-B](https://www.heb.com) | [@german-j-rodriguez](https://github.com/german-j-rodriguez) | Initial work on Engineering Portal service platform. |
| [American Airlines](https://www.aa.com) | [@paulpach](https://github.com/paulpach) | Central place for developers to develop and maintain applications |
| [Kiwi.com](https://kiwi.com) | [@aexvir](https://github.com/aexvir) | Replacing the frontend of [The Zoo](https://github.com/kiwicom/the-zoo), their service registry. |
| [Voi](https://www.voiscooters.com/) | [@K-Phoen](https://github.com/K-Phoen) | Developer portal, main gateway to our infrastructure, documentation and internal tooling. |
| [Talkdesk](https://www.talkdesk.com) | [@jaime-talkdesk](https://github.com/jaime-talkdesk) | Initial work for Engineering Portal and Self Provisioning to R&D |
| [Wealthsimple](https://www.wealthsimple.com) | [@andrewthauer](https://github.com/andrewthauer) | Developer portal, service catalog, documentation and tooling |
| [Grab](https://www.grab.com) | [@althafh](https://github.com/althafh) | Initial work as a unified interface for all of Grab's internal tooling |
| [Telenor Sweden](https://www.telenor.se) | [@O5ten](https://github.com/O5ten) | Building a developer portal for scaffolding projects towards our unified build environment and microservice stacks |
| [Fiverr](https://www.fiverr.com) | [@nirga](https://github.com/nirga) | Unifying separate tools that developers are using today (i.e. monitoring, dead letter queues management, etc.) into a single platform. |
| [Zalando SE](https://www.zalando.de) | [@leviferreira](https://github.com/leviferreira) | Building V2 of the Internal Development Portal. |
| [LegalZoom](https://legalzoom.com) | [@backjo](https://github.com/backjo) | Developer portal - hub for all engineering projects and metadata. |
| [Expedia Group](https://www.expediagroup.com) | [Mike Turner](mailto:miturner@expediagroup.com), [Sneha Kumar](mailto:snkumar@expediagroup.com), [@guillermomanzo](https://github.com/guillermomanzo), [Erik Lindgren](https://github.com/lindgren) | EG Common Developer Toolkit |
| [Paddle.com](https://paddle.com) | [Ioannis Georgoulas](https://github.com/geototti21) | Developer portal (Tech Docs, Service Catalog, Internal Tooling), we use vanilla Backstage FE and custom BE implementation in Go |
| [Acast.com](https://acast.com) | [Olle Lundberg](https://github.com/lndbrg) | Developer portal with tech docs, service catalog and a bunch of other internal tooling |
| [Lunar](https://lunar.app) | [Jacob Valdemar](https://github.com/JacobValdemar) | Internal developer portal for service overview and insights, API documentation, technical guides, onboarding guides and RFC's. |
| [Trendyol](https://trendyol.com) | [Erdogan Oksuz](https://github.com/erdoganoksuz) | The Developer Portal has been called `Pandora`. Provides an overview of Trendyol tech ecosystem. TechDocs, Catalog, Custom Plugins and Theme. |
| [Peloton](https://www.onepeloton.com/) | [Jim Haughwout](https://github.com/JimHaughwout) | Creating our first developer portal and tech-docs. Exploring Service Catalog, Tech Insights and Cost Insights as well. |
| [TELUS](https://telus.com) | [Seb Barre](https://github.com/sbarre) | The Go-to place to find answers about development and delivery at TELUS. |
| [Brex](https://www.brex.com/) | [Vamsi Chitters](https://github.com/vamsikc) | A centralized UI to understand how a service fits in the whole Brex architecture and manage a teams engineering dependencies. |
| [Oriflame](https://www.oriflame.com/) | [Oriflame](https://github.com/oriflame) | Internal developer portal for services, single page apps and packages overview, API documentation, technical guides, tech-radar and more. |
| [Booz Allen Hamilton](https://www.boozallen.com/) | [Jason Miller](https://github.com/JasonMiller-BAH) | Developer portal for a full-stack software development ecosystem that accelerates consistent and repeatable Modern Software Development practices for internal innovation and investments. |
| [Netflix](https://www.netflix.com/) | [bleathem](https://github.com/bleathem) | Our Backstage implementation will be the front door to a unified experience connecting our internal platform products across important workflows with integrated knowledge and support. |
| [b.well](https://www.icanbwell.com/) | [Jacob Rosales](https://github.com/jrosales) | Foundation for our engineering portal and cloud insights. |
| [PagerDuty](https://www.pagerduty.com/) | [Mark Shaw](https://github.com/markshawtoronto) | Developer portal, initially focused on software templates and tech-docs. |
| [MoonShiner](https://moonshiner.at) | [Fabian Hippmann](https://github.com/FabianHippmann) | Developer portal - helps us keep track of our customer projects, onboard new developers & improve our development process 🌕🚀🧑‍🚀 |
| [FundApps](https://www.fundapps.co/) | [Elliot Greenwood](https://github.com/egnwd) | Developer Portal - A place for us to keep track of our projects and documentation for all services and processes |
| [DAZN](https://dazn.com/) | [Lou Bichard](https://twitter.com/loujaybee), [Marco Crivellaro](https://github.com/crivetechie), [Alex Hollerith](mailto:alex.hollerith@dazn.com) | Ingesting all of DAZN's repos for the catalog, migrating our internal platform apps (pull request boards, release information, inner source marketplace etc) to Backstage plugins (where applicable). |
| [HelloFresh](https://www.hellofresh.de/) | [@iammuho](https://github.com/iammuho), [@ElenaForester](https://github.com/ElenaForester), [@diegomarangoni](https://github.com/diegomarangoni) | Our developer portal at HelloFresh - Spread across an organisation of 500+ engineers globally. |
| [FactSet](https://www.factset.com/) | [@kuangp](https://github.com/kuangp) | Developer portal to provide discoverability to all internal components, APIs, documentation, and scaffold templates with integrations to our internal infrastructure tools. |
| [Workrise](https://www.workrise.com/) | [Michael Rode](https://github.com/michaelrode) | Developer portal, main gateway to our infrastructure, documentation and internal tooling. |
| [RedVentures](https://www.redventures.com/) | [Chris Diaz](https://github.com/codingdiaz) | Developer portal that brings everything an engineer needs to provide value into a single pane of glass. |
| [MavTek](https://www.mavtek.com/) | [@fgascon](https://github.com/fgascon) | Developer portal focused on standardizing practices, centralizing documentation and streamlining developer practices. |
| Organization | Contact | Description of Use |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Spotify](https://www.spotify.com) | [@leemills83](https://github.com/leemills83) | Main interface towards all of Spotify's infrastructure and technical documentation. |
| [bol.com](https://www.bol.com) | [@sagacity](https://github.com/sagacity) | Initial work being done to unify platform tooling. |
| [DFDS](https://www.dfds.com) | [@carlsendk](https://github.com/carlsendk) | V2 self-service platform. |
| [Roadie](https://roadie.io) | [@dtuite](https://github.com/dtuite) | Hosted, managed Backstage with easy set-up |
| [Roku](https://www.roku.com) | [@timurista](https://github.com/timurista) | Initial work on Cloud engineering service platform. |
| [SDA SE](https://sda.se) | [@Fox32](https://github.com/Fox32) | Central place for developing and sharing services in our insurance ecosystem. |
| [H-E-B](https://www.heb.com) | [@german-j-rodriguez](https://github.com/german-j-rodriguez) | Initial work on Engineering Portal service platform. |
| [American Airlines](https://www.aa.com) | [@paulpach](https://github.com/paulpach) | Central place for developers to develop and maintain applications |
| [Kiwi.com](https://kiwi.com) | [@aexvir](https://github.com/aexvir) | Replacing the frontend of [The Zoo](https://github.com/kiwicom/the-zoo), their service registry. |
| [Voi](https://www.voiscooters.com/) | [@K-Phoen](https://github.com/K-Phoen) | Developer portal, main gateway to our infrastructure, documentation and internal tooling. |
| [Talkdesk](https://www.talkdesk.com) | [@jaime-talkdesk](https://github.com/jaime-talkdesk) | Initial work for Engineering Portal and Self Provisioning to R&D |
| [Wealthsimple](https://www.wealthsimple.com) | [@andrewthauer](https://github.com/andrewthauer) | Developer portal, service catalog, documentation and tooling |
| [Grab](https://www.grab.com) | [@althafh](https://github.com/althafh) | Initial work as a unified interface for all of Grab's internal tooling |
| [Telenor Sweden](https://www.telenor.se) | [@O5ten](https://github.com/O5ten) | Building a developer portal for scaffolding projects towards our unified build environment and microservice stacks |
| [Fiverr](https://www.fiverr.com) | [@nirga](https://github.com/nirga) | Unifying separate tools that developers are using today (i.e. monitoring, dead letter queues management, etc.) into a single platform. |
| [Zalando SE](https://www.zalando.de) | [@leviferreira](https://github.com/leviferreira) | Building V2 of the Internal Development Portal. |
| [LegalZoom](https://legalzoom.com) | [@backjo](https://github.com/backjo) | Developer portal - hub for all engineering projects and metadata. |
| [Expedia Group](https://www.expediagroup.com) | [Mike Turner](mailto:miturner@expediagroup.com), [Sneha Kumar](mailto:snkumar@expediagroup.com), [@guillermomanzo](https://github.com/guillermomanzo), [Erik Lindgren](https://github.com/lindgren) | EG Common Developer Toolkit |
| [Paddle.com](https://paddle.com) | [Ioannis Georgoulas](https://github.com/geototti21) | Developer portal (Tech Docs, Service Catalog, Internal Tooling), we use vanilla Backstage FE and custom BE implementation in Go |
| [Acast.com](https://acast.com) | [Olle Lundberg](https://github.com/lndbrg) | Developer portal with tech docs, service catalog and a bunch of other internal tooling |
| [Lunar](https://lunar.app) | [Jacob Valdemar](https://github.com/JacobValdemar) | Internal developer portal for service overview and insights, API documentation, technical guides, onboarding guides and RFC's. |
| [Trendyol](https://trendyol.com) | [Erdogan Oksuz](https://github.com/erdoganoksuz) | The Developer Portal has been called `Pandora`. Provides an overview of Trendyol tech ecosystem. TechDocs, Catalog, Custom Plugins and Theme. |
| [Peloton](https://www.onepeloton.com/) | [Jim Haughwout](https://github.com/JimHaughwout) | Creating our first developer portal and tech-docs. Exploring Service Catalog, Tech Insights and Cost Insights as well. |
| [TELUS](https://telus.com) | [Seb Barre](https://github.com/sbarre) | The Go-to place to find answers about development and delivery at TELUS. |
| [Brex](https://www.brex.com/) | [Vamsi Chitters](https://github.com/vamsikc) | A centralized UI to understand how a service fits in the whole Brex architecture and manage a teams engineering dependencies. |
| [Oriflame](https://www.oriflame.com/) | [Oriflame](https://github.com/oriflame) | Internal developer portal for services, single page apps and packages overview, API documentation, technical guides, tech-radar and more. |
| [Booz Allen Hamilton](https://www.boozallen.com/) | [Jason Miller](https://github.com/JasonMiller-BAH) | Developer portal for a full-stack software development ecosystem that accelerates consistent and repeatable Modern Software Development practices for internal innovation and investments. |
| [Netflix](https://www.netflix.com/) | [bleathem](https://github.com/bleathem) | Our Backstage implementation will be the front door to a unified experience connecting our internal platform products across important workflows with integrated knowledge and support. |
| [b.well](https://www.icanbwell.com/) | [Jacob Rosales](https://github.com/jrosales) | Foundation for our engineering portal and cloud insights. |
| [PagerDuty](https://www.pagerduty.com/) | [Mark Shaw](https://github.com/markshawtoronto) | Developer portal, initially focused on software templates and tech-docs. |
| [MoonShiner](https://moonshiner.at) | [Fabian Hippmann](https://github.com/FabianHippmann) | Developer portal - helps us keep track of our customer projects, onboard new developers & improve our development process 🌕🚀🧑‍🚀 |
| [FundApps](https://www.fundapps.co/) | [Elliot Greenwood](https://github.com/egnwd) | Developer Portal - A place for us to keep track of our projects and documentation for all services and processes |
| [DAZN](https://dazn.com/) | [Lou Bichard](https://twitter.com/loujaybee), [Marco Crivellaro](https://github.com/crivetechie), [Alex Hollerith](mailto:alex.hollerith@dazn.com) | Ingesting all of DAZN's repos for the catalog, migrating our internal platform apps (pull request boards, release information, inner source marketplace etc) to Backstage plugins (where applicable). |
| [HelloFresh](https://www.hellofresh.de/) | [@iammuho](https://github.com/iammuho), [@ElenaForester](https://github.com/ElenaForester), [@diegomarangoni](https://github.com/diegomarangoni) | Our developer portal at HelloFresh - Spread across an organisation of 500+ engineers globally. |
| [FactSet](https://www.factset.com/) | [@kuangp](https://github.com/kuangp) | Developer portal to provide discoverability to all internal components, APIs, documentation, and scaffold templates with integrations to our internal infrastructure tools. |
| [Workrise](https://www.workrise.com/) | [Michael Rode](https://github.com/michaelrode) | Developer portal, main gateway to our infrastructure, documentation and internal tooling. |
| [RedVentures](https://www.redventures.com/) | [Chris Diaz](https://github.com/codingdiaz) | Developer portal that brings everything an engineer needs to provide value into a single pane of glass. |
| [MavTek](https://www.mavtek.com/) | [@fgascon](https://github.com/fgascon) | Developer portal focused on standardizing practices, centralizing documentation and streamlining developer practices. |
| [QuintoAndar](https://www.quintoandar.com.br/) | [@quintoandar](https://github.com/quintoandar) | Developer portal, services catalog and centralization of service metrics. |
| [empathy.co](https://empathy.co/) | [@guillermotti](https://github.com/guillermotti) | Developer portal for tech docs, service catalog, plugin discovery and much more. |
| [creditas.com](https://creditas.com/) | [@aureliosaraiva](https://github.com/aureliosaraiva) [@Creditas](https://github.com/creditas) | Centralization of all services, standards, documentation, etc. We started the deployment process. |
| [Prisjakt](https://www.prisjakt.nu) / [PriceSpy](https://pricespy.co.uk) | [@kennylindahl](https://github.com/kennylindahl) | Internal developer portal - Documentation, scaffolding, software catalog, TechRadar, Gitlab org data integration |
+1 -1
View File
@@ -116,7 +116,7 @@ In general, changesets are not needed for the documentation, build utilities, co
1. Run `yarn changeset`
2. Select which packages you want to include a changeset for
3. Select impact of change that you're introducing (patch, minor, or major)
3. Select impact of change that you're introducing, using `minor` for breaking changes and `patch` otherwise. We do not use `major` changes while packages are at version `0.x`.
4. Add generated changeset to Git
5. Push the commit with your changeset to the branch associated with your PR
6. Accept our gratitude for making the release process easier on the maintainers
+6 -2
View File
@@ -2,8 +2,6 @@
# [Backstage](https://backstage.io)
_During the month of July the majority of the maintainers will be on summer vacation 🏖️ Development will continue as usual, but expect a slower pace for discussions and PR reviews. Why not take this opportunity to [build a plugin](https://backstage.io/docs/plugins/)?_
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![CNCF Status](https://img.shields.io/badge/cncf%20status-sandbox-blue.svg)](https://www.cncf.io/projects)
[![Main CI Build](https://github.com/backstage/backstage/workflows/Main%20Master%20Build/badge.svg)](https://github.com/backstage/backstage/actions?query=workflow%3A%22Main+Master+Build%22)
@@ -63,3 +61,9 @@ Check out [the documentation](https://backstage.io/docs/getting-started) on how
Copyright 2020-2021 © The Backstage Authors. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page: https://www.linuxfoundation.org/trademark-usage
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
## Security
Please report sensitive security issues via Spotify's [bug-bounty program](https://hackerone.com/spotify) rather than GitHub.
For further details please see our complete [security release process](SECURITY.md).
+17
View File
@@ -9,3 +9,20 @@
## Reporting a Vulnerability
Please report sensitive security issues via Spotify's [bug-bounty program](https://hackerone.com/spotify) rather than GitHub.
If you have questions about a potential vulnerability, please reach out on Discord by asking for a maintainer in the `#support` channel, or via direct message to a maintainer.
## Remediation and Notification Process
Vulnerabilities are handled and published through [GitHub Security Advisories](https://docs.github.com/en/code-security/security-advisories/about-github-security-advisories).
In the event of a vulnerability the runbook for the maintainers is as follows:
1. Create a [new draft security advisory](https://github.com/backstage/backstage/security/advisories/new). The values and descriptions don't need to be perfect to begin with as they can be edited later. For severity, use the "Assess severity using CVSS" and refer to [the guide](https://www.first.org/cvss/v3.1/user-guide) for help.
2. Request a CVE identification number. It can take up to 72h for one to be assigned so be sure to do this early on.
3. If there is not already a patch for the vulnerability, collaborate on one in a private fork:
1. Head to the security advisory on GitHub and [create a private fork](https://docs.github.com/en/code-security/security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-security-vulnerability)
1. [Invite any collaborators](https://docs.github.com/en/code-security/security-advisories/adding-a-collaborator-to-a-security-advisory) from outside the maintainer team that should be part of creating a fix.
1. Create one or multiple Pull Requests with fixes towards the fork. Note that these PRs will not have CI checks run on them, so more care should be taken to run local validation. The PRs are also not merged like normal PRs, but are instead merged straight into the main repo all at once when the merge button is hit on the security advisory.
4. Once the fix is ready in a PR or private fork and it is time to release it, there are a couple of options. Either merge into the main branch with a changeset and wait for a regular release, or do a quick release by manually bumping the version in `package.json` of the affected package, along with a manual `CHANGELOG.md` entry. Note that a quick release will only work if the package does not have any other pending changes that depend on pending changes in other packages, so be sure to manually check that first, and fall back to an early regular release if needed. In general it's best to stick with the regular release flow, with the quick release being used only for time sensitive fixes.
5. Finalize and publish the security advisory. Note that once you hit the publish button it's no longer possible to edit the advisory. Just like the CVE number this can take up to 72h, and expect it to be slower than the CVE number request.
+14 -3
View File
@@ -152,12 +152,21 @@ integrations:
- host: bitbucket.org
username: ${BITBUCKET_USERNAME}
appPassword: ${BITBUCKET_APP_PASSWORD}
### Example for how to add your bitbucket server instance using the API:
# - host: server.bitbucket.com
# apiBaseUrl: server.bitbucket.com
# username: ${BITBUCKET_SERVER_USERNAME}
# appPassword: ${BITBUCKET_SERVER_APP_PASSWORD}
azure:
- host: dev.azure.com
token: ${AZURE_TOKEN}
# googleGcs:
# clientEmail: 'example@example.com'
# privateKey: ${GCS_PRIVATE_KEY}
# googleGcs:
# clientEmail: 'example@example.com'
# privateKey: ${GCS_PRIVATE_KEY}
awsS3:
- host: amazonaws.com
accessKeyId: ${AWS_ACCESS_KEY_ID}
secretAccessKey: ${AWS_SECRET_ACCESS_KEY}
catalog:
rules:
@@ -256,6 +265,8 @@ scaffolder:
# defaultAuthor:
# name: Scaffolder
# email: scaffolder@backstage.io
# Use to customize the default commit message when new components are created
# defaultCommitMessage: 'Initial commit'
github:
token: ${GITHUB_TOKEN}
visibility: public # or 'internal' or 'private'
+1 -1
View File
@@ -15,7 +15,7 @@ metadata:
url: https://discord.com/invite/EBHEGzX
annotations:
github.com/project-slug: backstage/backstage
backstage.io/techdocs-ref: url:https://github.com/backstage/backstage
backstage.io/techdocs-ref: dir:.
lighthouse.com/website-url: https://backstage.io
spec:
type: library
@@ -8,7 +8,6 @@
# simply copies in the build output into the image. If you want to also perform
# the build itself inside docker, use Dockerfile.build in this folder instead.
# USAGE:
#
# - Copy this file and the "docker" folder from this directory to your project
@@ -23,7 +22,7 @@
#
# yarn install
# yarn tsc
# yarn build --config <config1> --config <config2> ...
# yarn workspace app build --config <config1> --config <config2> ...
# docker build -t backstage-frontend -f Dockerfile.hostbuild .
@@ -38,4 +37,3 @@ COPY docker/default.conf.template /etc/nginx/templates/default.conf.template
COPY docker/inject-config.sh /docker-entrypoint.d/40-inject-config.sh
ENV PORT 80
+1 -1
View File
@@ -5,7 +5,7 @@ image](https://backstage.io/docs/getting-started/deployment-docker); this
tutorial shows how to deploy that Docker image to AWS using Elastic Container
Registry (ECR) and Elastic Kubernetes Service (EKS). Amazon also supports
deployments with Helm, covered in the [Helm
Kubernetes](../kubernetes/basic_kubernetes_example_with_helm) example.
Kubernetes](../../kubernetes/basic_kubernetes_example_with_helm) example.
The basic workflow for this method is to build a Backstage Docker image, upload
the new version to a container registry, and update a Kubernetes deployment with
+1 -3
View File
@@ -244,9 +244,7 @@ export interface OAuthProviderHandlers {
req: express.Request,
options: Record<string, string>,
): Promise<RedirectInfo>;
handler(
req: express.Request,
): Promise<{
handler(req: express.Request): Promise<{
response: AuthResponse<OAuthProviderInfo>;
refreshToken?: string;
}>;
+42
View File
@@ -111,6 +111,48 @@ export default async function createPlugin({
...
```
## Resolving membership through the catalog
If you want to provide additional claims through Sign-In resolvers but still
have the software catalog handle group (and transitive group) membership, you
can do this using the `CatalogIdentityClient` provided as context to Sign-In
resolvers:
```ts
export default async function createPlugin({
...
}: PluginEnvironment): Promise<Router> {
return await createRouter({
...
providerFactories: {
google: createGoogleProvider({
signIn: {
resolver: async ({ profile: { email } }, ctx) => {
const [sub] = email?.split('@') ?? '';
// Fetch from an external system that returns entity claims like:
// ['user:default/breanna.davison', ...]
const ent = await externalSystemClient.getUsernames(email);
// Resolve group membership from the Backstage catalog
const fullEnt = await ctx.catalogIdentityClient.resolveCatalogMembership({
entityRefs: [sub].concat(ent),
logger: ctx.logger,
});
const token = await ctx.tokenIssuer.issueToken({
claims: { sub, ent: fullEnt },
});
return { sub, token };
},
},
}),
...
```
The `resolveCatalogMembership` method will retrieve the referenced entities from
the catalog, if possible, and check for
[memberOf](../features/software-catalog/well-known-relations.md#memberof-and-hasmember)
relations to add additional entity claims.
## AuthHandler
Similar to a custom sign-in resolver, you can also write a custom auth handler
-2
View File
@@ -4,8 +4,6 @@ title: Search Architecture
description: Documentation on Search Architecture
---
# Search Architecture
> _This architecture has not been fully implemented yet. Find our milestones to
> follow our progress and help contribute on the
> [Search Roadmap](./README.md#project-roadmap)._
-2
View File
@@ -4,8 +4,6 @@ title: Search Concepts
description: Documentation on Backstage Search Concepts
---
# Search Concepts
Backstage Search lets you find the right information you are looking for in the
Backstage ecosystem.
+3 -9
View File
@@ -4,8 +4,6 @@ title: Getting Started with Search
description: How to set up and install Backstage Search
---
# Getting Started
Search functions as a plugin to Backstage, so you will need to use Backstage to
use Search.
@@ -252,13 +250,9 @@ an example:
Backstage Search isn't a search engine itself, rather, it provides an interface
between your Backstage instance and a
[Search Engine](./concepts.md#search-engines) of your choice. Currently, we only
support one, an in-memory search Engine called Lunr. It can be instantiated like
this:
```typescript
const searchEngine = new LunrSearchEngine({ logger });
const indexBuilder = new IndexBuilder({ logger, searchEngine });
```
support two engines, an in-memory search Engine called Lunr and ElasticSearch.
See [Search Engines](./search-engines.md) documentation for more information how
to configure these in your Backstage instance.
Backstage Search can be used to power search of anything! Plugins like the
Catalog offer default [collators](./concepts.md#collators) (e.g.
+158
View File
@@ -0,0 +1,158 @@
---
id: search-engines
title: Search Engines
description: Choosing and configuring your search engine for Backstage
---
Backstage supports 2 search engines by default, an in-memory engine called Lunr
and ElasticSearch. You can configure your own search engines by implementing the
provided interface as mentioned in the
[search backend documentation.](./getting-started.md#Backend)
Provided search engine implementations have their own way of constructing
queries, which may be something you want to modify. Alterations to the querying
logic of a search engine can be made by providing your own implementation of a
QueryTranslator interface. This modification can be done without touching
provided search engines by using the exposed setter to set the modified query
translator into the instance.
```typescript
const searchEngine = new LunrSearchEngine({ logger });
searchEngine.setTranslator(new MyNewAndBetterQueryTranslator());
```
## Lunr
Lunr search engine is enabled by default for your backstage instance if you have
not done additional changes to the scaffolded app.
Lunr can be instantiated like this:
```typescript
// app/backend/src/plugins/search.ts
const searchEngine = new LunrSearchEngine({ logger });
const indexBuilder = new IndexBuilder({ logger, searchEngine });
```
## Postgres
The Postgres based search engine only requires that postgres being configured as
the database engine for Backstage. Therefore it targets setups that want to
avoid maintaining another external service like elastic search. The search
provides decent results and performs well with ten thousands of indexed
documents. The connection to postgres is established via the database manager
also used by other plugins.
> **Important**: The search plugin requires at least Postgres 11!
To use the `PgSearchEngine`, make sure that you have a Postgres database
configured and make the following changes to your backend:
1. Add a dependency on `@backstage/plugin-search-backend-module-pg` to your
backend's `package.json`.
2. Initialize the search engine. It is recommended to initialize it with a
fallback to the lunr search engine if you are running Backstage for
development locally with SQLite:
```typescript
// In packages/backend/src/plugins/search.ts
// Initialize a connection to a search engine.
const searchEngine = (await PgSearchEngine.supported(database))
? await PgSearchEngine.from({ database })
: new LunrSearchEngine({ logger });
```
## ElasticSearch
Backstage supports ElasticSearch search engine connections, indexing and
querying out of the box. Available configuration options enable usage of either
AWS or Elastic.co hosted solutions, or a custom self-hosted solution.
Similarly to Lunr above, ElasticSearch can be set up like this:
```typescript
// app/backend/src/plugins/search.ts
const searchEngine = await ElasticSearchSearchEngine.initialize({
logger,
config,
});
const indexBuilder = new IndexBuilder({ logger, searchEngine });
```
For the engine to be available, your backend package needs a dependency into
package `@backstage/plugin-search-backend-module-elasticsearch`.
ElasticSearch needs some additional configuration before it is ready to use
within your instance. The configuration options are documented in the
[configuration schema definition file.](https://github.com/backstage/backstage/blob/master/plugins/search-backend-module-elasticsearch/config.d.ts)
The underlying functionality is using official ElasticSearch client version 7.x,
meaning that ElasticSearch version 7 is the only one confirmed to be supported.
## Example configurations
### AWS
Using AWS hosted ElasticSearch the only configuration option needed is the URL
to the ElasticSearch service. The implementation assumes that environment
variables for AWS access key id and secret access key are defined in accordance
to the
[default AWS credential chain.](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html).
```yaml
search:
elasticsearch:
provider: aws
node: https://my-backstage-search-asdfqwerty.eu-west-1.es.amazonaws.com
```
### Elastic.co
Elastic Cloud hosted ElasticSearch uses a Cloud ID to determine the instance of
hosted ElasticSearch to connect to. Additionally, username and password needs to
be provided either directly or using environment variables like defined in
[Backstage documentation.](https://backstage.io/docs/conf/writing#includes-and-dynamic-data)
```yaml
search:
elasticsearch:
provider: elastic
cloudId: backstage-elastic:asdfqwertyasdfqwertyasdfqwertyasdfqwerty==
auth:
username: elastic
password: changeme
```
### Others
Other ElasticSearch instances can be connected to by using standard
ElasticSearch authentication methods and exposed URL, provided that the cluster
supports that. The configuration options needed are the URL to the node and
authentication information. Authentication can be handled by either providing
username/password or an API key. For more information how to create an API key,
see
[Elastic documentation on API keys](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html).
#### Configuration examples
##### With username and password
```yaml
search:
elasticsearch:
node: http://localhost:9200
auth:
username: elastic
password: changeme
```
##### With API key
```yaml
search:
elasticsearch:
node: http://localhost:9200
auth:
apiKey: base64EncodedKey
```
@@ -27,27 +27,33 @@ default catalog page and create a component in a
```tsx
// imports, etc omitted for brevity. for full source see:
// https://github.com/backstage/backstage/blob/master/plugins/catalog/src/components/CatalogPage/CatalogPage.tsx
export const CustomCatalogPage = () => {
export const CustomCatalogPage = ({
columns,
actions,
initiallySelectedFilter = 'owned',
}: CatalogPageProps) => {
return (
<CatalogLayout>
<PageWithHeader title={`${orgName} Catalog`} themeId="home">
<Content>
<ContentHeader title="Components">
<CreateComponentButton />
<CreateButton title="Create Component" to={link} />
<SupportButton>All your software catalog entities</SupportButton>
</ContentHeader>
<div className={styles.contentWrapper}>
<EntityListProvider>
<div>
<EntityListProvider>
<FilteredEntityLayout>
<FilterContainer>
<EntityKindPicker initialFilter="component" hidden />
<EntityTypePicker />
<UserListPicker />
<UserListPicker initialFilter={initiallySelectedFilter} />
<EntityTagPicker />
</div>
<CatalogTable />
</EntityListProvider>
</div>
</FilterContainer>
<EntityListContainer>
<CatalogTable columns={columns} actions={actions} />
</EntityListContainer>
</FilteredEntityLayout>
</EntityListProvider>
</Content>
</CatalogLayout>
</PageWithHeader>
);
};
```
@@ -137,19 +143,27 @@ export const EntitySecurityTierPicker = () => {
Now we can add the component to `CustomCatalogPage`:
```diff
export const CustomCatalogPage = () => {
export const CustomCatalogPage = ({
columns,
actions,
initiallySelectedFilter = 'owned',
}: CatalogPageProps) => {
return (
...
<EntityListProvider>
<div>
<EntityListProvider>
<FilteredEntityLayout>
<FilterContainer>
<EntityKindPicker initialFilter="component" hidden />
<EntityTypePicker />
<UserListPicker />
+ <EntitySecurityTierPicker />
<UserListPicker initialFilter={initiallySelectedFilter} />
+ <EntitySecurityTierPicker />
<EntityTagPicker />
</div>
<CatalogTable />
</EntityListProvider>
<FilterContainer>
<EntityListContainer>
<CatalogTable columns={columns} actions={actions} />
</EntityListContainer>
</FilteredEntityLayout>
</EntityListProvider>
...
};
```
@@ -173,7 +187,7 @@ new `CustomCatalogIndexPage`.
# packages/app/src/App.tsx
const routes = (
<FlatRoutes>
<Navigate key="/" to="/catalog" />
<Navigate key="/" to="catalog" />
- <Route path="/catalog" element={<CatalogIndexPage />} />
+ <Route path="/catalog" element={<CustomCatalogIndexPage />} />
```
@@ -57,18 +57,48 @@ if the original location delegates to another location. A common case is, that a
location is registered as `bootstrap:bootstrap` which means that it is part of
the `app-config.yaml` of a Backstage installation.
### backstage.io/orphan
This annotation is either absent, or present with the exact _string_ value
`"true"`. It should never be added manually. Instead, the catalog itself injects
the annotation as part of its processing loops, on entities that are found to
have no registered locations or config locations that keep them "active" /
"alive".
For example, suppose that the user first registers a location URL pointing to a
`Location` kind entity, which in turn refers to two `Component` kind entities in
two other files nearby. The end result is that the catalog contains those three
entities. Now suppose that the user edits the original `Location` entity to only
refer to the first of the `Component` kind entities. This will intentionally
_not_ lead to the other `Component` entity to be removed from the catalog (for
safety reasons). Instead, it gains this orphan marker annotation, to make it
clear that user action is required to completely remove it, if desired.
```yaml
# Example:
metadata:
annotations:
backstage.io/orphan: 'true'
```
### backstage.io/techdocs-ref
```yaml
# Example:
metadata:
annotations:
backstage.io/techdocs-ref: url:https://github.com/backstage/backstage/tree/master
backstage.io/techdocs-ref: dir:.
```
The value of this annotation is a location reference string (see above). If this
annotation is specified, it is expected to point to a repository that the
TechDocs system can read and generate docs from.
The value of this annotation informs _where_ TechDocs source content is stored
so that it can be read and docs can be generated from it. Most commonly, it's
written as a path, relative to the location of the `catalog-info.yaml` itself,
where the associated `mkdocs.yml` file can be found.
In unusual situations where the documentation for a catalog entity does not live
alongside the entity's source code, the value of this annotation can point to an
absolute URL, matching the location reference string format outlined above, for
example: `url:https://github.com/backstage/backstage/tree/master`
### backstage.io/view-url, backstage.io/edit-url
@@ -33,9 +33,12 @@ scaffolder:
### Disabling Docker in Docker situation (Optional)
Software Templates use
[Cookiecutter](https://github.com/cookiecutter/cookiecutter) as a templating
library. By default it will use the
Software templates use the `fetch:template` action by default, which requires no
external dependencies and offers a
[Cookiecutter-compatible mode](https://backstage.io/docs/features/software-templates/builtin-actions#using-cookiecuttercompat-mode).
There is also a `fetch:cookiecutter` action, which uses
[Cookiecutter](https://github.com/cookiecutter/cookiecutter) directly for
templating. By default, the `fetch:cookiecutter` action will use the
[scaffolder-backend/Cookiecutter](https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend/scripts/Cookiecutter.dockerfile)
docker image.
+2 -2
View File
@@ -24,13 +24,13 @@ techdocs:
runIn: 'docker'
# techdocs.generator.dockerImage can be used to control the docker image used during documentation generation. This can be useful
# (Optional) techdocs.generator.dockerImage can be used to control the docker image used during documentation generation. This can be useful
# if you want to use MkDocs plugins or other packages that are not included in the default techdocs-container (spotify/techdocs).
# NOTE: This setting is only used when techdocs.generator.runIn is set to 'docker'.
dockerImage: 'spotify/techdocs'
# techdocs.generator.pullImage can be used to disable pulling the latest docker image by default. This can be useful when you are
# (Optional) techdocs.generator.pullImage can be used to disable pulling the latest docker image by default. This can be useful when you are
# using a custom techdocs.generator.dockerImage and you have a custom docker login requirement. For example, you need to login to
# AWS ECR to pull the docker image.
# NOTE: Disabling this requires the docker image was pulled by other means before running the techdocs generator.
@@ -66,9 +66,7 @@ Update your component's entity description by adding the following lines to its
```yaml
metadata:
annotations:
backstage.io/techdocs-ref: url:https://github.com/org/repo
# Or
# backstage.io/techdocs-ref: url:https://github.com/org/repo/tree/branchName/subFolder
backstage.io/techdocs-ref: dir:.
```
The
+1 -1
View File
@@ -204,7 +204,7 @@ techdocs:
builder: 'local'
publisher:
type: 'local'
generators:
generator:
techdocs: local
```
+49 -23
View File
@@ -35,38 +35,64 @@ In your Backstage instance's `app-config.yaml`, set `techdocs.builder` from
`'local'` to `'external'`. By doing this, TechDocs will not try to generate
docs. Look at [TechDocs configuration](configuration.md) for reference.
## How to use URL Reader in TechDocs Prepare step?
## How to understand techdocs-ref annotation values
If TechDocs is configured to generate docs, it will first download the
repository associated with the `backstage.io/techdocs-ref` annotation defined in
the Entity's `catalog-info.yaml` file. This is also called the
If TechDocs is configured to generate docs, it will first download source files
based on the value of the `backstage.io/techdocs-ref` annotation defined in the
Entity's `catalog-info.yaml` file. This is also called the
[Prepare](./concepts.md#techdocs-preparer) step.
There are two kinds of preparers or two ways of downloading these source files
We strongly recommend that the `backstage.io/techdocs-ref` annotation in each
documented catalog entity's `catalog-info.yaml` be set to `dir:.` in almost all
situations. This is because TechDocs is aligned with the "docs like code"
philosophy, whereby documentation should be authored and managed alongside the
source code of the underlying software itself.
- Preparer 1: Doing a `git clone` of the repository (also known as Common Git
Preparer)
- Preparer 2: Downloading an archive.zip or equivalent of the repository (also
known as URL Reader)
When you see `dir:.`, you can translate it to mean:
If `backstage.io/techdocs-ref` is equal to any of these -
- That the documentation source code lives in the same location as the
`catalog-info.yaml` file.
- That, in particular, the `mkdocs.yml` file is a sibling of `catalog-info.yaml`
(meaning, it is in the same directory)
- And that all of the source content of the documentation would be available if
one were to download the directory containing those two files (as well as all
sub-directories).
1. `github:https://githubhost.com/org/repo`
2. `gitlab:https://gitlabhost.com/org/repo`
3. `bitbucket:https://bitbuckethost.com/project/repo`
4. `azure/api:https://azurehost.com/org/project`
The directory tree of the entity would look something like this:
Then Common Git Preparer will be used i.e. a `git clone`. But the URL Reader is
a much faster way to do this step. Convert the `backstage.io/techdocs-ref`
values to the following -
```
├── catalog-info.yaml
├── mkdocs.yml
└── docs
└── index.md
```
1. `url:https://githubhost.com/org/repo/tree/<branch_name>`
2. `url:https://gitlabhost.com/org/repo/tree/<branch_name>`
3. `url:https://bitbuckethost.com/project/repo/src/<branch_name>`
4. `url:https://azurehost.com/organization/project/_git/repository`
If, for example, you wanted to keep a lean root directory, you could place your
`mkdocs.yml` file in a subdirectory and update the `backstage.io/techdocs-ref`
annotation value accordingly, e.g. to `dir:./sub-folder`:
Note that you can also provide a path to a non-root directory inside the
repository which contains the `docs/` directory.
```
├── catalog-info.yaml
└── sub-folder
├── mkdocs.yml
└── docs
└── index.md
```
In rare situations where your TechDocs source content is managed and stored in a
location completely separate from your `catalog-info.yaml`, you can instead
specify a URL location reference, the exact value of which will vary based on
the source code hosting provider. Notice that instead of the `dir:` prefix, the
`url:` prefix is used instead. For example:
- **GitHub**: `url:https://githubhost.com/org/repo/tree/<branch_name>`
- **GitLab**: `url:https://gitlabhost.com/org/repo/tree/<branch_name>`
- **Bitbucket**: `url:https://bitbuckethost.com/project/repo/src/<branch_name>`
- **Azure**: `url:https://azurehost.com/organization/project/_git/repository`
Note, just as it's possible to specify a subdirectory with the `dir:` prefix,
you can also provide a path to a non-root directory inside the repository which
contains the `mkdocs.yml` file and `docs/` directory.
e.g.
`url:https://github.com/backstage/backstage/tree/master/plugins/techdocs-backend/examples/documented-component`
@@ -61,7 +61,7 @@ If you do not prefer (3a) and optionally like to use a service account, you can
follow these steps.
Create a new Service Account and a key associated with it. In roles of the
service account, use "Storage Admin".
service account, use "Storage Object Admin".
If you want to create a custom role, make sure to include both `get` and
`create` permissions for both "Objects" and "Buckets". See
@@ -143,6 +143,8 @@ permissions to:
- `s3:ListBucket` to retrieve bucket metadata
- `s3:PutObject` to upload files to the bucket
- `s3:DeleteObject` and `s3:DeleteObjectVersion` to delete stale content during
re-publishing
To _read_ TechDocs from the S3 bucket the IAM policy needs to have at a minimum
permissions to:
@@ -345,6 +347,10 @@ techdocs:
accountKey: ${TECHDOCS_AZURE_BLOB_STORAGE_ACCOUNT_KEY}
```
In either case, the account or credentials used to access your container and all
TechDocs objects underneath it should have the `Storage Blog Data Owner` role
applied, in order to read, write, and delete objects as needed.
**4. That's it!**
Your Backstage app is now ready to use Azure Blob Storage for TechDocs, to store
+1 -1
View File
@@ -35,7 +35,7 @@ If you want more control over the theme, and for example customize font sizes
and margins, you can use the lower-level `createThemeOverrides` function
exported by [@backstage/theme](https://www.npmjs.com/package/@backstage/theme)
in combination with
[createMuiTheme](https://material-ui.com/customization/theming/#createmuitheme-options-args-theme)
[createTheme](https://material-ui.com/customization/theming/#createmuitheme-options-args-theme)
from [@material-ui/core](https://www.npmjs.com/package/@material-ui/core). See
the
[@backstage/theme source](https://github.com/backstage/backstage/tree/master/packages/theme/src)
+3 -5
View File
@@ -24,11 +24,9 @@ an easier path to make Pull Requests.
Backstage provides the `@backstage/create-app` package to scaffold standalone
instances of Backstage. You will need to have
[Node.js](https://nodejs.org/en/download/) Active LTS Release installed
(currently v14), [Yarn](https://classic.yarnpkg.com/en/docs/install) and
[Python](https://www.python.org/downloads/) (although you likely have it
already). You will also need to have
[Docker](https://docs.docker.com/engine/install/) installed to use some features
like Software Templates and TechDocs.
(currently v14) and [Yarn](https://classic.yarnpkg.com/en/docs/install). You
will also need to have [Docker](https://docs.docker.com/engine/install/)
installed to use some features like Software Templates and TechDocs.
Using `npx` you can then run the following to create an app in a chosen
subdirectory of your current working directory:
+42
View File
@@ -0,0 +1,42 @@
---
id: locations
sidebar_label: Locations
title: Amazon Web Services S3 Locations
# prettier-ignore
description: Setting up an integration with Amazon Web Services S3
---
The AWS S3 integration supports loading catalog entities from an S3 Bucket.
Entities can be added to
[static catalog configuration](../../features/software-catalog/configuration.md),
or registered with the
[catalog-import](https://github.com/backstage/backstage/tree/master/plugins/catalog-import)
plugin.
## Configuration
To use this integration, add configuration to your `app-config.yaml`:
```yaml
integrations:
awsS3:
- host: amazonaws.com
accessKeyId: ${AWS_ACCESS_KEY_ID}
secretAccessKey: ${AWS_SECRET_ACCESS_KEY}
```
Then make sure the environment variables `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` are set when you run Backstage.
Users with multiple AWS accounts may want to use a role for S3 storage that is
in a different AWS account. Using the `roleArn` parameter as seen below, you can
instruct the AWS S3 reader to assume a role before accessing S3:
```yaml
integrations:
awsS3:
- host: amazonaws.com
accessKeyId: ${AWS_ACCESS_KEY_ID}
secretAccessKey: ${AWS_SECRET_ACCESS_KEY}
roleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/example-role'
```
+5 -7
View File
@@ -56,13 +56,11 @@ matching repository is processed.
repository.
```typescript
const customRepositoryParser: BitbucketRepositoryParser = async function* customRepositoryParser({
client,
repository,
}) {
// Custom logic for interpret the matching repository.
// See defaultRepositoryParser for an example
};
const customRepositoryParser: BitbucketRepositoryParser =
async function* customRepositoryParser({ client, repository }) {
// Custom logic for interpret the matching repository.
// See defaultRepositoryParser for an example
};
const processor = BitbucketDiscoveryProcessor.fromConfig(env.config, {
parser: customRepositoryParser,
+151 -82
View File
@@ -1,116 +1,185 @@
---
id: roadmap
title: Project roadmap
description: Roadmap of Backstage Project
title: Roadmap
description: Roadmap of Backstage
---
## Current status
## The Backstage Roadmap
> Backstage is currently under rapid development. This means that you can expect
> APIs and features to evolve. It is also recommended that teams who adopt
> Backstage today [upgrade their installation](../cli/commands.md#versionsbump)
> as new [releases](https://github.com/backstage/backstage/releases) become
> available, as Backwards compatibility is not yet guaranteed.
Backstage is currently under rapid development. This page details the projects
public roadmap, the result of ongoing collaboration between the core maintainers
and the broader Backstage community. Treat the roadmap as an ever-evolving guide
to keep us aligned as a community on:
## Phases
- Upcoming enhancements and benefits,
- Planning contributions and support,
- Planning the projects adoption,
- Understanding what things are coming soon,
- Avoiding duplication of work
We have divided the project into three high-level _phases_:
### How to influence the roadmap
- 🐣 **Phase 1:** Extensible frontend platform (Done ✅) - You will be able to
easily create a single consistent UI layer for your internal infrastructure
and tools. A set of reusable
[UX patterns and components](https://backstage.io/storybook) help ensure a
consistent experience between tools.
As we evolve Backstage, we want you to contribute actively in the journey to
define the most effective developer experience in the world.
- 🐢 **Phase 2:** Software Catalog
([alpha released](https://backstage.io/blog/2020/06/22/backstage-service-catalog-alpha)) -
With a single catalog, Backstage makes it easy for a team to manage ten
services — and makes it possible for your company to manage thousands of them.
A roadmap is only useful if it captures real needs. If you have success stories,
feedback, or ideas, we want to hear from you! If you plan to work (or are
already working) on a new or existing feature, please let us know, so that we
can update the roadmap accordingly. We are also happy to share knowledge and
context that will help your feature land successfully.
- 🐇 **Phase 3:** Ecosystem (ongoing, see
[Plugin Marketplace](https://backstage.io/plugins)) - Everyone's
infrastructure stack is different. By fostering a vibrant community of
contributors we hope to provide an ecosystem of Open Source
plugins/integrations that allows you to pick the tools that match your stack.
## Detailed roadmap
If you have questions about the roadmap or want to provide feedback, we would
love to hear from you! Please create an
[Issue](https://github.com/backstage/backstage/issues/new/choose), ping us on
[Discord](https://discord.gg/EBHEGzX) or reach out directly at
[backstage-interest@spotify.com](mailto:backstage-interest@spotify.com).
Want to help out? Awesome ❤️ Head over to
You can also head over to the
[CONTRIBUTING](https://github.com/backstage/backstage/blob/master/CONTRIBUTING.md)
guidelines to get started.
### Ongoing work 🚧
If you have specific questions about the roadmap, please create an
[issue](https://github.com/backstage/backstage/issues/new/choose), ping us on
[Discord](https://discord.gg/awD6SxgQ), or
[book time](http://calendly.com/spotify-backstage) with the Spotify team.
- **[Platform stabilization](https://github.com/backstage/backstage/milestone/19)** -
Stabilize the core of Backstage, including its core features, so that the
platform can be depended on for production use. After this, plugins will
require little-to-no maintenance.
### How to read the roadmap
- **[Kubernetes plugin for service owners](https://github.com/backstage/backstage/issues/2857)** -
Improve native support for Kubernetes, making it easier for service owners to
see and manage their services running in K8s, regardless if that's locally, in
AWS, GCS, Azure, or elsewhere.
The Backstage roadmap lays out both [“whats next”](#whats-next) and
[“future work”](#future-work). With "next" we mean features planned for release
within the ongoing quarter starting in July until September 2021 included. With
"future" we mean features in the radar, but not yet scheduled.
- **[Search platform](../features/search/README.md)** - Evolve the basic search
functionality currently available into a platform that **a)** enables search
across the software catalog, TechDocs, and any other information exposed by
plugins, and **b)** supports a variety of search engine technologies.
The long-term roadmap (12 - 36 months) is not detailed in the public roadmap.
Third-party contributions are also not currently included in the roadmap. Let us
know about any ongoing developments and were happy to include it here as well.
- **[Software Templates V2](https://github.com/backstage/backstage/issues/2771)** -
Expand the templates to make the steps more composable by adding the ability
to add more steps for custom logic, including webhooks and using authorization
from integrations.
### Roadmap evolution
### Future work 🔮
Will this roadmap change? Obviously!
- **Golden Path for Plugin Development** - Create an easy, standardized way for
developers to build plugins that will encourage contributions and lead to a
richer ecosystem for everyone.
Roadmap are always evolving and ours is no different; you can expect to see this
updated roughly every month.
- **[GraphQL API](https://github.com/backstage/backstage/milestone/13)** - A
GraphQL API will open up the rich metadata provided by Backstage in a single
query. Plugins can easily query this API as well as extend the model where
needed.
## Whats next
- **Inter-Plugin Communication** - **[Under consideration]** Establish more
clearly defined patterns for plugins to communicate.
The feature set below is planned for the ongoing quarter, and grouped by theme.
The list order doesnt necessarily reflect priority, and the development/release
cycle will vary based on maintainer schedules.
- **Improved Access Control** - **[Under consideration]** Provide finer grained
access controls and management for better control of the platform user
experience.
### Backstage Core
### Plugins
The following features are planned for release:
Building and maintaining [plugins](https://backstage.io/plugins) is the work of
the entire Backstage community.
- **Composable homepage:** Were seeing lots of interest from the community in
reusable components to build a homepage experience where users can easily
surface what they might find useful to start their tasks. Check out the
[milestone](https://github.com/backstage/backstage/milestone/34) for further
details.
- **Improved responsiveness:** Check out the
[RFC here](https://github.com/backstage/backstage/issues/6318) for further
details on how to improve the responsiveness for Backstage's UI.
A list of plugins that are in development is
[available here](https://github.com/backstage/backstage/issues?q=is%3Aissue+is%3Aopen+label%3Aplugin+sort%3Areactions-%2B1-desc).
We strongly recommend to upvote 👍 plugins you are interested in. This helps us
and the community prioritize what plugins to build.
### Software Templates
Are you missing a plugin for your favorite tool? Please
[suggest a new one](https://github.com/backstage/backstage/issues/new?labels=plugin&template=plugin_template.md&title=%5BPlugin%5D+THE+PLUGIN+NAME).
Chances are that someone will jump in and help build it.
The following features are planned for release::
### Community Initiatives 🧑‍🤝‍🧑
- **Re-creation/resubmission in case of failure:** Speed up productivity by
allowing developers to relaunch a project after a failure or any unexpected
problem. In the current version, this task requires retyping and a full
re-creation from scratch.
- **Performance and usability improvements for contributors:** Reach a relevant
improvement in templating's performance through the replacement of
[handlebars](https://handlebarsjs.com/). Other replacements will be considered
as part of this task (possibly
[cookiecutter](https://cookiecutter.readthedocs.io/)) for easier software
template creation, allowing more contributors to reach their goals without
having to learn new tooling.
- **Improved extensibility through inclusion:** Make software templates more
maintainable and extensible by adding `$include` support for parameters.
- **Authenticated job creation:** Created jobs will be able to run with an
authenticated user with all actions tracked for future consumption and
evidence. Track users creating jobs and make “jobs created by me” reporting
available.
- [**Backstage Community Sessions**](https://github.com/backstage/community#meetups) -
A monthly meetup for the community to come together to share and learn about
the latest happenings in Backstage.
### Software Catalog
- **Backstage Hackathons** - (Coming soon) Open to everyone in our Backstage
community, a celebration of you, the project and building awesome things
together
The following features are planned for release:
### Completed milestones ✅
- **Request For Comments (RFC) for composability improvements (routing):**
Enable plugins to be auto-added and make plugin installation and upgrades
easier for all Backstage users. This includes information card layouts, entity
pages containing content and hooking the external header, considering the
support of a separate deployment, and configuration for plugins.
- **Removing duplicated entities in catalog:** As any adopter knows, a software
catalog can contain thousands or more entities and it is very important to
avoid duplications in naming to prevent failures. With this development task,
two entities with the same name won't be allowed as described
[here](https://github.com/backstage/backstage/issues/4760).
- **Connecting identity to ownership to prepare for role-based access control
([RBAC](https://en.wikipedia.org/wiki/Role-based_access_control)):** This is a
first step to supporting RBAC for the software catalog (see the
[future work section](#future-work) for further details). Provide each entity
within the software catalog with a recognized owner.
- **Catalog performance improvements through improved caching:** Fix the
performance gaps in the catalog processor, which currently doesnt have a
strong caching mechanism. The current version often requires fetching a
relevant amount of data, especially at scale.
### Search
The following features are planned for release:
- ElasticSearch integration: Add ElasticSearch to the Search Platform as the
underlying search engine. Check out the
[milestone here](https://github.com/backstage/backstage/milestone/27) for
further details.
### TechDocs
The following features are planned for release:
- **TechDocs beta release:** Fix remaining bugs to get TechDocs to Beta. Check
out the [milestone here](https://github.com/backstage/backstage/milestone/29)
for further details.
## Future work
The following feature list doesnt represent a commitment to develop and the
list order doesnt reflect any priority or importance. But these features are on
the maintainers radar, with clear interest expressed by the community.
- **Improved UX design:** Provide a better Backstage user experience through
visual guidelines and templates, especially navigation across plug-ins and
portal functionalities.
- **Catalog composability (routing):** Follow up development after the RFC
planned for the ongoing quarter (see [whats next](#whats-next) for further
details).
- **Catalog-import improvements:** Provide a faster (scalability) and better
(more features like move/rename) way to import entities into the Software
Catalog. Importing items in the Software Catalog is crucial for creating a
Backstage proof-of-concept or testing/planning for broader organizational
adoption. This enhancement better supports getting developers to use Backstage
with less effort and customization.
- **Catalog improvements:** Add pagination and sourcing to Software Catalog.
- **[GraphQL](https://graphql.org/) support:** Introduce the ability to query
Backstage backend services with a standard query language for APIs.
- **Software templates performance improvements through decoupling a separate
worker:** Improve performance through decoupling resource-consuming services
and making them asynchronous. In the current version, project auto-creation
through the Software Templating system can consume a lot of resources and
bottleneck many concurrent projects created simultaneously.
- **API discovery and documentation:** Add better support for the
[gRPC](https://grpc.io/).
- **Adding TechDocs search to the Search Platform:** Having this capability in
place will provide a better and new major version of the Search Platform
(v3.0). You can refer to the
[milestone here](https://github.com/backstage/backstage/milestone/28) for
further details.
- **TechDocs GA release:** Work toward enhancements necessary to get TechDocs to
general availability. Check out the
[milestone here](https://github.com/backstage/backstage/milestone/30) for
further details.
## Completed milestones
Read more about the completed (and released) features for reference.
- [[Search] Out-of-the-Box Implementation (Alpha)](https://github.com/backstage/backstage/milestone/26)
- [Deploy a product demo at `demo.backstage.io`](https://demo.backstage.io)
- [Kubernetes plugin - v1](https://github.com/backstage/backstage/tree/master/plugins/kubernetes)
- [Helm charts](https://github.com/backstage/backstage/tree/master/contrib/chart/backstage)
-8
View File
@@ -312,14 +312,6 @@ configuration.
Stability: `1`
### `register-component` [GitHub](https://github.com/backstage/backstage/tree/master/plugins/register-component/)
A frontend plugin that allows the user to register entity locations in the
catalog.
Stability: `0`. This plugin is likely to be replaced by a generic entity import
plugin instead.
### `scaffolder` [GitHub](https://github.com/backstage/backstage/tree/master/plugins/scaffolder/)
The frontend scaffolder plugin where one can browse templates and initiate
+20
View File
@@ -89,6 +89,26 @@ integrations:
- $include: example-backstage-app-credentials.yaml
```
### Limiting the GitHub App installations
If you want to limit the GitHub app installations visible to backstage you may
optionally include the `allowedInstallationOwners` option.
```yaml
appId: 1
allowedInstallationOwners: ['GlobexCorp']
clientId: client id
clientSecret: client secret
webhookSecret: webhook secret
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
...Key content...
-----END RSA PRIVATE KEY-----
```
This will result in backstage preventing the use of any installation that is not
within the allow list.
### Permissions for pull requests
These are the minimum permissions required for creating a pull request with
+3 -4
View File
@@ -99,15 +99,14 @@ You may tweak these components, rename them and/or replace them completely.
## Connecting the plugin to the Backstage app
There are three things needed for a Backstage app to start making use of a
plugin.
There are two things needed for a Backstage app to start making use of a plugin.
1. Add plugin as dependency in `app/package.json`
2. Import and use one or more plugin extensions, for example in
`app/src/App.tsx`.
Luckily these three steps happen automatically when you create a plugin with the
Backstage CLI.
Luckily both of these steps happen automatically when you create a plugin with
the Backstage CLI.
## Talking to the outside world
+1 -1
View File
@@ -2,5 +2,5 @@
"packages": ["packages/*", "plugins/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.1.1"
"version": "0.1.0"
}
@@ -0,0 +1,68 @@
---
title: Software Templates is now in Beta
author: Ben Lambert, Spotify
authorURL: https://github.com/benjdlambert
authorImageURL: https://avatars.githubusercontent.com/u/3645856?v=4
---
![Software Templates in Beta](assets/21-07-26/backstage-software-templates-beta.gif)
**TLDR**; At a high level, Backstage performs three main jobs: [Create, Manage, and Explore](https://backstage.io/blog/2021/05/20/adopting-backstage#three-jobs-create-manage-explore). Throughout the year, weve been focussed on improving the stability and scalability of these areas while enhancing the feature sets based upon requests from the community. Software Templates — which enable push-button deployments with all your standards and best practices built-in — is our first feature-complete release candidate to graduate to beta. Read on to learn how this release improves template customization and flexibility, as well as performance.
<!--truncate-->
Lets rewind a little bit, around a year in fact. Backstage had been open sourced, and we released our first version of Software Templates and our Scaffolder plugin.
In case you missed it, [Software Templates](https://backstage.io/blog/2020/08/05/announcing-backstage-software-templates) are part of the Create feature set, where you can set up Backstage to give your engineers the ability to spin up a new microservice, website, or any other software component with your organizations best practices built-in, right from the start.
Back when we released the first version of these templates, with the `apiVersion` `backstage.io/v1alpha1`, they were a little restrictive in what they could do. The generated repository could only have one template source and it was restricted to only being [cookiecutter](https://github.com/cookiecutter/cookiecutter) templates. And it had to fit into the three stages of templating which was `Prepare`, `Template`, and `Publish`.
We [opened up for feedback](https://github.com/backstage/backstage/issues/2771) from the community knowing that this wasnt going to be the final version, but something of a stepping stone to where we want to be in the future.
And now we come to today…
## Anddddd… Action(s)! 🎬
Following the removal of the previously deprecated `backstage.io/v1alpha1` templates, today were officially announcing the beta version of Software Templates, or `backstage.io/v1beta2`.
With it comes an entirely new architecture to the Software Templates functionality, and a load of new exciting features, which Ill dig into a little deeper.
### Template actions
Weve totally opened up the ability to compose your own workflows for each Template that you have registered in Software Templates. This means no restrictions on where your template skeleton is kept, and no restrictions on what your workflow should look like.
Template Actions are customizable JavaScript functions that allow you to extend the capabilities of the Software Templates by adding your own business logic or reusing some of our Built-In actions.
![New template syntax with actions](assets/21-07-26/example-template-code.png)
_An example of the new template syntax with steps and parameters_
The workflow for Software Templates are now step-based, and each Software Template can have a customizable amount of steps which will in turn call these new actions.
![New steps being rendered in the frontend](assets/21-07-26/steps-running.gif)
_An example of a Template with customizable steps_
These actions are very heavily inspired by GitHub Actions and GitHub Workflows, and weve given back a lot of control to the template authors so they can build the boilerplate and push the code however they want.
### Custom UI extensions
A large part of the Software Templates feature is the form that we use to collect user input which is then passed on to these new actions. Sometimes, it makes sense that Template Authors want to provide their own React components which can be rendered in the frontend to maybe do some more complex things like calling internal APIs to provide autocomplete.
This is now possible with the new `ScaffolderFieldExtensions`.
![Custom UI extensions](assets/21-07-26/custom-components.gif)
_An example of `ScaffolderFieldExtension` is the `OwnerPicker` component which can automatically add options and suggest typeahead with data from an async API request_
Template Authors can create their own components to provide data to the custom actions in any way you see fit, and even override our own built in ones too like the `RepoUrlPicker`.
### Horizontal scalability
The Scaffolder Service and Software Templates are now horizontally scalable, coordinating work between your deployed backend machines. This means now that the number of instances of the `@backstage/plugin-scaffolder-backend` plugin you have, is the same amount of jobs that you can have in parallel. This ensures that your tasks are handled quickly and reliably, while providing great feedback in the process.
## Try out the new templates
Were still on the journey to making the Software Templates a great user experience for both authors and developers — but were not done yet, so watch this space for new exciting features to come!
In the meantime, make sure to visit the documentation for [building templates](https://backstage.io/docs/features/software-templates/adding-templates) or creating your own [custom actions](https://backstage.io/docs/features/software-templates/writing-custom-actions).
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

+9
View File
@@ -0,0 +1,9 @@
---
title: XCMetrics
author: Spotify
authorUrl: https://github.com/spotify
category: Monitoring
description: Discover valuable insights hiding inside Xcodes build logs.
documentation: https://xcmetrics.io/
iconUrl: img/xcmetrics-icon.png
npmPackageName: '@backstage/plugin-xcmetrics'
+1 -1
View File
@@ -16,7 +16,7 @@
"lock:check": "yarn-lock-check"
},
"devDependencies": {
"@spotify/prettier-config": "^10.0.0",
"@spotify/prettier-config": "^11.0.0",
"docusaurus": "^2.0.0-alpha.70",
"js-yaml": "^4.1.0",
"prettier": "^2.3.2",
+3 -3
View File
@@ -212,9 +212,9 @@ class Index extends React.Component {
Backstage Software Templates{' '}
<a
title="Submit feedback for this feature. Click to learn more about this release."
href="https://backstage.io/blog/2020/08/05/announcing-backstage-software-templates"
href="https://backstage.io/blog/2021/07/26/software-templates-are-now-in-beta"
>
(alpha)
(beta)
</a>
</Block.Subtitle>
<Block.Title small>Standards can set you free</Block.Title>
@@ -292,7 +292,7 @@ class Index extends React.Component {
Build your own software templates
</ActionBlock.Title>
<ActionBlock.Link
href={`https://github.com/backstage/backstage/blob/master/docs/features/software-templates/index.md`}
href={`https://backstage.io/docs/features/software-templates`}
>
Contribute
</ActionBlock.Link>
+7 -1
View File
@@ -80,7 +80,8 @@
"features/search/search-overview",
"features/search/getting-started",
"features/search/concepts",
"features/search/architecture"
"features/search/architecture",
"features/search/search-engines"
]
},
{
@@ -103,6 +104,11 @@
],
"Integrations": [
"integrations/index",
{
"type": "subcategory",
"label": "AWS S3",
"ids": ["integrations/aws-s3/locations"]
},
{
"type": "subcategory",
"label": "Azure",
+10
View File
@@ -288,6 +288,16 @@ td {
.tocToggler {
display: none;
}
.docsSliderActive .toc section .navGroups {
padding-top: 0;
padding-bottom: 0;
}
.docsSliderActive.docsNavContainer {
background-color: #121212;
padding-bottom: 0;
}
}
/* content */
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+4 -4
View File
@@ -909,10 +909,10 @@
resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==
"@spotify/prettier-config@^10.0.0":
version "10.0.0"
resolved "https://registry.npmjs.org/@spotify/prettier-config/-/prettier-config-10.0.0.tgz#fa076d98d2e7e6c53dd3d86a696307a7010bd056"
integrity sha512-VYOdo8P7lIScAkl02nB9KpUAuOYMManryBIBuKJkAw5D3aVtLobfmdIKvdV6MqEmGMEQPbn7w/UpnjJYhUH+IA==
"@spotify/prettier-config@^11.0.0":
version "11.0.0"
resolved "https://registry.npmjs.org/@spotify/prettier-config/-/prettier-config-11.0.0.tgz#d91e0546a8c1c0f7299e2edc7e44306e9be210f6"
integrity sha512-dOI13j1uHMZkRxhZuge/ugOE7Aqcg7Nxki932lDZuXyY4G8CGxkc/66PeQ8pR4PCzThHORXo7Ptvau6bh101lQ==
"@types/cheerio@^0.22.8":
version "0.22.23"
+3
View File
@@ -64,6 +64,7 @@ nav:
- Getting Started: 'features/search/getting-started.md'
- Concepts: 'features/search/concepts.md'
- Search Architecture: 'features/search/architecture.md'
- Search Engines: 'features/search/search-engines.md'
- TechDocs:
- Overview: 'features/techdocs/README.md'
- Getting Started: 'features/techdocs/getting-started.md'
@@ -78,6 +79,8 @@ nav:
- FAQ: 'features/techdocs/FAQ.md'
- Integrations:
- Overview: 'integrations/index.md'
- AWS S3:
- Locations: 'integrations/aws-s3/locations.md'
- Azure:
- Locations: 'integrations/azure/locations.md'
- Org Data: 'integrations/azure/org.md'
+6
View File
@@ -38,9 +38,14 @@
"packages": [
"packages/*",
"plugins/*"
],
"nohoist": [
"**/@storybook/**",
"**/@storybook"
]
},
"resolutions": {
"**/@graphql-codegen/cli/**/ws": "^7.4.6",
"**/@roadiehq/**/@backstage/core": "*",
"**/@roadiehq/**/@backstage/plugin-catalog": "*",
"**/@roadiehq/**/@backstage/catalog-model": "*",
@@ -54,6 +59,7 @@
"@microsoft/api-extractor-model": "^7.13.3"
},
"devDependencies": {
"@types/webpack": "^5.28.0",
"@changesets/cli": "^2.14.0",
"@octokit/openapi-types": "^2.2.0",
"@spotify/prettier-config": "^10.0.0",
+110
View File
@@ -1,5 +1,115 @@
# example-app
## 0.2.41
### Patch Changes
- Updated dependencies
- @backstage/plugin-cost-insights@0.11.4
- @backstage/plugin-github-actions@0.4.16
- @backstage/plugin-jenkins@0.5.3
- @backstage/plugin-kubernetes@0.4.11
- @backstage/plugin-pagerduty@0.3.11
- @backstage/plugin-scaffolder@0.11.0
- @backstage/plugin-sentry@0.3.18
- @backstage/plugin-techdocs@0.10.4
- @backstage/core-app-api@0.1.8
- @backstage/core-components@0.3.1
- @backstage/core-plugin-api@0.1.6
- @backstage/plugin-api-docs@0.6.6
- @backstage/plugin-catalog@0.6.11
- @backstage/plugin-catalog-import@0.5.17
- @backstage/plugin-catalog-react@0.4.2
- @backstage/plugin-explore@0.3.13
- @backstage/plugin-lighthouse@0.2.23
- @backstage/plugin-rollbar@0.3.12
- @backstage/plugin-search@0.4.7
- @backstage/plugin-tech-radar@0.4.5
- @backstage/cli@0.7.8
- @backstage/integration-react@0.1.7
## 0.2.40
### Patch Changes
- Updated dependencies
- @backstage/cli@0.7.7
- @backstage/plugin-catalog@0.6.10
- @backstage/core-components@0.3.0
- @backstage/core-plugin-api@0.1.5
- @backstage/plugin-api-docs@0.6.5
- @backstage/plugin-scaffolder@0.10.3
- @backstage/plugin-search@0.4.6
- @backstage/plugin-cost-insights@0.11.3
- @backstage/plugin-kubernetes@0.4.10
- @backstage/plugin-lighthouse@0.2.22
- @backstage/plugin-pagerduty@0.3.10
- @backstage/plugin-techdocs@0.10.3
- @backstage/search-common@0.1.3
- @backstage/core-app-api@0.1.7
- @backstage/integration-react@0.1.6
- @backstage/plugin-badges@0.2.7
- @backstage/plugin-catalog-import@0.5.16
- @backstage/plugin-catalog-react@0.4.1
- @backstage/plugin-circleci@0.2.21
- @backstage/plugin-cloudbuild@0.2.21
- @backstage/plugin-code-coverage@0.1.9
- @backstage/plugin-explore@0.3.12
- @backstage/plugin-gcp-projects@0.3.2
- @backstage/plugin-github-actions@0.4.15
- @backstage/plugin-graphiql@0.2.14
- @backstage/plugin-jenkins@0.5.2
- @backstage/plugin-kafka@0.2.13
- @backstage/plugin-newrelic@0.3.2
- @backstage/plugin-org@0.3.19
- @backstage/plugin-rollbar@0.3.11
- @backstage/plugin-sentry@0.3.17
- @backstage/plugin-shortcuts@0.1.6
- @backstage/plugin-tech-radar@0.4.4
- @backstage/plugin-todo@0.1.7
- @backstage/plugin-user-settings@0.3.3
## 0.2.39
### Patch Changes
- Updated dependencies
- @backstage/plugin-scaffolder@0.10.2
- @backstage/core-components@0.2.0
- @backstage/plugin-catalog@0.6.9
- @backstage/plugin-catalog-react@0.4.0
- @backstage/cli@0.7.6
- @backstage/core-app-api@0.1.6
- @backstage/core-plugin-api@0.1.4
- @backstage/integration-react@0.1.5
- @backstage/theme@0.2.9
- @backstage/plugin-api-docs@0.6.4
- @backstage/plugin-badges@0.2.6
- @backstage/plugin-catalog-import@0.5.15
- @backstage/plugin-circleci@0.2.20
- @backstage/plugin-cloudbuild@0.2.20
- @backstage/plugin-code-coverage@0.1.8
- @backstage/plugin-cost-insights@0.11.2
- @backstage/plugin-explore@0.3.11
- @backstage/plugin-gcp-projects@0.3.1
- @backstage/plugin-github-actions@0.4.14
- @backstage/plugin-graphiql@0.2.13
- @backstage/plugin-jenkins@0.5.1
- @backstage/plugin-kafka@0.2.12
- @backstage/plugin-kubernetes@0.4.9
- @backstage/plugin-lighthouse@0.2.21
- @backstage/plugin-newrelic@0.3.1
- @backstage/plugin-org@0.3.18
- @backstage/plugin-pagerduty@0.3.9
- @backstage/plugin-rollbar@0.3.10
- @backstage/plugin-search@0.4.5
- @backstage/plugin-sentry@0.3.16
- @backstage/plugin-shortcuts@0.1.5
- @backstage/plugin-tech-radar@0.4.3
- @backstage/plugin-techdocs@0.10.2
- @backstage/plugin-todo@0.1.6
- @backstage/plugin-user-settings@0.3.2
## 0.2.37
### Patch Changes
+42 -39
View File
@@ -1,47 +1,49 @@
{
"name": "example-app",
"version": "0.2.37",
"version": "0.2.41",
"private": true,
"bundled": true,
"dependencies": {
"@backstage/catalog-model": "^0.9.0",
"@backstage/cli": "^0.7.4",
"@backstage/core-app-api": "^0.1.3",
"@backstage/core-components": "^0.1.5",
"@backstage/core-plugin-api": "^0.1.3",
"@backstage/integration-react": "^0.1.4",
"@backstage/plugin-api-docs": "^0.6.2",
"@backstage/plugin-badges": "^0.2.5",
"@backstage/plugin-catalog": "^0.6.7",
"@backstage/plugin-catalog-import": "^0.5.13",
"@backstage/plugin-catalog-react": "^0.3.0",
"@backstage/plugin-circleci": "^0.2.19",
"@backstage/plugin-cloudbuild": "^0.2.19",
"@backstage/plugin-code-coverage": "^0.1.7",
"@backstage/plugin-cost-insights": "^0.11.0",
"@backstage/plugin-explore": "^0.3.10",
"@backstage/plugin-gcp-projects": "^0.3.0",
"@backstage/plugin-github-actions": "^0.4.13",
"@backstage/plugin-graphiql": "^0.2.12",
"@backstage/plugin-jenkins": "^0.5.0",
"@backstage/plugin-kafka": "^0.2.11",
"@backstage/plugin-kubernetes": "^0.4.8",
"@backstage/plugin-lighthouse": "^0.2.20",
"@backstage/plugin-newrelic": "^0.3.0",
"@backstage/plugin-org": "^0.3.17",
"@backstage/plugin-pagerduty": "0.3.8",
"@backstage/plugin-rollbar": "^0.3.9",
"@backstage/plugin-scaffolder": "^0.10.1",
"@backstage/plugin-search": "^0.4.3",
"@backstage/plugin-sentry": "^0.3.15",
"@backstage/plugin-shortcuts": "^0.1.4",
"@backstage/plugin-tech-radar": "^0.4.1",
"@backstage/plugin-techdocs": "^0.10.0",
"@backstage/plugin-todo": "^0.1.5",
"@backstage/plugin-user-settings": "^0.3.0",
"@backstage/theme": "^0.2.8",
"@material-ui/core": "^4.11.0",
"@backstage/cli": "^0.7.8",
"@backstage/core-app-api": "^0.1.8",
"@backstage/core-components": "^0.3.1",
"@backstage/core-plugin-api": "^0.1.6",
"@backstage/integration-react": "^0.1.7",
"@backstage/plugin-api-docs": "^0.6.6",
"@backstage/plugin-badges": "^0.2.7",
"@backstage/plugin-catalog": "^0.6.11",
"@backstage/plugin-catalog-import": "^0.5.17",
"@backstage/plugin-catalog-react": "^0.4.2",
"@backstage/plugin-circleci": "^0.2.21",
"@backstage/plugin-cloudbuild": "^0.2.21",
"@backstage/plugin-code-coverage": "^0.1.9",
"@backstage/plugin-cost-insights": "^0.11.4",
"@backstage/plugin-explore": "^0.3.13",
"@backstage/plugin-gcp-projects": "^0.3.2",
"@backstage/plugin-github-actions": "^0.4.16",
"@backstage/plugin-graphiql": "^0.2.14",
"@backstage/plugin-jenkins": "^0.5.3",
"@backstage/plugin-kafka": "^0.2.13",
"@backstage/plugin-kubernetes": "^0.4.11",
"@backstage/plugin-lighthouse": "^0.2.23",
"@backstage/plugin-newrelic": "^0.3.2",
"@backstage/plugin-org": "^0.3.19",
"@backstage/plugin-pagerduty": "0.3.11",
"@backstage/plugin-rollbar": "^0.3.12",
"@backstage/plugin-scaffolder": "^0.11.0",
"@backstage/plugin-search": "^0.4.7",
"@backstage/plugin-sentry": "^0.3.18",
"@backstage/plugin-shortcuts": "^0.1.6",
"@backstage/plugin-tech-radar": "^0.4.5",
"@backstage/plugin-techdocs": "^0.10.4",
"@backstage/plugin-todo": "^0.1.7",
"@backstage/plugin-user-settings": "^0.3.3",
"@backstage/search-common": "^0.1.3",
"@backstage/theme": "^0.2.9",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
"@octokit/rest": "^18.5.3",
"@roadiehq/backstage-plugin-buildkite": "^1.0.6",
"@roadiehq/backstage-plugin-github-insights": "^1.1.20",
@@ -58,7 +60,8 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/test-utils": "^0.1.14",
"@backstage/test-utils": "^0.1.17",
"@rjsf/core": "^3.0.0",
"@testing-library/cypress": "^7.0.1",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
@@ -66,7 +69,7 @@
"@types/jest": "^26.0.7",
"@types/jquery": "^3.3.34",
"@types/node": "^14.14.32",
"@types/react-dom": "^16.9.8",
"@types/react-dom": "*",
"@types/zen-observable": "^0.8.0",
"cross-env": "^7.0.0",
"cypress": "^7.3.0",
+32 -6
View File
@@ -41,10 +41,22 @@ import { GcpProjectsPage } from '@backstage/plugin-gcp-projects';
import { GraphiQLPage } from '@backstage/plugin-graphiql';
import { LighthousePage } from '@backstage/plugin-lighthouse';
import { NewRelicPage } from '@backstage/plugin-newrelic';
import { ScaffolderPage, scaffolderPlugin } from '@backstage/plugin-scaffolder';
import {
ScaffolderPage,
scaffolderPlugin,
ScaffolderFieldExtensions,
RepoUrlPickerFieldExtension,
OwnerPickerFieldExtension,
EntityPickerFieldExtension,
EntityNamePickerFieldExtension,
} from '@backstage/plugin-scaffolder';
import { SearchPage } from '@backstage/plugin-search';
import { TechRadarPage } from '@backstage/plugin-tech-radar';
import { TechdocsPage } from '@backstage/plugin-techdocs';
import {
DefaultTechDocsHome,
TechDocsIndexPage,
TechDocsReaderPage,
} from '@backstage/plugin-techdocs';
import { UserSettingsPage } from '@backstage/plugin-user-settings';
import AlarmIcon from '@material-ui/icons/Alarm';
import React from 'react';
@@ -54,6 +66,7 @@ import { apis } from './apis';
import { Root } from './components/Root';
import { entityPage } from './components/catalog/EntityPage';
import { searchPage } from './components/search/SearchPage';
import { LowerCaseValuePickerFieldExtension } from './components/scaffolder/customScaffolderExtensions';
import { providers } from './identityProviders';
import * as plugins from './plugins';
@@ -98,7 +111,7 @@ const AppRouter = app.getRouter();
const routes = (
<FlatRoutes>
<Navigate key="/" to="/catalog" />
<Navigate key="/" to="catalog" />
<Route path="/catalog" element={<CatalogIndexPage />} />
<Route
path="/catalog/:namespace/:kind/:name"
@@ -107,8 +120,22 @@ const routes = (
{entityPage}
</Route>
<Route path="/catalog-import" element={<CatalogImportPage />} />
<Route path="/docs" element={<TechdocsPage />} />
<Route path="/create" element={<ScaffolderPage />} />
<Route path="/docs" element={<TechDocsIndexPage />}>
<DefaultTechDocsHome />
</Route>
<Route
path="/docs/:namespace/:kind/:name/*"
element={<TechDocsReaderPage />}
/>
<Route path="/create" element={<ScaffolderPage />}>
<ScaffolderFieldExtensions>
<EntityPickerFieldExtension />
<EntityNamePickerFieldExtension />
<RepoUrlPickerFieldExtension />
<OwnerPickerFieldExtension />
<LowerCaseValuePickerFieldExtension />
</ScaffolderFieldExtensions>
</Route>
<Route path="/explore" element={<ExplorePage />} />
<Route
path="/tech-radar"
@@ -116,7 +143,6 @@ const routes = (
/>
<Route path="/graphiql" element={<GraphiQLPage />} />
<Route path="/lighthouse" element={<LighthousePage />} />
<Route path="/api-docs" element={<ApiExplorerPage />} />
<Route path="/gcp-projects" element={<GcpProjectsPage />} />
<Route path="/newrelic" element={<NewRelicPage />} />
+1 -1
View File
@@ -82,7 +82,7 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
<SidebarSearch />
<SidebarDivider />
{/* Global nav, not org-specific */}
<SidebarItem icon={HomeIcon} to="/catalog" text="Home" />
<SidebarItem icon={HomeIcon} to="catalog" text="Home" />
<SidebarItem icon={ExtensionIcon} to="api-docs" text="APIs" />
<SidebarItem icon={LibraryBooks} to="docs" text="Docs" />
<SidebarItem icon={LayersIcon} to="explore" text="Explore" />
@@ -40,6 +40,8 @@ import {
isKind,
EntityHasResourcesCard,
EntityOrphanWarning,
EntityProcessingErrorsPanel,
hasCatalogProcessingErrors,
isOrphan,
} from '@backstage/plugin-catalog';
import {
@@ -135,6 +137,13 @@ const EntityLayoutWrapper = (props: { children?: ReactNode }) => {
);
};
/**
* NOTE: This page is designed to work on small screens such as mobile devices.
* This is based on Material UI Grid. If breakpoints are used, each grid item must set the `xs` prop to a column size or to `true`,
* since this does not default. If no breakpoints are used, the items will equitably share the asvailable space.
* https://material-ui.com/components/grid/#basic-grid.
*/
export const cicdContent = (
<EntitySwitch>
<EntitySwitch.Case if={isJenkinsAvailable}>
@@ -224,6 +233,14 @@ const overviewContent = (
</EntitySwitch.Case>
</EntitySwitch>
<EntitySwitch>
<EntitySwitch.Case if={hasCatalogProcessingErrors}>
<Grid item xs={12}>
<EntityProcessingErrorsPanel />
</Grid>
</EntitySwitch.Case>
</EntitySwitch>
<Grid item md={8} xs={12}>
<EntityAboutCard variant="gridItem" />
</Grid>
@@ -292,10 +309,10 @@ const serviceEntityPage = (
<EntityLayout.Route path="/api" title="API">
<Grid container spacing={3} alignItems="stretch">
<Grid item md={6}>
<Grid item xs={12} md={6}>
<EntityProvidedApisCard />
</Grid>
<Grid item md={6}>
<Grid item xs={12} md={6}>
<EntityConsumedApisCard />
</Grid>
</Grid>
@@ -303,10 +320,10 @@ const serviceEntityPage = (
<EntityLayout.Route path="/dependencies" title="Dependencies">
<Grid container spacing={3} alignItems="stretch">
<Grid item md={6}>
<Grid item xs={12} md={6}>
<EntityDependsOnComponentsCard variant="gridItem" />
</Grid>
<Grid item md={6}>
<Grid item xs={12} md={6}>
<EntityDependsOnResourcesCard variant="gridItem" />
</Grid>
</Grid>
@@ -431,15 +448,17 @@ const apiPage = (
<EntityLayoutWrapper>
<EntityLayout.Route path="/" title="Overview">
<Grid container spacing={3}>
<Grid item md={6}>
<Grid item xs={12}>
<EntityAboutCard />
</Grid>
<Grid container item md={12}>
<Grid item md={6}>
<EntityProvidingComponentsCard />
</Grid>
<Grid item md={6}>
<EntityConsumingComponentsCard />
<Grid item xs={12}>
<Grid container>
<Grid item xs={12} md={6}>
<EntityProvidingComponentsCard />
</Grid>
<Grid item xs={12} md={6}>
<EntityConsumingComponentsCard />
</Grid>
</Grid>
</Grid>
</Grid>
@@ -0,0 +1,34 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { FieldValidation } from '@rjsf/core';
import {
createScaffolderFieldExtension,
TextValuePicker,
scaffolderPlugin,
} from '@backstage/plugin-scaffolder';
export const LowerCaseValuePickerFieldExtension = scaffolderPlugin.provide(
createScaffolderFieldExtension({
name: 'LowerCaseValuePicker',
component: TextValuePicker,
validation: (value: string, validation: FieldValidation) => {
if (value.toLowerCase() !== value) {
validation.addError('Only lowercase values are allowed.');
}
},
}),
);
@@ -14,35 +14,88 @@
* limitations under the License.
*/
import React from 'react';
import React, { useState } from 'react';
import { makeStyles, Theme, Grid, List, Paper } from '@material-ui/core';
import Pagination from '@material-ui/lab/Pagination';
import { CatalogResultListItem } from '@backstage/plugin-catalog';
import {
SearchBar,
SearchFilter,
SearchResult,
SearchType,
DefaultResultListItem,
} from '@backstage/plugin-search';
import { Content, Header, Lifecycle, Page } from '@backstage/core-components';
import { DocsResultListItem } from '@backstage/plugin-techdocs';
import { SearchResultSet } from '@backstage/search-common';
const useStyles = makeStyles((theme: Theme) => ({
bar: {
padding: theme.spacing(1, 0),
},
filters: {
padding: theme.spacing(2),
},
filter: {
'& + &': {
marginTop: theme.spacing(2.5),
},
},
filters: {
padding: theme.spacing(2),
},
}));
// TODO: Move this into the search plugin once pagination is natively supported.
// See: https://github.com/backstage/backstage/issues/6062
const SearchResultList = ({ results }: SearchResultSet) => {
const pageSize = 10;
const [page, setPage] = useState(1);
const changePage = (_: any, pageIndex: number) => {
setPage(pageIndex);
};
const pageAmount = Math.ceil((results.length || 0) / pageSize);
return (
<>
<List>
{results
.slice(pageSize * (page - 1), pageSize * page)
.map(({ type, document }) => {
switch (type) {
case 'software-catalog':
return (
<CatalogResultListItem
key={document.location}
result={document}
/>
);
case 'techdocs':
return (
<DocsResultListItem
key={document.location}
result={document}
/>
);
default:
return (
<DefaultResultListItem
key={document.location}
result={document}
/>
);
}
})}
</List>
<Pagination
count={pageAmount}
page={page}
onChange={changePage}
showFirstButton
showLastButton
/>
</>
);
};
const SearchPage = () => {
const classes = useStyles();
return (
<Page themeId="home">
<Header title="Search" subtitle={<Lifecycle alpha />} />
@@ -55,6 +108,11 @@ const SearchPage = () => {
</Grid>
<Grid item xs={3}>
<Paper className={classes.filters}>
<SearchType
values={['techdocs', 'software-catalog']}
name="type"
defaultValue="software-catalog"
/>
<SearchFilter.Select
className={classes.filter}
name="kind"
@@ -69,28 +127,7 @@ const SearchPage = () => {
</Grid>
<Grid item xs={9}>
<SearchResult>
{({ results }) => (
<List>
{results.map(({ type, document }) => {
switch (type) {
case 'software-catalog':
return (
<CatalogResultListItem
key={document.location}
result={document}
/>
);
default:
return (
<DefaultResultListItem
key={document.location}
result={document}
/>
);
}
})}
</List>
)}
{({ results }) => <SearchResultList results={results} />}
</SearchResult>
</Grid>
</Grid>
+36
View File
@@ -1,5 +1,41 @@
# @backstage/backend-common
## 0.8.9
### Patch Changes
- f7ce7c565: Use a more informative error message when URL reading isn't allowed due to no reader matching the target URL.
- ce1958021: Pass on credentials to the integrations package, so that it can properly pick the API route when using GitHub apps based auth
- Updated dependencies
- @backstage/integration@0.6.0
## 0.8.8
### Patch Changes
- 6aa7c3db7: bump node-tar version to the latest
- Updated dependencies
- @backstage/config@0.1.6
- @backstage/integration@0.5.9
- @backstage/config-loader@0.6.6
## 0.8.7
### Patch Changes
- f25357273: Implement the etag functionality in the `readUrl` method of `FetchUrlReader`.
- bdd6ab5f1: It's possible to customize the request logging handler when building the service. For example in your `backend`
```
const service = createServiceBuilder(module)
.loadConfig(config)
.setRequestLoggingHandler((logger?: Logger): RequestHandler => {
const actualLogger = (logger || getRootLogger()).child({
type: 'incomingRequest',
});
return expressWinston.logger({ ...
```
## 0.8.6
### Patch Changes
+11
View File
@@ -439,6 +439,13 @@ export type ReadTreeResponseFile = {
// @public
export function requestLoggingHandler(logger?: Logger_2): RequestHandler;
// Warning: (ae-missing-release-tag) "RequestLoggingHandlerFactory" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type RequestLoggingHandlerFactory = (
logger?: Logger_2,
) => RequestHandler;
// Warning: (ae-missing-release-tag) "resolvePackagePath" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
@@ -492,6 +499,9 @@ export type ServiceBuilder = {
enableCors(options: cors.CorsOptions): ServiceBuilder;
setHttpsSettings(settings: HttpsSettings): ServiceBuilder;
addRouter(root: string, router: Router | RequestHandler): ServiceBuilder;
setRequestLoggingHandler(
requestLoggingHandler: RequestLoggingHandlerFactory,
): ServiceBuilder;
start(): Promise<Server>;
};
@@ -593,6 +603,7 @@ export function useHotMemoize<T>(_module: NodeModule, valueFactory: () => T): T;
// src/service/types.d.ts:57:5 - (ae-forgotten-export) The symbol "HttpsSettings" needs to be exported by the entry point index.d.ts
// src/service/types.d.ts:61:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// src/service/types.d.ts:62:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// src/service/types.d.ts:70:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// (No @packageDocumentation comment for this package)
```
+9 -7
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/backend-common",
"description": "Common functionality library for Backstage backends",
"version": "0.8.6",
"version": "0.8.9",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -30,16 +30,17 @@
},
"dependencies": {
"@backstage/cli-common": "^0.1.2",
"@backstage/config": "^0.1.5",
"@backstage/config-loader": "^0.6.5",
"@backstage/config": "^0.1.6",
"@backstage/config-loader": "^0.6.6",
"@backstage/errors": "^0.1.1",
"@backstage/integration": "^0.5.8",
"@backstage/integration": "^0.6.0",
"@google-cloud/storage": "^5.8.0",
"@octokit/rest": "^18.5.3",
"@types/cors": "^2.8.6",
"@types/dockerode": "^3.2.1",
"@types/express": "^4.17.6",
"archiver": "^5.0.2",
"aws-sdk": "^2.840.0",
"compression": "^1.7.4",
"concat-stream": "^2.0.0",
"cors": "^2.8.5",
@@ -62,7 +63,7 @@
"raw-body": "^2.4.1",
"selfsigned": "^1.10.7",
"stoppable": "^1.1.0",
"tar": "^6.0.5",
"tar": "^6.1.2",
"unzipper": "^0.10.11",
"winston": "^3.2.1",
"yn": "^4.0.0"
@@ -76,8 +77,8 @@
}
},
"devDependencies": {
"@backstage/cli": "^0.7.4",
"@backstage/test-utils": "^0.1.12",
"@backstage/cli": "^0.7.8",
"@backstage/test-utils": "^0.1.17",
"@types/archiver": "^5.1.0",
"@types/compression": "^1.7.0",
"@types/concat-stream": "^1.6.0",
@@ -92,6 +93,7 @@
"@types/tar": "^4.0.3",
"@types/unzipper": "^0.10.3",
"@types/webpack-env": "^1.15.2",
"aws-sdk-mock": "^5.2.1",
"get-port": "^5.1.1",
"http-errors": "^1.7.3",
"jest": "^26.0.1",
+4 -4
View File
@@ -104,7 +104,7 @@ describe('CacheManager', () => {
manager.forPlugin(plugin2Id).getClient({ defaultTtl: expectedTtl });
const client = DefaultCacheClient as jest.Mock;
const cache = (Keyv as unknown) as jest.Mock;
const cache = Keyv as unknown as jest.Mock;
expect(cache).toHaveBeenCalledTimes(2);
expect(client).toHaveBeenCalledTimes(2);
@@ -124,7 +124,7 @@ describe('CacheManager', () => {
const expectedNamespace = 'test-plugin';
manager.forPlugin(expectedNamespace).getClient();
const cache = (Keyv as unknown) as jest.Mock;
const cache = Keyv as unknown as jest.Mock;
const mockCalls = cache.mock.calls.splice(-1);
const callArgs = mockCalls[0];
expect(callArgs[0].store).toBeInstanceOf(NoStore);
@@ -138,7 +138,7 @@ describe('CacheManager', () => {
.forPlugin(expectedNamespace)
.getClient({ defaultTtl: expectedTtl });
const cache = (Keyv as unknown) as jest.Mock;
const cache = Keyv as unknown as jest.Mock;
const mockCalls = cache.mock.calls.splice(-1);
const callArgs = mockCalls[0];
expect(callArgs[0]).toMatchObject({
@@ -162,7 +162,7 @@ describe('CacheManager', () => {
const expectedTtl = 3600;
manager.forPlugin('test').getClient({ defaultTtl: expectedTtl });
const cache = (Keyv as unknown) as jest.Mock;
const cache = Keyv as unknown as jest.Mock;
const mockCacheCalls = cache.mock.calls.splice(-1);
expect(mockCacheCalls[0][0]).toMatchObject({
ttl: expectedTtl,
@@ -110,9 +110,7 @@ export class DatabaseManager {
* @returns Object with client type returned as `client` and boolean representing whether
* or not the client was overridden as `overridden`
*/
private getClientType(
pluginId: string,
): {
private getClientType(pluginId: string): {
client: string;
overridden: boolean;
} {
@@ -149,7 +149,7 @@ export async function ensureMysqlDatabaseExists(
) {
const admin = createMysqlDatabaseClient(dbConfig, {
connection: {
database: (null as unknown) as string,
database: null as unknown as string,
},
});
@@ -0,0 +1,232 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ConfigReader, JsonObject } from '@backstage/config';
import { getVoidLogger } from '../logging';
import { DefaultReadTreeResponseFactory } from './tree';
import { AwsS3UrlReader } from './AwsS3UrlReader';
import {
AwsS3Integration,
readAwsS3IntegrationConfig,
} from '@backstage/integration';
import { UrlReaderPredicateTuple } from './types';
import AWSMock from 'aws-sdk-mock';
import aws from 'aws-sdk';
import path from 'path';
describe('AwsS3UrlReader', () => {
const createReader = (config: JsonObject): UrlReaderPredicateTuple[] => {
return AwsS3UrlReader.factory({
config: new ConfigReader(config),
logger: getVoidLogger(),
treeResponseFactory: DefaultReadTreeResponseFactory.create({
config: new ConfigReader({}),
}),
});
};
afterEach(() => {
AWSMock.restore();
});
it('creates a dummy reader without the awsS3 field', () => {
const entries = createReader({
integrations: {},
});
expect(entries).toHaveLength(1);
});
it('creates a reader with credentials correctly configured', () => {
const awsS3Integrations = [];
awsS3Integrations.push({
host: 'amazonaws.com',
accessKeyId: 'fakekey',
secretAccessKey: 'fakekey',
});
const entries = createReader({
integrations: {
awsS3: awsS3Integrations,
},
});
expect(entries).toHaveLength(1);
});
it('creates a reader with default credentials provider', () => {
const awsS3Integrations = [];
awsS3Integrations.push({
host: 'amazonaws.com',
});
const entries = createReader({
integrations: {
awsS3: awsS3Integrations,
},
});
expect(entries).toHaveLength(1);
});
describe('predicates', () => {
const readers = createReader({
integrations: {
awsS3: [{}],
},
});
const predicate = readers[0].predicate;
it('returns true for the correct aws s3 storage host', () => {
expect(
predicate(new URL('https://test-bucket.s3.us-east-2.amazonaws.com')),
).toBe(true);
});
it('returns true for a url with the full path and the correct host', () => {
expect(
predicate(
new URL(
'https://test-bucket.s3.us-east-2.amazonaws.com/team/service/catalog-info.yaml',
),
),
).toBe(true);
});
it('returns false for an incorrect host', () => {
expect(predicate(new URL('https://amazon.com'))).toBe(false);
});
it('returns false for a completely different host', () => {
expect(predicate(new URL('https://storage.cloud.google.com'))).toBe(
false,
);
});
it("returns true for a url with a bucket with '.'", () => {
expect(
predicate(
new URL(
'https://test.bucket.s3.us-east-2.amazonaws.com/team/service/catalog-info.yaml',
),
),
).toBe(true);
});
});
describe('read', () => {
AWSMock.setSDKInstance(aws);
AWSMock.mock(
'S3',
'getObject',
Buffer.from(
require('fs').readFileSync(
path.resolve(
'src',
'reading',
'__fixtures__',
'awsS3-mock-object.yaml',
),
),
),
);
const s3 = new aws.S3();
const awsS3UrlReader = new AwsS3UrlReader(
new AwsS3Integration(
readAwsS3IntegrationConfig(
new ConfigReader({
host: 'amazonaws.com',
accessKeyId: 'fake-access-key',
secretAccessKey: 'fake-secret-key',
}),
),
),
s3,
);
it('returns contents of an object in a bucket', async () => {
const response = await awsS3UrlReader.read(
'https://test-bucket.s3.us-east-2.amazonaws.com/awsS3-mock-object.yaml',
);
expect(response.toString()).toBe('site_name: Test\n');
});
it('rejects unknown targets', async () => {
await expect(
awsS3UrlReader.read(
'https://test-bucket.s3.us-east-2.NOTamazonaws.com/file.yaml',
),
).rejects.toThrow(
Error(
`Could not retrieve file from S3: not a valid AWS S3 URL: https://test-bucket.s3.us-east-2.NOTamazonaws.com/file.yaml`,
),
);
});
});
describe('readUrl', () => {
AWSMock.setSDKInstance(aws);
AWSMock.mock(
'S3',
'getObject',
Buffer.from(
require('fs').readFileSync(
path.resolve(
'src',
'reading',
'__fixtures__',
'awsS3-mock-object.yaml',
),
),
),
);
const s3 = new aws.S3();
const awsS3UrlReader = new AwsS3UrlReader(
new AwsS3Integration(
readAwsS3IntegrationConfig(
new ConfigReader({
host: 'amazonaws.com',
accessKeyId: 'fake-access-key',
secretAccessKey: 'fake-secret-key',
}),
),
),
s3,
);
it('returns contents of an object in a bucket', async () => {
const response = await awsS3UrlReader.readUrl(
'https://test-bucket.s3.us-east-2.amazonaws.com/awsS3-mock-object.yaml',
);
const buffer = await response.buffer();
expect(buffer.toString()).toBe('site_name: Test\n');
});
it('rejects unknown targets', async () => {
await expect(
awsS3UrlReader.readUrl(
'https://test-bucket.s3.us-east-2.NOTamazonaws.com/file.yaml',
),
).rejects.toThrow(
Error(
`Could not retrieve file from S3: not a valid AWS S3 URL: https://test-bucket.s3.us-east-2.NOTamazonaws.com/file.yaml`,
),
);
});
});
});
@@ -0,0 +1,175 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import aws, { Credentials, S3 } from 'aws-sdk';
import { CredentialsOptions } from 'aws-sdk/lib/credentials';
import {
ReaderFactory,
ReadTreeResponse,
ReadUrlOptions,
ReadUrlResponse,
SearchResponse,
UrlReader,
} from './types';
import getRawBody from 'raw-body';
import { AwsS3Integration, ScmIntegrations } from '@backstage/integration';
const parseURL = (
url: string,
): { path: string; bucket: string; region: string } => {
let { host, pathname } = new URL(url);
/**
* Removes the leading '/' from the pathname to be processed
* as a parameter by AWS S3 SDK getObject method.
*/
pathname = pathname.substr(1);
/**
* Checks that the given URL is a valid S3 object url.
* Format of a Valid S3 URL: https://bucket-name.s3.Region.amazonaws.com/keyname
*/
const validHost = new RegExp(
/^[a-z\d][a-z\d\.-]{1,61}[a-z\d]\.s3\.[a-z\d-]+\.amazonaws.com$/,
);
if (!validHost.test(host)) {
throw new Error(`not a valid AWS S3 URL: ${url}`);
}
const [bucket] = host.split(/\.s3\.[a-z\d-]+\.amazonaws.com/);
host = host.substring(bucket.length);
const [, , region, ,] = host.split('.');
return {
path: pathname,
bucket: bucket,
region: region,
};
};
export class AwsS3UrlReader implements UrlReader {
static factory: ReaderFactory = ({ config }) => {
const integrations = ScmIntegrations.fromConfig(config);
return integrations.awsS3.list().map(integration => {
const creds = AwsS3UrlReader.buildCredentials(integration);
const s3 = new S3({
apiVersion: '2006-03-01',
credentials: creds,
});
const reader = new AwsS3UrlReader(integration, s3);
const predicate = (url: URL) =>
url.host.endsWith(integration.config.host);
return { reader, predicate };
});
};
constructor(
private readonly integration: AwsS3Integration,
private readonly s3: S3,
) {}
/**
* If accesKeyId and secretAccessKey are missing, the standard credentials provider chain will be used:
* https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html
*/
private static buildCredentials(
integration?: AwsS3Integration,
): Credentials | CredentialsOptions | undefined {
if (!integration) {
return undefined;
}
const accessKeyId = integration.config.accessKeyId;
const secretAccessKey = integration.config.secretAccessKey;
let explicitCredentials: Credentials | undefined;
if (accessKeyId && secretAccessKey) {
explicitCredentials = new Credentials({
accessKeyId,
secretAccessKey,
});
}
const roleArn = integration.config.roleArn;
if (roleArn) {
return new aws.ChainableTemporaryCredentials({
masterCredentials: explicitCredentials,
params: {
RoleSessionName: 'backstage-aws-s3-url-reader',
RoleArn: roleArn,
},
});
}
return explicitCredentials;
}
async read(url: string): Promise<Buffer> {
const response = await this.readUrl(url);
return response.buffer();
}
async readUrl(
url: string,
options?: ReadUrlOptions,
): Promise<ReadUrlResponse> {
try {
const { path, bucket, region } = parseURL(url);
aws.config.update({ region: region });
let params;
if (options?.etag) {
params = {
Bucket: bucket,
Key: path,
IfNoneMatch: options.etag,
};
} else {
params = {
Bucket: bucket,
Key: path,
};
}
const response = this.s3.getObject(params);
const buffer = await getRawBody(response.createReadStream());
const etag = (await response.promise()).ETag;
return {
buffer: async () => buffer,
etag: etag,
};
} catch (e) {
throw new Error(`Could not retrieve file from S3: ${e.message}`);
}
}
async readTree(): Promise<ReadTreeResponse> {
throw new Error('AwsS3Reader does not implement readTree');
}
async search(): Promise<SearchResponse> {
throw new Error('AwsS3Reader does not implement search');
}
toString() {
const secretAccessKey = this.integration.config.secretAccessKey;
return `awsS3{host=${this.integration.config.host},authed=${Boolean(
secretAccessKey,
)}}`;
}
}
@@ -78,21 +78,17 @@ describe('AzureUrlReader', () => {
it.each([
{
url:
'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml&version=GBmaster',
url: 'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml&version=GBmaster',
config: createConfig(),
response: expect.objectContaining({
url:
'https://dev.azure.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml&version=master',
url: 'https://dev.azure.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml&version=master',
}),
},
{
url:
'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml',
url: 'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml',
config: createConfig(),
response: expect.objectContaining({
url:
'https://dev.azure.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml',
url: 'https://dev.azure.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml',
}),
},
{
@@ -129,7 +129,7 @@ export class AzureUrlReader implements UrlReader {
}
return await this.deps.treeResponseFactory.fromZipArchive({
stream: (archiveAzureResponse.body as unknown) as Readable,
stream: archiveAzureResponse.body as unknown as Readable,
etag: commitSha,
filter: options?.filter,
});
@@ -60,13 +60,8 @@ export class BitbucketUrlReader implements UrlReader {
private readonly integration: BitbucketIntegration,
private readonly deps: { treeResponseFactory: ReadTreeResponseFactory },
) {
const {
host,
apiBaseUrl,
token,
username,
appPassword,
} = integration.config;
const { host, apiBaseUrl, token, username, appPassword } =
integration.config;
if (!apiBaseUrl) {
throw new Error(
@@ -138,7 +133,7 @@ export class BitbucketUrlReader implements UrlReader {
}
return await this.deps.treeResponseFactory.fromTarArchive({
stream: (archiveBitbucketResponse.body as unknown) as Readable,
stream: archiveBitbucketResponse.body as unknown as Readable,
subpath: filepath,
etag: lastCommitShortHash,
filter: options?.filter,
@@ -15,12 +15,16 @@
*/
import { ConfigReader } from '@backstage/config';
import { NotFoundError, NotModifiedError } from '@backstage/errors';
import { msw } from '@backstage/test-utils';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { getVoidLogger } from '../logging';
import { FetchUrlReader } from './FetchUrlReader';
import { DefaultReadTreeResponseFactory } from './tree';
const fetchUrlReader = new FetchUrlReader();
describe('FetchUrlReader', () => {
const worker = setupServer();
@@ -30,6 +34,39 @@ describe('FetchUrlReader', () => {
jest.clearAllMocks();
});
beforeEach(() => {
worker.use(
rest.get('https://backstage.io/some-resource', (req, res, ctx) => {
if (req.headers.get('if-none-match') === 'foo') {
return res(
ctx.status(304),
ctx.set('Content-Type', 'text/plain'),
ctx.set('etag', 'foo'),
);
}
return res(
ctx.status(200),
ctx.set('Content-Type', 'text/plain'),
ctx.set('etag', 'foo'),
ctx.body('content foo'),
);
}),
);
worker.use(
rest.get('https://backstage.io/not-exists', (_req, res, ctx) => {
return res(ctx.status(404));
}),
);
worker.use(
rest.get('https://backstage.io/error', (_req, res, ctx) => {
return res(ctx.status(500), ctx.body('An internal error occured'));
}),
);
});
it('factory should create a single entry with a predicate that matches config', async () => {
const entries = FetchUrlReader.factory({
config: new ConfigReader({
@@ -70,4 +107,55 @@ describe('FetchUrlReader', () => {
expect(predicate(new URL('https://a.examples.org:700/test'))).toBe(true);
expect(predicate(new URL('https://a.b.examples.org:700/test'))).toBe(true);
});
describe('read', () => {
it('should return etag from the response', async () => {
const buffer = await fetchUrlReader.read(
'https://backstage.io/some-resource',
);
expect(buffer.toString()).toBe('content foo');
});
it('should throw NotFound if server responds with 404', async () => {
await expect(
fetchUrlReader.read('https://backstage.io/not-exists'),
).rejects.toThrow(NotFoundError);
});
it('should throw Error if server responds with 500', async () => {
await expect(
fetchUrlReader.read('https://backstage.io/error'),
).rejects.toThrow(Error);
});
});
describe('readUrl', () => {
it('should throw NotModified if server responds with 304', async () => {
await expect(
fetchUrlReader.readUrl('https://backstage.io/some-resource', {
etag: 'foo',
}),
).rejects.toThrow(NotModifiedError);
});
it('should return etag from the response', async () => {
const response = await fetchUrlReader.readUrl(
'https://backstage.io/some-resource',
);
expect(response.etag).toBe('foo');
expect((await response.buffer()).toString()).toEqual('content foo');
});
it('should throw NotFound if server responds with 404', async () => {
await expect(
fetchUrlReader.readUrl('https://backstage.io/not-exists'),
).rejects.toThrow(NotFoundError);
});
it('should throw Error if server responds with 500', async () => {
await expect(
fetchUrlReader.readUrl('https://backstage.io/error'),
).rejects.toThrow(Error);
});
});
});
@@ -14,8 +14,8 @@
* limitations under the License.
*/
import { NotFoundError, NotModifiedError } from '@backstage/errors';
import fetch from 'cross-fetch';
import { NotFoundError } from '@backstage/errors';
import {
ReaderFactory,
ReadTreeResponse,
@@ -57,15 +57,34 @@ export class FetchUrlReader implements UrlReader {
};
async read(url: string): Promise<Buffer> {
const response = await this.readUrl(url);
return response.buffer();
}
async readUrl(
url: string,
options?: ReadUrlOptions,
): Promise<ReadUrlResponse> {
let response: Response;
try {
response = await fetch(url);
response = await fetch(url, {
headers: {
...(options?.etag && { 'If-None-Match': options.etag }),
},
});
} catch (e) {
throw new Error(`Unable to read ${url}, ${e}`);
}
if (response.status === 304) {
throw new NotModifiedError();
}
if (response.ok) {
return Buffer.from(await response.text());
return {
buffer: async () => Buffer.from(await response.text()),
etag: response.headers.get('ETag') ?? undefined,
};
}
const message = `could not read ${url}, ${response.status} ${response.statusText}`;
@@ -75,15 +94,6 @@ export class FetchUrlReader implements UrlReader {
throw new Error(message);
}
async readUrl(
url: string,
_options?: ReadUrlOptions,
): Promise<ReadUrlResponse> {
// TODO etag is not implemented yet.
const buffer = await this.read(url);
return { buffer: async () => buffer };
}
async readTree(): Promise<ReadTreeResponse> {
throw new Error('FetchUrlReader does not implement readTree');
}
@@ -41,9 +41,9 @@ const treeResponseFactory = DefaultReadTreeResponseFactory.create({
config: new ConfigReader({}),
});
const mockCredentialsProvider = ({
const mockCredentialsProvider = {
getCredentials: jest.fn().mockResolvedValue({ headers: {} }),
} as unknown) as GithubCredentialsProvider;
} as unknown as GithubCredentialsProvider;
const githubProcessor = new GithubUrlReader(
new GitHubIntegration(
@@ -39,10 +39,14 @@ import {
ReadUrlResponse,
} from './types';
export type GhRepoResponse = RestEndpointMethodTypes['repos']['get']['response']['data'];
export type GhBranchResponse = RestEndpointMethodTypes['repos']['getBranch']['response']['data'];
export type GhTreeResponse = RestEndpointMethodTypes['git']['getTree']['response']['data'];
export type GhBlobResponse = RestEndpointMethodTypes['git']['getBlob']['response']['data'];
export type GhRepoResponse =
RestEndpointMethodTypes['repos']['get']['response']['data'];
export type GhBranchResponse =
RestEndpointMethodTypes['repos']['getBranch']['response']['data'];
export type GhTreeResponse =
RestEndpointMethodTypes['git']['getTree']['response']['data'];
export type GhBlobResponse =
RestEndpointMethodTypes['git']['getBlob']['response']['data'];
/**
* A processor that adds the ability to read files from GitHub v3 APIs, such as
@@ -87,15 +91,20 @@ export class GithubUrlReader implements UrlReader {
url: string,
options?: ReadUrlOptions,
): Promise<ReadUrlResponse> {
const ghUrl = getGitHubFileFetchUrl(url, this.integration.config);
const { headers } = await this.deps.credentialsProvider.getCredentials({
const credentials = await this.deps.credentialsProvider.getCredentials({
url,
});
const ghUrl = getGitHubFileFetchUrl(
url,
this.integration.config,
credentials,
);
let response: Response;
try {
response = await fetch(ghUrl.toString(), {
response = await fetch(ghUrl, {
headers: {
...headers,
...credentials?.headers,
...(options?.etag && { 'If-None-Match': options.etag }),
Accept: 'application/vnd.github.v3.raw',
},
@@ -195,7 +204,7 @@ export class GithubUrlReader implements UrlReader {
return await this.deps.treeResponseFactory.fromTarArchive({
// TODO(Rugvip): Underlying implementation of fetch will be node-fetch, we probably want
// to stick to using that in exclusively backend code.
stream: (archive.body as unknown) as Readable,
stream: archive.body as unknown as Readable,
subpath,
etag: sha,
filter: options?.filter,
@@ -258,9 +267,7 @@ export class GithubUrlReader implements UrlReader {
}));
}
private async getRepoDetails(
url: string,
): Promise<{
private async getRepoDetails(url: string): Promise<{
repo: GhRepoResponse;
branch: GhBranchResponse;
}> {
@@ -108,36 +108,30 @@ describe('GitlabUrlReader', () => {
it.each([
// Project URLs
{
url:
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file.yaml',
url: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file.yaml',
config: createConfig(),
response: expect.objectContaining({
url:
'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile.yaml/raw?ref=branch',
url: 'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile.yaml/raw?ref=branch',
headers: expect.objectContaining({
'private-token': '',
}),
}),
},
{
url:
'https://gitlab.example.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file.yaml',
url: 'https://gitlab.example.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file.yaml',
config: createConfig('0123456789'),
response: expect.objectContaining({
url:
'https://gitlab.example.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile.yaml/raw?ref=branch',
url: 'https://gitlab.example.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile.yaml/raw?ref=branch',
headers: expect.objectContaining({
'private-token': '0123456789',
}),
}),
},
{
url:
'https://gitlab.com/groupA/teams/teamA/repoA/-/blob/branch/my/path/to/file.yaml', // Repo not in subgroup
url: 'https://gitlab.com/groupA/teams/teamA/repoA/-/blob/branch/my/path/to/file.yaml', // Repo not in subgroup
config: createConfig(),
response: expect.objectContaining({
url:
'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile.yaml/raw?ref=branch',
url: 'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile.yaml/raw?ref=branch',
}),
},
@@ -170,7 +170,7 @@ export class GitlabUrlReader implements UrlReader {
}
return await this.deps.treeResponseFactory.fromTarArchive({
stream: (archiveGitLabResponse.body as unknown) as Readable,
stream: archiveGitLabResponse.body as unknown as Readable,
subpath: filepath,
etag: commitSha,
filter: options?.filter,
@@ -52,7 +52,11 @@ export class UrlReaderPredicateMux implements UrlReader {
}
}
throw new NotAllowedError(`Reading from '${url}' is not allowed`);
throw new NotAllowedError(
`Reading from '${url}' is not allowed. ` +
`You may need to configure an integration for the target host, or add it ` +
`to the configured list of allowed hosts at 'backend.reading.allow'`,
);
}
async readUrl(
@@ -25,6 +25,7 @@ import { GitlabUrlReader } from './GitlabUrlReader';
import { DefaultReadTreeResponseFactory } from './tree';
import { FetchUrlReader } from './FetchUrlReader';
import { GoogleGcsUrlReader } from './GoogleGcsUrlReader';
import { AwsS3UrlReader } from './AwsS3UrlReader';
type CreateOptions = {
/** Root config object */
@@ -74,6 +75,7 @@ export class UrlReaders {
GithubUrlReader.factory,
GitlabUrlReader.factory,
GoogleGcsUrlReader.factory,
AwsS3UrlReader.factory,
FetchUrlReader.factory,
]),
});
@@ -0,0 +1 @@
site_name: Test
@@ -28,7 +28,7 @@ import {
import { stripFirstDirectoryFromPath } from './util';
// Tar types for `Parse` is not a proper constructor, but it should be
const TarParseStream = (Parse as unknown) as { new (): ParseStream };
const TarParseStream = Parse as unknown as { new (): ParseStream };
const pipeline = promisify(pipelineCb);
+9 -9
View File
@@ -123,9 +123,9 @@ describe('Git', () => {
await git.clone({ url, dir });
const { onAuth } = ((isomorphic.clone as unknown) as jest.Mock<
typeof isomorphic['clone']
>).mock.calls[0][0]!;
const { onAuth } = (
isomorphic.clone as unknown as jest.Mock<typeof isomorphic['clone']>
).mock.calls[0][0]!;
expect(onAuth()).toEqual(auth);
});
@@ -190,9 +190,9 @@ describe('Git', () => {
await git.fetch({ remote, dir });
const { onAuth } = ((isomorphic.fetch as unknown) as jest.Mock<
typeof isomorphic['fetch']
>).mock.calls[0][0]!;
const { onAuth } = (
isomorphic.fetch as unknown as jest.Mock<typeof isomorphic['fetch']>
).mock.calls[0][0]!;
expect(onAuth()).toEqual(auth);
});
@@ -279,9 +279,9 @@ describe('Git', () => {
await git.push({ remote, dir });
const { onAuth } = ((isomorphic.push as unknown) as jest.Mock<
typeof isomorphic['push']
>).mock.calls[0][0]!;
const { onAuth } = (
isomorphic.push as unknown as jest.Mock<typeof isomorphic['push']>
).mock.calls[0][0]!;
expect(onAuth()).toEqual(auth);
});
+1 -1
View File
@@ -16,4 +16,4 @@
export { createServiceBuilder } from './createServiceBuilder';
export { createStatusCheckRouter } from './createStatusCheckRouter';
export type { ServiceBuilder } from './types';
export type { ServiceBuilder, RequestLoggingHandlerFactory } from './types';
@@ -27,9 +27,9 @@ import { getRootLogger } from '../../logging';
import {
errorHandler,
notFoundHandler,
requestLoggingHandler,
requestLoggingHandler as defaultRequestLoggingHandler,
} from '../../middleware';
import { ServiceBuilder } from '../types';
import { RequestLoggingHandlerFactory, ServiceBuilder } from '../types';
import {
CspOptions,
HttpsSettings,
@@ -65,6 +65,7 @@ export class ServiceBuilderImpl implements ServiceBuilder {
private cspOptions: Record<string, string[] | false> | undefined;
private httpsSettings: HttpsSettings | undefined;
private routers: [string, Router][];
private requestLoggingHandler: RequestLoggingHandlerFactory | undefined;
// Reference to the module where builder is created - needed for hot module
// reloading
private module: NodeModule;
@@ -144,23 +145,26 @@ export class ServiceBuilderImpl implements ServiceBuilder {
return this;
}
setRequestLoggingHandler(
requestLoggingHandler: RequestLoggingHandlerFactory,
) {
this.requestLoggingHandler = requestLoggingHandler;
return this;
}
async start(): Promise<http.Server> {
const app = express();
const {
port,
host,
logger,
corsOptions,
httpsSettings,
helmetOptions,
} = this.getOptions();
const { port, host, logger, corsOptions, httpsSettings, helmetOptions } =
this.getOptions();
app.use(helmet(helmetOptions));
if (corsOptions) {
app.use(cors(corsOptions));
}
app.use(compression());
app.use(requestLoggingHandler(logger));
app.use(
(this.requestLoggingHandler ?? defaultRequestLoggingHandler)(logger),
);
for (const [root, route] of this.routers) {
app.use(root, route);
}
@@ -85,8 +85,21 @@ export type ServiceBuilder = {
*/
addRouter(root: string, router: Router | RequestHandler): ServiceBuilder;
/**
* Set the request logging handler
*
* If no handler is given the default one is used
*
* @param requestLoggingHandler a factory function that given a logger returns an handler
*/
setRequestLoggingHandler(
requestLoggingHandler: RequestLoggingHandlerFactory,
): ServiceBuilder;
/**
* Starts the server using the given settings.
*/
start(): Promise<Server>;
};
export type RequestLoggingHandlerFactory = (logger?: Logger) => RequestHandler;
@@ -92,18 +92,17 @@ export class DockerContainerRunner implements ContainerRunner {
Env.push(`${key}=${value}`);
}
const [
{ Error: error, StatusCode: statusCode },
] = await this.dockerClient.run(imageName, args, logStream, {
Volumes,
HostConfig: {
Binds,
},
...(workingDir ? { WorkingDir: workingDir } : {}),
Entrypoint: command,
Env,
...userOptions,
} as Docker.ContainerCreateOptions);
const [{ Error: error, StatusCode: statusCode }] =
await this.dockerClient.run(imageName, args, logStream, {
Volumes,
HostConfig: {
Binds,
},
...(workingDir ? { WorkingDir: workingDir } : {}),
Entrypoint: command,
Env,
...userOptions,
} as Docker.ContainerCreateOptions);
if (error) {
throw new Error(
+10
View File
@@ -1,5 +1,15 @@
# @backstage/backend-test-utils
## 0.1.5
### Patch Changes
- 524045758: Make sure that the unique databases names generated by `TestDatabases.create()`
don't collide.
- Updated dependencies
- @backstage/backend-common@0.8.9
- @backstage/cli@0.7.8
## 0.1.4
### Patch Changes
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/backend-test-utils",
"description": "Test helpers library for Backstage backends",
"version": "0.1.4",
"version": "0.1.5",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -30,8 +30,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/backend-common": "^0.8.5",
"@backstage/cli": "^0.7.1",
"@backstage/backend-common": "^0.8.9",
"@backstage/cli": "^0.7.8",
"@backstage/config": "^0.1.5",
"knex": "^0.95.1",
"mysql2": "^2.2.5",
@@ -41,7 +41,7 @@
"uuid": "^8.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.7.1",
"@backstage/cli": "^0.7.8",
"jest": "^26.0.1"
},
"files": [
@@ -71,7 +71,7 @@ describe('TestDatabases', () => {
await input.insert({ x: 'y' }).into('a');
// Look for the mark
const database = 'backstage_plugin_db0';
const database = input.client.config.connection.database;
const output = knexFactory({
client: 'pg',
connection: { host, port, user, password, database },
@@ -105,7 +105,7 @@ describe('TestDatabases', () => {
await input.insert({ x: 'y' }).into('a');
// Look for the mark
const database = 'backstage_plugin_db0';
const database = input.client.config.connection.database;
const output = knexFactory({
client: 'pg',
connection: { host, port, user, password, database },
@@ -139,7 +139,7 @@ describe('TestDatabases', () => {
await input.insert({ x: 'y' }).into('a');
// Look for the mark
const database = 'backstage_plugin_db0';
const database = input.client.config.connection.database;
const output = knexFactory({
client: 'mysql2',
connection: { host, port, user, password, database },
@@ -16,6 +16,7 @@
import { DatabaseManager } from '@backstage/backend-common';
import { ConfigReader } from '@backstage/config';
import { randomBytes } from 'crypto';
import { Knex } from 'knex';
import { isDockerDisabledForTests } from '../util/isDockerDisabledForTests';
import { startMysqlContainer } from './startMysqlContainer';
@@ -34,7 +35,6 @@ import {
export class TestDatabases {
private readonly instanceById: Map<string, Instance>;
private readonly supportedIds: TestDatabaseId[];
private lastDatabaseIndex: number;
/**
* Creates an empty `TestDatabases` instance, and sets up Jest to clean up
@@ -99,7 +99,6 @@ export class TestDatabases {
private constructor(supportedIds: TestDatabaseId[]) {
this.instanceById = new Map();
this.supportedIds = supportedIds;
this.lastDatabaseIndex = 0;
}
supports(id: TestDatabaseId): boolean {
@@ -142,7 +141,7 @@ export class TestDatabases {
// Ensure that a unique logical database is created in the instance
const connection = await instance.databaseManager
.forPlugin(String(`db${this.lastDatabaseIndex++}`))
.forPlugin(`db${randomBytes(16).toString('hex')}`)
.getClient();
instance.connections.push(connection);
@@ -38,33 +38,31 @@ export type Instance = {
databaseManager: DatabaseManager;
connections: Array<Knex>;
};
export const allDatabases: Record<
TestDatabaseId,
TestDatabaseProperties
> = Object.freeze({
POSTGRES_13: {
name: 'Postgres 13.x',
driver: 'pg',
dockerImageName: 'postgres:13',
connectionStringEnvironmentVariableName:
'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING',
},
POSTGRES_9: {
name: 'Postgres 9.x',
driver: 'pg',
dockerImageName: 'postgres:9',
connectionStringEnvironmentVariableName:
'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING',
},
MYSQL_8: {
name: 'MySQL 8.x',
driver: 'mysql2',
dockerImageName: 'mysql:8',
connectionStringEnvironmentVariableName:
'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING',
},
SQLITE_3: {
name: 'SQLite 3.x',
driver: 'sqlite3',
},
});
export const allDatabases: Record<TestDatabaseId, TestDatabaseProperties> =
Object.freeze({
POSTGRES_13: {
name: 'Postgres 13.x',
driver: 'pg',
dockerImageName: 'postgres:13',
connectionStringEnvironmentVariableName:
'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING',
},
POSTGRES_9: {
name: 'Postgres 9.x',
driver: 'pg',
dockerImageName: 'postgres:9',
connectionStringEnvironmentVariableName:
'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING',
},
MYSQL_8: {
name: 'MySQL 8.x',
driver: 'mysql2',
dockerImageName: 'mysql:8',
connectionStringEnvironmentVariableName:
'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING',
},
SQLITE_3: {
name: 'SQLite 3.x',
driver: 'sqlite3',
},
});

Some files were not shown because too many files have changed in this diff Show More