From 5c9e1da0a9d3820545c18cbaf60c06b2861869d0 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 12 Sep 2020 16:06:10 +0200 Subject: [PATCH 01/11] github/workflows: remove global yarn cache from windows build --- .github/workflows/e2e-win.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/e2e-win.yml b/.github/workflows/e2e-win.yml index b4ea1e350f..5bab1b1299 100644 --- a/.github/workflows/e2e-win.yml +++ b/.github/workflows/e2e-win.yml @@ -27,25 +27,12 @@ jobs: steps: - uses: actions/checkout@v2 - # 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: find location of global yarn cache - id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: cache global yarn cache - uses: actions/cache@v2 - 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 - run: yarn tsc - name: yarn build From fc7b1325adbefb329962a13ab30ae222053814fd Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 13 Sep 2020 21:40:28 +0200 Subject: [PATCH 02/11] CHANGELOG: update until 47800 + bump to alpha.21 --- CHANGELOG.md | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9235172b..294c57815e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,40 @@ If you encounter issues while upgrading to a newer version, don't hesitate to re ## Next Release +### @backstage/core + +- Introduced initial version of an inverted app/plugin relationship, where plugins export components for apps to use, instead registering themselves directly into the app. This enables more fine-grained control of plugin features, and also composition of plugins such as catalog pages with additional cards and tabs. This breaks the use of `RouteRef`s, and there will be more changes related to this in the future, but this change lays the initial foundation. See `packages/app` and followup PRs for how to update plugins for this change. [#2076](https://github.com/spotify/backstage/pull/2076) +- Switch to an automatic dependency injection mechanism for all Utility APIs, allowing plugins to ship default implementations of their APIs. See [https://backstage.io/docs/api/utility-apis](https://backstage.io/docs/api/utility-apis). [#2285](https://github.com/spotify/backstage/pull/2285) + > Collect changes for the next release below +### @backstage/cli + +- Change `backstage-cli backend:build-image` to forward all args to `docker image build`, instead of just tag. Also add `--build` flag for building all dependent packages before packaging the workspace for the docker build. [#2299](https://github.com/spotify/backstage/pull/2299) + +### @backstage/create-app + +- Change root `tsc` output dir to `dist-types`, in order to allow for standalone plugin repos. [#2278](https://github.com/spotify/backstage/pull/2278) + +## v0.1.1-alpha.21 + +- Added many more frontend plugins to the template along with the sidebar. [#1942](https://github.com/spotify/backstage/pull/1942), [#2084](https://github.com/spotify/backstage/pull/2084) + +### @backstage/core + - Material-UI: Bumped to 4.11.0, which is the version that create-app will resolve to, because we wanted to get the renaming of ExpansionPanel to Accordion into place. This gets rid of a lot of console deprecation warnings in newly scaffolded apps. +### @backstage/cli + +- Set `NODE_ENV` to `test` when running test. [#2214](https://github.com/spotify/backstage/pull/2214) + +- Fix for backend plugins names requiring to be prefixed with `@backstage` to build. [#2224](https://github.com/spotify/backstage/pull/2224) + +### @backstage/backend-common + - The backend plugin [service builder](https://github.com/spotify/backstage/blob/master/packages/backend-common/src/service/lib/ServiceBuilderImpl.ts) no longer adds `express.json()` automatically to all routes. While convenient @@ -22,14 +49,31 @@ If you encounter issues while upgrading to a newer version, don't hesitate to re still had to cater to that manually. We therefore decided to let plugins add `express.json()` themselves if they happen to deal with JSON data. +### @backstage/catalog-backend + +- Add rules configuration for catalog location and entity kinds. The default rules should cover most use-cases, but you may need to allow specific entity kinds when using things like Template or Group entities. [#2118](https://github.com/spotify/backstage/pull/2118) + ## v0.1.1-alpha.20 -- Includes https://github.com/spotify/backstage/pull/2097 to resolve issues with create-plugin command. +### @backstage/cli + +- Use config files according to `NODE_ENV` when serving and building frontend packages. [#2077](https://github.com/spotify/backstage/pull/2077) + +- Pin `rollup-plugin-dts` to avoid a later broken version. [#2097](https://github.com/spotify/backstage/pull/2097) ## v0.1.1-alpha.19 +### @backstage/backend-common + +- Allow listen host and port to be configured separately, in order to support PORT environment variables. [#1950](https://github.com/spotify/backstage/pull/1950) + +### @backstage/core + +- Added new `DiscoveryApi` for discovering backend endpoint in the frontend, and use in most plugins. See [packages/app/src/apis.ts](https://github.com/spotify/backstage/blob/master/packages/app/src/apis.ts) for how to register in your app. [#2074](https://github.com/spotify/backstage/pull/2074) + ### @backstage/create-app +- Added catalog and scaffolder frontend plugins to the template along with the sidebar. [#1942](https://github.com/spotify/backstage/pull/1942), [#2084](https://github.com/spotify/backstage/pull/2084) - Many plugins have been added to the catalog and will for now be required to be added to separate apps as well. This will be solved as [#1536](https://github.com/spotify/backstage/issues/1536) gets sorted out, but for now you may need to install some plugins just to get pages to work. ### @backstage/catalog-backend From a4038cd646eb5dba0618f31b7b5d503eb2ea2e55 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sun, 13 Sep 2020 22:39:21 +0200 Subject: [PATCH 03/11] Codecov: Disable comments --- .codecov.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000000..69cb76019a --- /dev/null +++ b/.codecov.yml @@ -0,0 +1 @@ +comment: false From 595c5ce98af6b13b09cae496c2b2246e8f98f9f2 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sun, 13 Sep 2020 22:40:20 +0200 Subject: [PATCH 04/11] Codecov: Set threshold of coverage change to 2% This is 2 percent points. So, if coverage drops from 50% to 47.9%, codecov github check will fail. --- .codecov.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.codecov.yml b/.codecov.yml index 69cb76019a..1ca69c2b9f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1 +1,8 @@ comment: false + +coverage: + status: + project: + default: + threshold: 2% + target: auto From 2c68f25de642ac1ab62b8473a32e65dce44b55bd Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sun, 13 Sep 2020 22:46:51 +0200 Subject: [PATCH 05/11] Codecov: Add reference documentation links in config --- .codecov.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 1ca69c2b9f..f7bc56c7c1 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,8 +1,8 @@ -comment: false +comment: false # Ref: https://docs.codecov.io/docs/pull-request-comments coverage: status: project: default: - threshold: 2% + threshold: 2% # Ref: https://docs.codecov.io/docs/codecovyml-reference#coveragestatus target: auto From 2b5f7c5248f5615a59657c5f03f1b70efe7126d7 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sun, 13 Sep 2020 23:07:50 +0200 Subject: [PATCH 06/11] Codecov: Reset threshold to 0%. It is harmless. --- .codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codecov.yml b/.codecov.yml index f7bc56c7c1..bbe2ee8e93 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -4,5 +4,5 @@ coverage: status: project: default: - threshold: 2% # Ref: https://docs.codecov.io/docs/codecovyml-reference#coveragestatus + threshold: 0% # Ref: https://docs.codecov.io/docs/codecovyml-reference#coveragestatus target: auto From 8a0adf950a235a1851bcc6d05e9607e0d2124894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Sun, 13 Sep 2020 10:37:11 +0200 Subject: [PATCH 07/11] Update mkdocs.yml etc --- microsite/sidebars.json | 1 + mkdocs.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/microsite/sidebars.json b/microsite/sidebars.json index 7b4c852f4d..5d24361215 100644 --- a/microsite/sidebars.json +++ b/microsite/sidebars.json @@ -42,6 +42,7 @@ "features/software-catalog/installation", "features/software-catalog/system-model", "features/software-catalog/descriptor-format", + "features/software-catalog/well-known-annotations", "features/software-catalog/extending-the-model", "features/software-catalog/external-integrations", "features/software-catalog/software-catalog-api" diff --git a/mkdocs.yml b/mkdocs.yml index 10cd7df9b2..d2a844b571 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -30,6 +30,7 @@ nav: - Overview: 'features/software-catalog/index.md' - System model: 'features/software-catalog/system-model.md' - YAML File Format: 'features/software-catalog/descriptor-format.md' + - Well-known Annotations: 'features/software-catalog/well-known-annotations.md' - Configuration: 'features/software-catalog/configuration.md' - Extending the model: 'features/software-catalog/extending-the-model.md' - External integrations: 'features/software-catalog/external-integrations.md' From 9888418d413fef92cd7b878169c93bed7ae29dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 14 Sep 2020 16:43:20 +0200 Subject: [PATCH 08/11] missing yarn.lock updates again (#2456) * missing yarn.lock updates again * yarn.lock: sync the sync Co-authored-by: Patrik Oldsberg --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 11bb8a3fd8..38f5d6c799 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17550,7 +17550,7 @@ react-is@^16.12.0, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.0, react-i resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react-lazylog@^4.5.2: +react-lazylog@^4.5.2, react-lazylog@^4.5.3: version "4.5.3" resolved "https://registry.npmjs.org/react-lazylog/-/react-lazylog-4.5.3.tgz#289e24995b5599e75943556ac63f5e2c04d0001e" integrity sha512-lyov32A/4BqihgXgtNXTHCajXSXkYHPlIEmV8RbYjHIMxCFSnmtdg4kDCI3vATz7dURtiFTvrw5yonHnrS+NNg== From 398d7eb91ef5764ad0d56371bbb2ce537ef9a1ba Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Mon, 14 Sep 2020 16:57:37 +0200 Subject: [PATCH 09/11] TechDocs: Fix building if you already have a corrupt git tmp folder (#2457) * Fix building if you already have a corrupt git tmp folder * Logging the error we get before trying to recover --- plugins/techdocs-backend/src/helpers.ts | 33 ++++++++++++++----- .../techdocs-backend/src/service/helpers.ts | 2 +- .../src/techdocs/stages/prepare/dir.ts | 5 ++- .../src/techdocs/stages/prepare/github.ts | 2 +- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/plugins/techdocs-backend/src/helpers.ts b/plugins/techdocs-backend/src/helpers.ts index 25d7f593c2..14f4d490ba 100644 --- a/plugins/techdocs-backend/src/helpers.ts +++ b/plugins/techdocs-backend/src/helpers.ts @@ -24,6 +24,7 @@ import defaultBranch from 'default-branch'; import { Entity } from '@backstage/catalog-model'; import { InputError } from '@backstage/backend-common'; import { RemoteProtocol } from './techdocs/stages/prepare/types'; +import { Logger } from 'winston'; export type ParsedLocationAnnotation = { type: RemoteProtocol; @@ -110,6 +111,7 @@ export const getGitHubRepositoryTempFolder = async ( export const checkoutGithubRepository = async ( repoUrl: string, + logger: Logger, ): Promise => { const parsedGitLocation = parseGitUrl(repoUrl); const repositoryTmpPath = await getGitHubRepositoryTempFolder(repoUrl); @@ -119,14 +121,23 @@ export const checkoutGithubRepository = async ( const token = process.env.GITHUB_PRIVATE_TOKEN || ''; if (fs.existsSync(repositoryTmpPath)) { - const repository = await Repository.open(repositoryTmpPath); - const currentBranchName = (await repository.getCurrentBranch()).shorthand(); - await repository.fetch('origin'); - await repository.mergeBranches( - currentBranchName, - `origin/${currentBranchName}`, - ); - return repositoryTmpPath; + try { + const repository = await Repository.open(repositoryTmpPath); + const currentBranchName = ( + await repository.getCurrentBranch() + ).shorthand(); + await repository.fetch('origin'); + await repository.mergeBranches( + currentBranchName, + `origin/${currentBranchName}`, + ); + return repositoryTmpPath; + } catch (e) { + logger.info( + `Found error "${e.message}" in cached repository "${repoUrl}" when getting latest changes. Removing cached repository.`, + ); + fs.removeSync(repositoryTmpPath); + } } if (user && token) { @@ -143,8 +154,12 @@ export const checkoutGithubRepository = async ( export const getLastCommitTimestamp = async ( repositoryUrl: string, + logger: Logger, ): Promise => { - const repositoryLocation = await checkoutGithubRepository(repositoryUrl); + const repositoryLocation = await checkoutGithubRepository( + repositoryUrl, + logger, + ); const repository = await Repository.open(repositoryLocation); const commit = await repository.getReferenceCommit('HEAD'); diff --git a/plugins/techdocs-backend/src/service/helpers.ts b/plugins/techdocs-backend/src/service/helpers.ts index 0fc4f41b3d..60c76e6384 100644 --- a/plugins/techdocs-backend/src/service/helpers.ts +++ b/plugins/techdocs-backend/src/service/helpers.ts @@ -110,7 +110,7 @@ export class DocsBuilder { // Should probably be broken out and handled per type later. Doing this for now since we only support github age checks if (type === 'github') { - const lastCommit = await getLastCommitTimestamp(target); + const lastCommit = await getLastCommitTimestamp(target, this.logger); const storageTimeStamp = buildMetadataStorage.getTimestamp(); // Check if documentation source is newer than what we have diff --git a/plugins/techdocs-backend/src/techdocs/stages/prepare/dir.ts b/plugins/techdocs-backend/src/techdocs/stages/prepare/dir.ts index a9eda943c6..5fd4abb4bd 100644 --- a/plugins/techdocs-backend/src/techdocs/stages/prepare/dir.ts +++ b/plugins/techdocs-backend/src/techdocs/stages/prepare/dir.ts @@ -43,7 +43,10 @@ export class DirectoryPreparer implements PreparerBase { switch (type) { case 'github': { const parsedGitLocation = parseGitUrl(target); - const repoLocation = await checkoutGithubRepository(target); + const repoLocation = await checkoutGithubRepository( + target, + this.logger, + ); return path.dirname( path.join(repoLocation, parsedGitLocation.filepath), diff --git a/plugins/techdocs-backend/src/techdocs/stages/prepare/github.ts b/plugins/techdocs-backend/src/techdocs/stages/prepare/github.ts index 7b9fc7fbe2..03b0adcb88 100644 --- a/plugins/techdocs-backend/src/techdocs/stages/prepare/github.ts +++ b/plugins/techdocs-backend/src/techdocs/stages/prepare/github.ts @@ -43,7 +43,7 @@ export class GithubPreparer implements PreparerBase { } try { - const repoPath = await checkoutGithubRepository(target); + const repoPath = await checkoutGithubRepository(target, this.logger); const parsedGitLocation = parseGitUrl(target); return path.join(repoPath, parsedGitLocation.filepath); From b86d408fa7eb4bc79dd71fd6036ea4a7beea3a89 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 14 Sep 2020 17:06:29 +0200 Subject: [PATCH 10/11] plugins/newrelic: make public --- plugins/newrelic/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/newrelic/package.json b/plugins/newrelic/package.json index 9c9d609c04..38a47bc0fc 100644 --- a/plugins/newrelic/package.json +++ b/plugins/newrelic/package.json @@ -4,7 +4,7 @@ "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", From d36f3bc5d84874372192efab33568e723374f3f6 Mon Sep 17 00:00:00 2001 From: David Tuite Date: Tue, 15 Sep 2020 05:42:13 +0100 Subject: [PATCH 11/11] Assorted scaffolder form help text improvements (#2467) * Prompt the user for a description in templates The text "Description of the component" was a little redundant since the label already says "Description". This description text hints to the user why they should bother adding an informative description. * Inform user about lowercase, url-safe constraint Create React App scaffolding fails when a name with spaces or other non-url-safe chars are provided. Instead of making the user wait for a failure, Backstage should tell them about this constraint up front. --- .../sample-templates/create-react-app/template.yaml | 4 ++-- .../sample-templates/docs-template/template.yaml | 2 +- .../sample-templates/react-ssr-template/template.yaml | 2 +- .../sample-templates/springboot-grpc-template/template.yaml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml b/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml index a377d60ccc..2c8b3b3d6d 100644 --- a/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml +++ b/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml @@ -22,11 +22,11 @@ spec: component_id: title: Name type: string - description: Unique name of the component + description: Unique name of the component. Lowercase, URL-safe characters only. description: title: Description type: string - description: Description of the component + description: Help others understand what this website is for. use_typescript: title: Use Typescript type: boolean diff --git a/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml b/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml index 65d44d1b8a..b4bd45d163 100644 --- a/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml +++ b/plugins/scaffolder-backend/sample-templates/docs-template/template.yaml @@ -25,5 +25,5 @@ spec: description: title: Description type: string - description: Description of the component + description: Help others understand what these docs are about. diff --git a/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml b/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml index ee051de6e0..a667e6e6b6 100644 --- a/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml +++ b/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml @@ -24,4 +24,4 @@ spec: description: title: Description type: string - description: Description of the component + description: Help others understand what this website is for. diff --git a/plugins/scaffolder-backend/sample-templates/springboot-grpc-template/template.yaml b/plugins/scaffolder-backend/sample-templates/springboot-grpc-template/template.yaml index 32b9383855..8b89298a0e 100644 --- a/plugins/scaffolder-backend/sample-templates/springboot-grpc-template/template.yaml +++ b/plugins/scaffolder-backend/sample-templates/springboot-grpc-template/template.yaml @@ -25,7 +25,7 @@ spec: description: title: Description type: string - description: Description of the component + description: Help others understand what this service does. http_port: title: Port type: integer