From 36d6ec5d86f5fff58e47bf33331a507269cfe2c6 Mon Sep 17 00:00:00 2001 From: Maximilian Vorbrodt Date: Fri, 9 Dec 2022 11:56:46 +0100 Subject: [PATCH 1/7] make diagram scale to viewport without growing on its own Signed-off-by: Maximilian Vorbrodt --- .../src/components/GroupsExplorerContent/GroupsDiagram.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx index 674ef1e43f..371548fb2e 100644 --- a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx +++ b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx @@ -43,9 +43,12 @@ import useAsync from 'react-use/lib/useAsync'; const useStyles = makeStyles((theme: BackstageTheme) => ({ graph: { + height: '100%', + position: 'absolute', minHeight: '100%', }, graphWrapper: { + position: 'relative', height: '100%', }, organizationNode: { From d318d4f659abfae2418e5297b73819e5ffd9cf00 Mon Sep 17 00:00:00 2001 From: Maximilian Vorbrodt Date: Fri, 9 Dec 2022 12:06:45 +0100 Subject: [PATCH 2/7] add changeset Signed-off-by: Maximilian Vorbrodt --- .changeset/thick-stingrays-smile.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thick-stingrays-smile.md diff --git a/.changeset/thick-stingrays-smile.md b/.changeset/thick-stingrays-smile.md new file mode 100644 index 0000000000..2b56803ede --- /dev/null +++ b/.changeset/thick-stingrays-smile.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-explore': patch +--- + +Makes the `GroupsDiagram` not grown on screen on its own. From da89b09b0feb0a79982ff213b1a5fe09cb737de1 Mon Sep 17 00:00:00 2001 From: Maximilian Vorbrodt Date: Sun, 18 Dec 2022 10:17:48 +0100 Subject: [PATCH 3/7] makes whole graph visible when loading page and does not grow on its own Signed-off-by: Maximilian Vorbrodt --- .../src/components/GroupsExplorerContent/GroupsDiagram.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx index 371548fb2e..fd1d5ba5fb 100644 --- a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx +++ b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx @@ -43,12 +43,11 @@ import useAsync from 'react-use/lib/useAsync'; const useStyles = makeStyles((theme: BackstageTheme) => ({ graph: { - height: '100%', - position: 'absolute', minHeight: '100%', + flex: 1, }, graphWrapper: { - position: 'relative', + display: 'flex', height: '100%', }, organizationNode: { From c447a5221b18558280bf3566badfe4e4f1944333 Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Tue, 20 Dec 2022 16:13:16 +0100 Subject: [PATCH 4/7] use isAllPackages to genereta tmp conf Signed-off-by: Juan Pablo Garcia Ripa --- .changeset/curvy-ducks-explode.md | 5 +++++ packages/repo-tools/src/commands/api-reports/api-reports.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/curvy-ducks-explode.md diff --git a/.changeset/curvy-ducks-explode.md b/.changeset/curvy-ducks-explode.md new file mode 100644 index 0000000000..1d631e60a8 --- /dev/null +++ b/.changeset/curvy-ducks-explode.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Use the project tsconfig in case of selection all packages diff --git a/packages/repo-tools/src/commands/api-reports/api-reports.ts b/packages/repo-tools/src/commands/api-reports/api-reports.ts index 6270072912..66436644d2 100644 --- a/packages/repo-tools/src/commands/api-reports/api-reports.ts +++ b/packages/repo-tools/src/commands/api-reports/api-reports.ts @@ -66,7 +66,7 @@ export const buildApiReports = async (paths: string[] = [], opts: Options) => { } let temporaryTsConfigPath: string | undefined; - if (selectedPackageDirs) { + if (!isAllPackages) { temporaryTsConfigPath = await createTemporaryTsConfig(selectedPackageDirs); } const tsconfigFilePath = From e2f2bbce38a9a62262d15aaf0622ecba41f98375 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Thu, 22 Dec 2022 11:40:58 +0100 Subject: [PATCH 5/7] Remove tugboat workflow Signed-off-by: Johan Haals --- .github/workflows/verify_e2e-tugboat.yml | 131 -------------------- .tugboat/config.yml | 17 --- .tugboat/tugboat.app-config.production.yaml | 10 -- cypress/README.md | 4 - 4 files changed, 162 deletions(-) delete mode 100644 .github/workflows/verify_e2e-tugboat.yml delete mode 100644 .tugboat/config.yml delete mode 100644 .tugboat/tugboat.app-config.production.yaml diff --git a/.github/workflows/verify_e2e-tugboat.yml b/.github/workflows/verify_e2e-tugboat.yml deleted file mode 100644 index cb3a463a0d..0000000000 --- a/.github/workflows/verify_e2e-tugboat.yml +++ /dev/null @@ -1,131 +0,0 @@ -name: E2E Test Tugboat -on: deployment_status - -jobs: - set-pending: - if: github.event.deployment_status.state != 'success' && github.event.deployment_status.state != 'failed' - name: Set pending waiting for Tugboat - runs-on: ubuntu-latest - steps: - # Set an initial commit status message to indicate that the tests are - # running. - - name: set pending status - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - debug: true - script: | - return github.rest.repos.createCommitStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - sha: context.sha, - state: 'pending', - context: 'Backstage Tugboat E2E Tests', - description: 'Waiting for Tugboat to complete deployment', - target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" - }); - - run-tests: - # Only run after a successful Tugboat deployment. - if: github.event.deployment_status.state == 'success' - name: Run tests against Tugboat deployment - runs-on: ubuntu-latest - steps: - # Set an initial commit status message to indicate that the tests are - # running. - - name: set pending status - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - debug: true - script: | - return github.rest.repos.createCommitStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - sha: context.sha, - state: 'pending', - context: 'Backstage Tugboat E2E Tests', - description: 'Running against tugboat preview', - target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" - }); - - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16.x' - - - name: yarn install - run: yarn --cwd cypress install - - # This is required because the environment_url param that Tugboat uses - # to tell us where the preview is located isn't supported unless you - # specify the custom Accept header when getting the deployment_status, - # and GitHub actions doesn't do that by default. So instead we have to - # load the status object manually and get the data we need. - # https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/ - - name: get deployment status - id: get-status-env - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - result-encoding: string - script: | - const result = await github.rest.repos.getDeploymentStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - deployment_id: context.payload.deployment.id, - status_id: context.payload.deployment_status.id, - headers: { - 'Accept': 'application/vnd.github.ant-man-preview+json' - }, - }); - console.log(result); - return result.data.environment_url; - - - name: cypress run - uses: cypress-io/github-action@v2 - env: - CYPRESS_baseUrl: ${{steps.get-status-env.outputs.result}} - with: - config-file: ./cypress.json - working-directory: ./cypress - browser: chrome - install: false - headless: true - - - name: update artifact - if: ${{ always() }} - uses: actions/upload-artifact@v3 - with: - name: cypress-videos - path: ./cypress/cypress/videos - - - name: set status - if: ${{ failure() }} - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - script: | - return github.rest.repos.createCommitStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - sha: context.sha, - state: "error", - context: 'Backstage Tugboat E2E Tests', - target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" - }); - - - name: set status - if: ${{ success() }} - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - script: | - return github.rest.repos.createCommitStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - sha: context.sha, - state: "success", - context: 'Backstage Tugboat E2E Tests', - target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" - }); diff --git a/.tugboat/config.yml b/.tugboat/config.yml deleted file mode 100644 index 1d06e39152..0000000000 --- a/.tugboat/config.yml +++ /dev/null @@ -1,17 +0,0 @@ -services: - backstage: - image: tugboatqa/node:lts - expose: 7007 - default: true - commands: - init: - - mkdir -p /etc/service/node - - echo "#!/bin/sh" > /etc/service/node/run - - echo "yarn --cwd ${TUGBOAT_ROOT} start-backend --config ${TUGBOAT_ROOT}/app-config.yaml --config ${TUGBOAT_ROOT}/.tugboat/tugboat.app-config.production.yaml" >> /etc/service/node/run - - chmod +x /etc/service/node/run - build: - - yarn install --immutable - - yarn workspace example-app build - start: - # wget the endpoint. Will retry every 2 seconds. 30 retries = 1m for service to come up. Plenty. - - wget -O /dev/null -o /dev/null --tries=30 --timeout=5 --retry-connrefused http://localhost:7007 diff --git a/.tugboat/tugboat.app-config.production.yaml b/.tugboat/tugboat.app-config.production.yaml deleted file mode 100644 index b264d53f3f..0000000000 --- a/.tugboat/tugboat.app-config.production.yaml +++ /dev/null @@ -1,10 +0,0 @@ -app: - title: Backstage Tugboat Preview - baseUrl: ${TUGBOAT_DEFAULT_SERVICE_URL} - -backend: - baseUrl: ${TUGBOAT_DEFAULT_SERVICE_URL} - cors: - origin: ${TUGBOAT_DEFAULT_SERVICE_URL} - methods: [GET, POST, PUT, DELETE] - credentials: true diff --git a/cypress/README.md b/cypress/README.md index 4212af398c..be2960e63c 100644 --- a/cypress/README.md +++ b/cypress/README.md @@ -2,10 +2,6 @@ Hey 👋 Welcome to the Cypress tests for Backstage. They're designed to be run against the `packages/app` folder in the main repo, and be some form of smoke tests to make sure that we don't break any core functionality. -They run part of the PR build, and are triggered from the `.github/workflows/tugboat.yml` file. - -The main app gets built up part of a [Tugboat Build](https://tugboat.qa), which when complete, sends a `deployment event` to the PR triggering the aforementioned workflow. - ### Running Locally In order to make typescript happy, this `cypress` package is separate from all the Jest dependencies in the monorepo workspaces setup. From 7115c7389b2ff6cebb7298d522f105855b97d356 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Dec 2022 11:47:22 +0000 Subject: [PATCH 6/7] fix(deps): update dependency jss to ~10.9.0 Signed-off-by: Renovate Bot --- .changeset/renovate-3493165.md | 6 ++++++ plugins/techdocs-react/package.json | 2 +- plugins/techdocs/package.json | 2 +- yarn.lock | 12 ++++++------ 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 .changeset/renovate-3493165.md diff --git a/.changeset/renovate-3493165.md b/.changeset/renovate-3493165.md new file mode 100644 index 0000000000..aa5146931e --- /dev/null +++ b/.changeset/renovate-3493165.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-techdocs-react': patch +'@backstage/plugin-techdocs': patch +--- + +Updated dependency `jss` to `~10.9.0`. diff --git a/plugins/techdocs-react/package.json b/plugins/techdocs-react/package.json index 2f91a4af60..9a18ab679d 100644 --- a/plugins/techdocs-react/package.json +++ b/plugins/techdocs-react/package.json @@ -42,7 +42,7 @@ "@material-ui/core": "^4.12.2", "@material-ui/lab": "4.0.0-alpha.57", "@material-ui/styles": "^4.11.0", - "jss": "~10.8.2", + "jss": "~10.9.0", "lodash": "^4.17.21", "react-helmet": "6.1.0", "react-use": "^17.2.4" diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 4da8b45b12..6280b96f53 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -52,7 +52,7 @@ "dompurify": "^2.2.9", "event-source-polyfill": "1.0.25", "git-url-parse": "^13.0.0", - "jss": "~10.8.2", + "jss": "~10.9.0", "lodash": "^4.17.21", "react-helmet": "6.1.0", "react-use": "^17.2.4" diff --git a/yarn.lock b/yarn.lock index 7c130dbe31..47b5feeff2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7955,7 +7955,7 @@ __metadata: "@testing-library/jest-dom": ^5.10.1 "@testing-library/react": ^12.1.3 "@testing-library/react-hooks": ^8.0.0 - jss: ~10.8.2 + jss: ~10.9.0 lodash: ^4.17.21 react-helmet: 6.1.0 react-use: ^17.2.4 @@ -8003,7 +8003,7 @@ __metadata: dompurify: ^2.2.9 event-source-polyfill: 1.0.25 git-url-parse: ^13.0.0 - jss: ~10.8.2 + jss: ~10.9.0 lodash: ^4.17.21 msw: ^0.49.0 react-helmet: 6.1.0 @@ -27014,15 +27014,15 @@ __metadata: languageName: node linkType: hard -"jss@npm:^10.5.1, jss@npm:~10.8.2": - version: 10.8.2 - resolution: "jss@npm:10.8.2" +"jss@npm:^10.5.1, jss@npm:~10.9.0": + version: 10.9.2 + resolution: "jss@npm:10.9.2" dependencies: "@babel/runtime": ^7.3.1 csstype: ^3.0.2 is-in-browser: ^1.1.3 tiny-warning: ^1.0.2 - checksum: b2647e44435e665c53eda80af2305addfea7e49c3b0c0271dc183abd8b1bb7c88bc5d77baf7bb8b2460640190eed900358fda514742d0bf4ebbc203984c879ba + checksum: 7ae5cd2f8602bf197ec90251d774b9f10d55eb2db0854ac78dc7fb6983828c202e8eb0d5c8c59c73b2f64718ebd33d6063afa799d625a995986a22dc1cc27230 languageName: node linkType: hard From bfd66b04782bc342321c324269fefe145c47859d Mon Sep 17 00:00:00 2001 From: Phil Kuang Date: Wed, 7 Dec 2022 14:37:10 -0500 Subject: [PATCH 7/7] feat(search): allow max page limit to be configurable Signed-off-by: Phil Kuang --- .changeset/two-buckets-do.md | 5 +++++ plugins/search-backend/config.d.ts | 5 +++++ plugins/search-backend/package.json | 3 ++- plugins/search-backend/src/service/router.test.ts | 15 +++++++++------ plugins/search-backend/src/service/router.ts | 5 ++++- 5 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 .changeset/two-buckets-do.md diff --git a/.changeset/two-buckets-do.md b/.changeset/two-buckets-do.md new file mode 100644 index 0000000000..0f7652dcfa --- /dev/null +++ b/.changeset/two-buckets-do.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-search-backend': patch +--- + +Allow max page limit for search results to be configurable diff --git a/plugins/search-backend/config.d.ts b/plugins/search-backend/config.d.ts index 99f4d0ab2f..3dbdf78dfe 100644 --- a/plugins/search-backend/config.d.ts +++ b/plugins/search-backend/config.d.ts @@ -17,6 +17,11 @@ export interface Config { /** Configuration options for the search plugin */ search?: { + /** + * Sets the maximum max page limit size. Defaults to 100. + */ + maxPageLimit?: number; + /** * Options related to the search integration with the Backstage permissions system */ diff --git a/plugins/search-backend/package.json b/plugins/search-backend/package.json index 6032f1af79..8840955c1a 100644 --- a/plugins/search-backend/package.json +++ b/plugins/search-backend/package.json @@ -48,6 +48,7 @@ "supertest": "^6.1.3" }, "files": [ - "dist" + "dist", + "config.d.ts" ] } diff --git a/plugins/search-backend/src/service/router.test.ts b/plugins/search-backend/src/service/router.test.ts index c3eb6ea00f..1dbd145bce 100644 --- a/plugins/search-backend/src/service/router.test.ts +++ b/plugins/search-backend/src/service/router.test.ts @@ -59,7 +59,10 @@ describe('createRouter', () => { 'first-type': {}, 'second-type': {}, }, - config: new ConfigReader({ permissions: { enabled: false } }), + config: new ConfigReader({ + permissions: { enabled: false }, + search: { maxPageLimit: 200 }, + }), permissions: mockPermissionEvaluator, logger, }); @@ -112,8 +115,8 @@ describe('createRouter', () => { }); }); - it('should accept per page value under or equal to 100', async () => { - const response = await request(app).get(`/query?pageLimit=30`); + it('should accept per page value under or equal to configured max', async () => { + const response = await request(app).get(`/query?pageLimit=200`); expect(response.status).toEqual(200); expect(response.body).toMatchObject({ @@ -121,13 +124,13 @@ describe('createRouter', () => { }); }); - it('should reject per page value over 100', async () => { - const response = await request(app).get(`/query?pageLimit=200`); + it('should reject per page value over configured max', async () => { + const response = await request(app).get(`/query?pageLimit=300`); expect(response.status).toEqual(400); expect(response.body).toMatchObject({ error: { - message: /The page limit "200" is greater than "100"/i, + message: /The page limit "300" is greater than "200"/i, }, }); }); diff --git a/plugins/search-backend/src/service/router.ts b/plugins/search-backend/src/service/router.ts index 0100c35e1d..b51dcead14 100644 --- a/plugins/search-backend/src/service/router.ts +++ b/plugins/search-backend/src/service/router.ts @@ -62,7 +62,7 @@ export type RouterOptions = { logger: Logger; }; -const maxPageLimit = 100; +const defaultMaxPageLimit = 100; const allowedLocationProtocols = ['http:', 'https:']; /** @@ -73,6 +73,9 @@ export async function createRouter( ): Promise { const { engine: inputEngine, types, permissions, config, logger } = options; + const maxPageLimit = + config.getOptionalNumber('search.maxPageLimit') ?? defaultMaxPageLimit; + const requestSchema = z.object({ term: z.string().default(''), filters: jsonObjectSchema.optional(),