diff --git a/.github/renovate.json b/.github/renovate.json index 83ec8dc6fb..3048d9445b 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -197,51 +197,7 @@ }, { "matchFileNames": [ - "plugins/*matomo*/**", - "plugins/analytics-module-matomo*/**" - ], - "additionalBranchPrefix": "devex ", - "addLabels": ["team/devex"], - "matchUpdateTypes": ["minor", "patch"], - "matchDepTypes": ["dependencies", "peerDependencies"], - "groupName": "Devex Dependencies (non-major)" - }, - { - "matchFileNames": [ - "plugins/*matomo*/**", - "plugins/analytics-module-matomo*/**" - ], - "additionalBranchPrefix": "devex ", - "addLabels": ["team/devex"], - "matchUpdateTypes": ["major"], - "matchDepTypes": ["dependencies", "peerDependencies"], - "groupName": "Devex Dependencies " - }, - { - "matchFileNames": [ - "plugins/tekton*/**" - ], - "additionalBranchPrefix": "rhtap ", - "addLabels": ["team/rhtap"], - "matchUpdateTypes": ["minor", "patch"], - "matchDepTypes": ["dependencies", "peerDependencies"], - "groupName": "RHTAP Dependencies (non-major) " - }, - { - "matchFileNames": [ - "plugins/tekton*/**" - ], - "additionalBranchPrefix": "rhtap ", - "addLabels": ["team/rhtap"], - "matchUpdateTypes": ["major"], - "matchDepTypes": ["dependencies", "peerDependencies"], - "groupName": "RHTAP Dependencies " - }, - { - "matchFileNames": [ - "plugins/analytics-provider-segment*/**", "plugins/audit-log*/**", - "plugins/quay-actions*/**", "plugins/scaffolder-annotator-action*/**", "plugins/shared-react*/**", "packages/**", @@ -255,9 +211,7 @@ }, { "matchFileNames": [ - "plugins/analytics-provider-segment*/**", "plugins/audit-log*/**", - "plugins/quay-actions*/**", "plugins/scaffolder-annotator-action*/**", "plugins/shared-react*/**", "packages/**", diff --git a/catalog-info.yaml b/catalog-info.yaml index a562e50cff..ee43280392 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -39,21 +39,14 @@ metadata: spec: targets: - ./plugins/aap-backend/catalog-info.yaml - - ./plugins/analytics-module-matomo/catalog-info.yaml - - ./plugins/analytics-provider-segment/catalog-info.yaml - ./plugins/audit-log-node/catalog-info.yaml - ./plugins/kiali/catalog-info.yaml - ./plugins/kiali-backend/catalog-info.yaml - ./plugins/kubernetes-actions/catalog-info.yaml - - ./plugins/matomo/catalog-info.yaml - - ./plugins/matomo-backend/catalog-info.yaml - ./plugins/orchestrator/catalog-info.yaml - ./plugins/orchestrator-backend/catalog-info.yaml - ./plugins/orchestrator-common/catalog-info.yaml - - ./plugins/quay-actions/catalog-info.yaml - ./plugins/scaffolder-annotator-action/catalog-info.yaml - ./plugins/shared-react/catalog-info.yaml - - ./plugins/tekton/catalog-info.yaml - - ./plugins/tekton-common/catalog-info.yaml - ./plugins/web-terminal/catalog-info.yaml - ./packages/cli/catalog-info.yaml diff --git a/plugins/analytics-module-matomo/.eslintignore b/plugins/analytics-module-matomo/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/analytics-module-matomo/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/analytics-module-matomo/.eslintrc.js b/plugins/analytics-module-matomo/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/analytics-module-matomo/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/analytics-module-matomo/.lintstagedrc.json b/plugins/analytics-module-matomo/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/analytics-module-matomo/.lintstagedrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "*": "prettier --ignore-unknown --write", - "*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix" -} diff --git a/plugins/analytics-module-matomo/.prettierignore b/plugins/analytics-module-matomo/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/analytics-module-matomo/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -dist -dist-types -coverage -.vscode -CHANGELOG.md -generated -templates -*.hbs -renovate.json -dist-dynamic -dist-scalprum -playwright-report diff --git a/plugins/analytics-module-matomo/.prettierrc.js b/plugins/analytics-module-matomo/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/analytics-module-matomo/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-check - -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -module.exports = { - ...require('@spotify/prettier-config'), - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '^react(.*)$', - '', - '^@backstage/(.*)$', - '', - '', - '', - '^@janus-idp/(.*)$', - '', - '', - '', - '^[.]', - ], -}; diff --git a/plugins/analytics-module-matomo/.versionhistory.md b/plugins/analytics-module-matomo/.versionhistory.md deleted file mode 100644 index 2e864bc06d..0000000000 --- a/plugins/analytics-module-matomo/.versionhistory.md +++ /dev/null @@ -1 +0,0 @@ -- Bumped to 1.6.0 in main branch for next release 1.3.0 diff --git a/plugins/analytics-module-matomo/CHANGELOG.md b/plugins/analytics-module-matomo/CHANGELOG.md deleted file mode 100644 index 4bdf653f9b..0000000000 --- a/plugins/analytics-module-matomo/CHANGELOG.md +++ /dev/null @@ -1,253 +0,0 @@ -### Dependencies - -## 1.8.1 - -### Patch Changes - -- 0e6bfd3: feat: update Backstage to the latest version - - Update to Backstage 1.32.5 - -## 1.8.0 - -### Minor Changes - -- 8244f28: chore(deps): update to backstage 1.32 - -## 1.7.1 - -### Patch Changes - -- 7342e9b: chore: remove @janus-idp/cli dep and relink local packages - - This update removes `@janus-idp/cli` from all plugins, as it’s no longer necessary. Additionally, packages are now correctly linked with a specified version. - -## 1.7.0 - -### Minor Changes - -- d9551ae: feat(deps): update to backstage 1.31 - -### Patch Changes - -- d9551ae: Change local package references to a `*` -- d9551ae: pin the @janus-idp/cli package -- d9551ae: upgrade to yarn v3 - -* **@janus-idp/cli:** upgraded to 1.15.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.1 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.14.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.1 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.4.0...@janus-idp/backstage-plugin-analytics-module-matomo@1.5.0) (2024-07-25) - -### Features - -- **deps:** update to backstage 1.29 ([#1900](https://github.com/janus-idp/backstage-plugins/issues/1900)) ([f53677f](https://github.com/janus-idp/backstage-plugins/commit/f53677fb02d6df43a9de98c43a9f101a6db76802)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.0 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.3.1...@janus-idp/backstage-plugin-analytics-module-matomo@1.4.0) (2024-07-23) - -### Features - -- **deps:** update to backstage 1.28 ([#1891](https://github.com/janus-idp/backstage-plugins/issues/1891)) ([1ba1108](https://github.com/janus-idp/backstage-plugins/commit/1ba11088e0de60e90d138944267b83600dc446e5)) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.3.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.3.0...@janus-idp/backstage-plugin-analytics-module-matomo@1.3.1) (2024-06-19) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.1 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.11...@janus-idp/backstage-plugin-analytics-module-matomo@1.3.0) (2024-06-13) - -### Features - -- **deps:** update to backstage 1.27 ([#1683](https://github.com/janus-idp/backstage-plugins/issues/1683)) ([a14869c](https://github.com/janus-idp/backstage-plugins/commit/a14869c3f4177049cb8d6552b36c3ffd17e7997d)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.0 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.10...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.11) (2024-06-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.1 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.9...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.10) (2024-06-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.0 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.8...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.9) (2024-06-04) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.7...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.8) (2024-06-04) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.6...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.7) (2024-06-03) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.9.0 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.5...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.6) (2024-05-31) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.4...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.5) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.10 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.3...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.4) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.9 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.2...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.3) (2024-05-28) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.8 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.1...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.2) (2024-05-16) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.2.0...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.1) (2024-05-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.7 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.13...@janus-idp/backstage-plugin-analytics-module-matomo@1.2.0) (2024-05-14) - -### Features - -- **deps:** use RHDH themes in the backstage app and dev pages ([#1480](https://github.com/janus-idp/backstage-plugins/issues/1480)) ([8263bf0](https://github.com/janus-idp/backstage-plugins/commit/8263bf099736cbb0d0f2316082d338ba81fa6927)) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.12...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.13) (2024-05-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.6 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.11...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.12) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.5 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.10...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.11) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.4 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.9...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.10) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.3 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.8...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.9) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.2 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.7...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.8) (2024-04-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.1 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.6...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.7) (2024-04-15) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.0 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.5...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.6) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.10 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.4...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.5) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.9 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.3...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.4) (2024-04-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.8 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.2...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.3) (2024-04-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.7 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.1...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.2) (2024-03-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.6 - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.1.0...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.1) (2024-03-15) - -### Bug Fixes - -- **matomo-analytics:** event trigger on load ([#1341](https://github.com/janus-idp/backstage-plugins/issues/1341)) ([3bc11f3](https://github.com/janus-idp/backstage-plugins/commit/3bc11f318d012d7a2aa43b4928891c138ee2a5d9)) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.0.4...@janus-idp/backstage-plugin-analytics-module-matomo@1.1.0) (2024-03-15) - -### Features - -- **matomo-analytics:** export apifactory for dynamic plugin ([#1329](https://github.com/janus-idp/backstage-plugins/issues/1329)) ([c687617](https://github.com/janus-idp/backstage-plugins/commit/c6876177f062878801e798ea0193126a28f9fa08)) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.0.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.0.3...@janus-idp/backstage-plugin-analytics-module-matomo@1.0.4) (2024-02-22) - -### Documentation - -- **matomo-plugin:** fix config example and replace GA with Matomo ([#991](https://github.com/janus-idp/backstage-plugins/issues/991)) ([55d6048](https://github.com/janus-idp/backstage-plugins/commit/55d6048c3490dfc6db9a3ebc4103ed505eeaaaf4)) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.0.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.0.2...@janus-idp/backstage-plugin-analytics-module-matomo@1.0.3) (2024-02-21) - -## @janus-idp/backstage-plugin-analytics-module-matomo 1.0.0 (2023-10-30) - -### Features - -- **matomo:** analytics module plugin for matomo ([#837](https://github.com/janus-idp/backstage-plugins/issues/837)) ([8c497fc](https://github.com/janus-idp/backstage-plugins/commit/8c497fcd588c492f4d21bb686bcdd796691f0c90)) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.0.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.0.1...@janus-idp/backstage-plugin-analytics-module-matomo@1.0.2) (2023-10-19) - -## @janus-idp/backstage-plugin-analytics-module-matomo [1.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-module-matomo@1.0.0...@janus-idp/backstage-plugin-analytics-module-matomo@1.0.1) (2023-10-19) - -## @janus-idp/backstage-plugin-analytics-module-matomo 1.0.0 (2023-10-17) - -### Features - -- **matomo:** analytics module plugin for matomo ([#837](https://github.com/janus-idp/backstage-plugins/issues/837)) ([8c497fc](https://github.com/janus-idp/backstage-plugins/commit/8c497fcd588c492f4d21bb686bcdd796691f0c90)) diff --git a/plugins/analytics-module-matomo/README.md b/plugins/analytics-module-matomo/README.md index eee886b3f5..7967b0b138 100644 --- a/plugins/analytics-module-matomo/README.md +++ b/plugins/analytics-module-matomo/README.md @@ -1,64 +1,3 @@ -# Analytics Module: Matomo Analytics +# Deprecated -This plugin provides an opinionated implementation of the Backstage Analytics -API for Matomo Analytics. Once installed and configured, analytics events will -be sent to Matomo as your users navigate and use your Backstage instance. - -This module is made to work with backstage's built-in analytics plugin. The usage guide to start tracking analytics for your plugins can be found here: https://backstage.io/docs/plugins/analytics/ - -## Installation - -1. Install the plugin package in your Backstage app: - -```sh -# From your Backstage root directory -yarn add --cwd packages/app @janus-idp/backstage-plugin-analytics-module-matomo -``` - -2. Wire up the API implementation to your App: - -```tsx -// packages/app/src/apis.ts -import { - analyticsApiRef, - configApiRef, - identityApiRef, -} from '@backstage/core-plugin-api'; - -import { MatomoAnalytics } from '@janus-idp/backstage-plugin-analytics-module-matomo'; - -export const apis: AnyApiFactory[] = [ - // Instantiate and register the Matomo Analytics API Implementation. - createApiFactory({ - api: analyticsApiRef, - deps: { configApi: configApiRef }, - factory: ({ configApi }) => MatomoAnalytics.fromConfig(configApi), - }), -]; -``` - -3. Configure the plugin in your `app-config.yaml`: - -The following is the minimum configuration required to start sending analytics -events to Matomo. All that's needed is your Matomo Host and Site Id: - -```yaml -# app-config.yaml -app: - analytics: - matomo: - host: ${ANALYTICS_MATOMO_INSTANCE_URL} - siteId: ${ANALYTICS_MATOMO_SITE_ID} -``` - -4. Update CSP in your `app-config.yaml`:(optional) - -The following is the minimal content security policy required to load scripts from your Matomo Instance. - -```yaml -backend: - csp: - connect-src: ["'self'", 'http:', 'https:'] - # Add these two lines below - script-src: ["'self'", "'unsafe-eval'", ''] -``` +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-analytics-module-matomo` instead. \ No newline at end of file diff --git a/plugins/analytics-module-matomo/app-config.janus-idp.yaml b/plugins/analytics-module-matomo/app-config.janus-idp.yaml deleted file mode 100644 index 7e9d0c5569..0000000000 --- a/plugins/analytics-module-matomo/app-config.janus-idp.yaml +++ /dev/null @@ -1,5 +0,0 @@ -app: - analytics: - matomo: - host: ${ANALYTICS_MATOMO_INSTANCE_URL} - siteId: ${ANALYTICS_MATOMO_SITE_ID} diff --git a/plugins/analytics-module-matomo/catalog-info.yaml b/plugins/analytics-module-matomo/catalog-info.yaml deleted file mode 100644 index 47264d0862..0000000000 --- a/plugins/analytics-module-matomo/catalog-info.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-analytics-matomo - title: 'Analytics Module: Matomo' - description: 'Analytics Module: Matomo Analytics' - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-module-matomo - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/analytics-module-matomo/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/analytics-module-matomo/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/maintainers-plugins - sonarqube.org/project-key: janus-idp_backstage-plugins - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-module-matomo - title: GitHub Source - icon: source - type: source -spec: - type: backstage-plugin - lifecycle: production - owner: rhdh-team - system: rhdh - subcomponentOf: janus-idp-backstage-plugins ---- -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-analytics-module-matomo - title: '@janus-idp/backstage-plugin-analytics-module-matomo' - description: 'Analytics Module: Matomo Analytics' - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-module-matomo - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/analytics-module-matomo/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/analytics-module-matomo/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/maintainers-plugins - sonarqube.org/project-key: janus-idp_backstage-plugins - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-module-matomo - title: GitHub Source - icon: source - type: source -spec: - type: backstage-frontend-plugin-module - lifecycle: production - owner: rhdh-team - system: rhdh - subcomponentOf: janus-idp-analytics-matomo diff --git a/plugins/analytics-module-matomo/config.d.ts b/plugins/analytics-module-matomo/config.d.ts deleted file mode 100644 index 4da13ea752..0000000000 --- a/plugins/analytics-module-matomo/config.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface Config { - app?: { - analytics: { - matomo: { - /** - * Matomo host URL - * @visibility frontend - */ - host: string; - - /** - * Matomo siteId for the Backstage Website - * @visibility frontend - */ - siteId: string; - }; - }; - }; -} diff --git a/plugins/analytics-module-matomo/dev/Playground.tsx b/plugins/analytics-module-matomo/dev/Playground.tsx deleted file mode 100644 index 9bd1c00750..0000000000 --- a/plugins/analytics-module-matomo/dev/Playground.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; - -export const Playground = () => { - return ( - <> - Click Here - - ); -}; diff --git a/plugins/analytics-module-matomo/dev/index.tsx b/plugins/analytics-module-matomo/dev/index.tsx deleted file mode 100644 index 35413c53f6..0000000000 --- a/plugins/analytics-module-matomo/dev/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; - -import { createDevApp } from '@backstage/dev-utils'; - -import { getAllThemes } from '@redhat-developer/red-hat-developer-hub-theme'; - -import { analyticsModuleMatomoPlugin } from '../src'; -import { Playground } from './Playground'; - -createDevApp() - .registerPlugin(analyticsModuleMatomoPlugin) - .addThemes(getAllThemes()) - .addPage({ - title: 'Matomo Analytics Playground', - path: '/analytics-module-matomo', - element: , - }) - .render(); diff --git a/plugins/analytics-module-matomo/package.json b/plugins/analytics-module-matomo/package.json deleted file mode 100644 index 7b322e595b..0000000000 --- a/plugins/analytics-module-matomo/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "@janus-idp/backstage-plugin-analytics-module-matomo", - "version": "1.8.1", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" - }, - "backstage": { - "role": "frontend-plugin", - "supported-versions": "1.32.5", - "pluginId": "analytics-module-matomo", - "pluginPackage": "@janus-idp/backstage-plugin-analytics-module-matomo", - "pluginPackages": [ - "@janus-idp/backstage-plugin-analytics-module-matomo" - ] - }, - "sideEffects": false, - "scripts": { - "start": "backstage-cli package start", - "build": "backstage-cli package build", - "tsc": "tsc", - "prettier:check": "prettier --ignore-unknown --check .", - "prettier:fix": "prettier --ignore-unknown --write .", - "lint:check": "backstage-cli package lint", - "lint:fix": "backstage-cli package lint --fix", - "test": "backstage-cli package test --passWithNoTests --coverage", - "clean": "backstage-cli package clean", - "prepack": "backstage-cli package prepack", - "postpack": "backstage-cli package postpack" - }, - "dependencies": { - "@backstage/core-plugin-api": "^1.10.0" - }, - "peerDependencies": { - "react": "^16.13.1 || ^17.0.0 || ^18.0.0" - }, - "devDependencies": { - "@backstage/cli": "0.28.2", - "@backstage/core-app-api": "1.15.1", - "@backstage/dev-utils": "1.1.2", - "@backstage/test-utils": "1.7.0", - "@redhat-developer/red-hat-developer-hub-theme": "0.4.0", - "@testing-library/jest-dom": "6.4.8", - "@testing-library/react": "14.3.1", - "@testing-library/user-event": "14.5.2", - "@types/node": "18.19.33", - "cross-fetch": "4.0.0", - "msw": "1.3.3", - "prettier": "3.3.3" - }, - "files": [ - "dist", - "dist-scalprum", - "config.d.ts", - "app-config.janus-idp.yaml" - ], - "configSchema": "config.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/analytics-module-matomo" - }, - "maintainers": [ - "@janus-idp/maintainers-plugins", - "@janus-idp/devex-uxe" - ], - "author": "The Backstage Community", - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "keywords": [ - "support:tech-preview", - "lifecycle:active" - ] -} diff --git a/plugins/analytics-module-matomo/src/api/Matomo.ts b/plugins/analytics-module-matomo/src/api/Matomo.ts deleted file mode 100644 index 0195a93057..0000000000 --- a/plugins/analytics-module-matomo/src/api/Matomo.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { AnalyticsEvent, ConfigApi } from '@backstage/core-plugin-api'; - -import { loadMatomo } from './loadMatomo'; - -declare const window: Window & - typeof globalThis & { - _paq: any[]; - }; - -type AnalyticsAPI = {}; - -type Options = { - configApi: ConfigApi; -}; - -export class MatomoAnalytics implements AnalyticsAPI { - private readonly configApi: ConfigApi; - - private constructor(options: Options) { - this.configApi = options.configApi; - const matomoUrl = this.configApi.getString('app.analytics.matomo.host'); - const matomoSiteId = this.configApi.getNumber( - 'app.analytics.matomo.siteId', - ); - loadMatomo(matomoUrl, matomoSiteId); - } - - static fromConfig(config: ConfigApi) { - return new MatomoAnalytics({ configApi: config }); - } - - captureEvent(event: AnalyticsEvent) { - const { context, action, subject, value } = event; - // REF: https://github.com/backstage/backstage/blob/master/plugins/analytics-module-ga/src/apis/implementations/AnalyticsApi/GoogleAnalytics.ts#L160 - // REF: https://matomo.org/faq/reports/implement-event-tracking-with-matomo/ - window._paq.push([ - 'trackEvent', - context.extension || 'App', - action, - subject, - value, - ]); - } -} diff --git a/plugins/analytics-module-matomo/src/api/index.ts b/plugins/analytics-module-matomo/src/api/index.ts deleted file mode 100644 index 09c0a7c203..0000000000 --- a/plugins/analytics-module-matomo/src/api/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - analyticsApiRef, - configApiRef, - createApiFactory, -} from '@backstage/core-plugin-api'; - -import { MatomoAnalytics } from './Matomo'; - -export { MatomoAnalytics } from './Matomo'; - -export const MatomoAnalyticsApi = createApiFactory({ - api: analyticsApiRef, - deps: { configApi: configApiRef }, - factory: ({ configApi }) => MatomoAnalytics.fromConfig(configApi), -}); diff --git a/plugins/analytics-module-matomo/src/api/loadMatomo.ts b/plugins/analytics-module-matomo/src/api/loadMatomo.ts deleted file mode 100644 index d45192c99c..0000000000 --- a/plugins/analytics-module-matomo/src/api/loadMatomo.ts +++ /dev/null @@ -1,23 +0,0 @@ -let isInitialized = false; -export const loadMatomo = (matomoUrl: string, siteId: number) => { - /* Only initialize matomo tracker if it's not loaded */ - if (isInitialized) return; - - const _paq = ((window as any)._paq = (window as any)._paq || []); - /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (() => { - const u = `//${matomoUrl}/`; - _paq.push(['setTrackerUrl', `${u}matomo.php`]); - _paq.push(['setSiteId', siteId]); - const d = document; - const g = d.createElement('script'); - const s = d.getElementsByTagName('script')[0]; - g.async = true; - g.src = `${u}matomo.js`; - s.parentNode?.insertBefore(g, s); - })(); - - isInitialized = true; -}; diff --git a/plugins/analytics-module-matomo/src/index.ts b/plugins/analytics-module-matomo/src/index.ts deleted file mode 100644 index 263681420c..0000000000 --- a/plugins/analytics-module-matomo/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { analyticsModuleMatomoPlugin } from './plugin'; -export * from './api'; diff --git a/plugins/analytics-module-matomo/src/plugin.test.ts b/plugins/analytics-module-matomo/src/plugin.test.ts deleted file mode 100644 index de2bffa9bd..0000000000 --- a/plugins/analytics-module-matomo/src/plugin.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { analyticsModuleMatomoPlugin } from './plugin'; - -describe('matomo', () => { - it('should export plugin', () => { - expect(analyticsModuleMatomoPlugin).toBeDefined(); - }); -}); diff --git a/plugins/analytics-module-matomo/src/plugin.ts b/plugins/analytics-module-matomo/src/plugin.ts deleted file mode 100644 index 2e00ba0d43..0000000000 --- a/plugins/analytics-module-matomo/src/plugin.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createPlugin } from '@backstage/core-plugin-api'; - -export const analyticsModuleMatomoPlugin = createPlugin({ - id: 'analytics-module-matomo', -}); diff --git a/plugins/analytics-module-matomo/src/routes.ts b/plugins/analytics-module-matomo/src/routes.ts deleted file mode 100644 index ed98de1fc3..0000000000 --- a/plugins/analytics-module-matomo/src/routes.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createRouteRef } from '@backstage/core-plugin-api'; - -export const rootRouteRef = createRouteRef({ - id: 'analytics-module-matomo', -}); diff --git a/plugins/analytics-module-matomo/src/setupTests.ts b/plugins/analytics-module-matomo/src/setupTests.ts deleted file mode 100644 index 48c09b5346..0000000000 --- a/plugins/analytics-module-matomo/src/setupTests.ts +++ /dev/null @@ -1,2 +0,0 @@ -import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/analytics-module-matomo/tsconfig.json b/plugins/analytics-module-matomo/tsconfig.json deleted file mode 100644 index 0ffcd61ad4..0000000000 --- a/plugins/analytics-module-matomo/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@backstage/cli/config/tsconfig.json", - "include": ["src", "dev"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "../../dist-types/plugins/analytics-module-matomo", - "rootDir": "." - } -} diff --git a/plugins/analytics-module-matomo/turbo.json b/plugins/analytics-module-matomo/turbo.json deleted file mode 100644 index f662d2b011..0000000000 --- a/plugins/analytics-module-matomo/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/analytics-module-matomo/**"] - } - } -} diff --git a/plugins/analytics-provider-segment/.eslintignore b/plugins/analytics-provider-segment/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/analytics-provider-segment/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/analytics-provider-segment/.eslintrc.js b/plugins/analytics-provider-segment/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/analytics-provider-segment/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/analytics-provider-segment/.lintstagedrc.json b/plugins/analytics-provider-segment/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/analytics-provider-segment/.lintstagedrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "*": "prettier --ignore-unknown --write", - "*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix" -} diff --git a/plugins/analytics-provider-segment/.prettierignore b/plugins/analytics-provider-segment/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/analytics-provider-segment/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -dist -dist-types -coverage -.vscode -CHANGELOG.md -generated -templates -*.hbs -renovate.json -dist-dynamic -dist-scalprum -playwright-report diff --git a/plugins/analytics-provider-segment/.prettierrc.js b/plugins/analytics-provider-segment/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/analytics-provider-segment/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-check - -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -module.exports = { - ...require('@spotify/prettier-config'), - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '^react(.*)$', - '', - '^@backstage/(.*)$', - '', - '', - '', - '^@janus-idp/(.*)$', - '', - '', - '', - '^[.]', - ], -}; diff --git a/plugins/analytics-provider-segment/.versionhistory.md b/plugins/analytics-provider-segment/.versionhistory.md deleted file mode 100644 index 237de4f3c7..0000000000 --- a/plugins/analytics-provider-segment/.versionhistory.md +++ /dev/null @@ -1,2 +0,0 @@ -- Bumped to 1.3.0 in main branch for next release 1.2.0 -- Bumped to 1.8.0 in main branch for next release 1.3.0 diff --git a/plugins/analytics-provider-segment/CHANGELOG.md b/plugins/analytics-provider-segment/CHANGELOG.md deleted file mode 100644 index 9403375e59..0000000000 --- a/plugins/analytics-provider-segment/CHANGELOG.md +++ /dev/null @@ -1,358 +0,0 @@ -### Dependencies - -## 1.10.1 - -### Patch Changes - -- 0e6bfd3: feat: update Backstage to the latest version - - Update to Backstage 1.32.5 - -## 1.10.0 - -### Minor Changes - -- 8244f28: chore(deps): update to backstage 1.32 - -## 1.9.1 - -### Patch Changes - -- 7342e9b: chore: remove @janus-idp/cli dep and relink local packages - - This update removes `@janus-idp/cli` from all plugins, as it’s no longer necessary. Additionally, packages are now correctly linked with a specified version. - -## 1.9.0 - -### Minor Changes - -- d9551ae: feat(deps): update to backstage 1.31 - -### Patch Changes - -- d9551ae: Change local package references to a `*` -- d9551ae: pin the @janus-idp/cli package -- d9551ae: upgrade to yarn v3 - -* **@janus-idp/cli:** upgraded to 1.15.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.1 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.14.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.1 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.7.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.6.0...@janus-idp/backstage-plugin-analytics-provider-segment@1.7.0) (2024-07-25) - -### Features - -- **deps:** update to backstage 1.29 ([#1900](https://github.com/janus-idp/backstage-plugins/issues/1900)) ([f53677f](https://github.com/janus-idp/backstage-plugins/commit/f53677fb02d6df43a9de98c43a9f101a6db76802)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.6.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.5.1...@janus-idp/backstage-plugin-analytics-provider-segment@1.6.0) (2024-07-23) - -### Features - -- **deps:** update to backstage 1.28 ([#1891](https://github.com/janus-idp/backstage-plugins/issues/1891)) ([1ba1108](https://github.com/janus-idp/backstage-plugins/commit/1ba11088e0de60e90d138944267b83600dc446e5)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.5.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.5.0...@janus-idp/backstage-plugin-analytics-provider-segment@1.5.1) (2024-06-19) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.1 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.10...@janus-idp/backstage-plugin-analytics-provider-segment@1.5.0) (2024-06-13) - -### Features - -- **deps:** update to backstage 1.27 ([#1683](https://github.com/janus-idp/backstage-plugins/issues/1683)) ([a14869c](https://github.com/janus-idp/backstage-plugins/commit/a14869c3f4177049cb8d6552b36c3ffd17e7997d)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.9...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.10) (2024-06-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.1 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.8...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.9) (2024-06-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.7...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.8) (2024-06-04) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.6...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.7) (2024-06-03) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.9.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.5...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.6) (2024-05-31) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.4...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.5) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.10 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.3...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.4) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.9 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.2...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.3) (2024-05-28) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.8 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.1...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.2) (2024-05-16) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.4.0...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.1) (2024-05-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.7 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.3.6...@janus-idp/backstage-plugin-analytics-provider-segment@1.4.0) (2024-05-14) - -### Features - -- **deps:** use RHDH themes in the backstage app and dev pages ([#1480](https://github.com/janus-idp/backstage-plugins/issues/1480)) ([8263bf0](https://github.com/janus-idp/backstage-plugins/commit/8263bf099736cbb0d0f2316082d338ba81fa6927)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.3.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.3.5...@janus-idp/backstage-plugin-analytics-provider-segment@1.3.6) (2024-05-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.6 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.3.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.3.4...@janus-idp/backstage-plugin-analytics-provider-segment@1.3.5) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.5 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.3.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.3.3...@janus-idp/backstage-plugin-analytics-provider-segment@1.3.4) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.4 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.3.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.3.2...@janus-idp/backstage-plugin-analytics-provider-segment@1.3.3) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.3 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.3.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.3.1...@janus-idp/backstage-plugin-analytics-provider-segment@1.3.2) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.2 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.3.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.3.0...@janus-idp/backstage-plugin-analytics-provider-segment@1.3.1) (2024-04-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.1 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.16...@janus-idp/backstage-plugin-analytics-provider-segment@1.3.0) (2024-04-15) - -### Features - -- checkPluginVersion.sh bump plugins for 1.2.0 release ([#1511](https://github.com/janus-idp/backstage-plugins/issues/1511)) ([73c6588](https://github.com/janus-idp/backstage-plugins/commit/73c6588adb7e8c20907b06f2a8ef248cfd4332e4)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.16](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.15...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.16) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.10 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.15](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.14...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.15) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.9 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.14](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.13...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.14) (2024-04-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.8 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.12...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.13) (2024-04-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.7 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.11...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.12) (2024-03-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.6 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.10...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.11) (2024-03-04) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.5 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.9...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.10) (2024-02-27) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.4 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.8...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.9) (2024-02-26) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.3 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.7...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.8) (2024-02-21) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.2 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.6...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.7) (2024-02-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.1 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.5...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.6) (2024-01-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.4...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.5) (2024-01-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.6.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.3...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.4) (2024-01-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.5.0 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.2...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.3) (2023-12-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.7 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.1...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.2) (2023-11-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.6 - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.2.0...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.1) (2023-11-23) - -### Bug Fixes - -- add config partials for dynamic frontend plugins ([#965](https://github.com/janus-idp/backstage-plugins/issues/965)) ([b01e55e](https://github.com/janus-idp/backstage-plugins/commit/b01e55e877278afc5de8d28a4c687a6989566bdc)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.1.4...@janus-idp/backstage-plugin-analytics-provider-segment@1.2.0) (2023-11-22) - -### Features - -- **segment:** expose plugin also as a dynamic ([#955](https://github.com/janus-idp/backstage-plugins/issues/955)) ([7b80a40](https://github.com/janus-idp/backstage-plugins/commit/7b80a4088b91c2d38af64fe9338c0815225dd1d4)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.1.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.1.3...@janus-idp/backstage-plugin-analytics-provider-segment@1.1.4) (2023-11-22) - -### Bug Fixes - -- segment config schema visibility typo ([#964](https://github.com/janus-idp/backstage-plugins/issues/964)) ([836c58c](https://github.com/janus-idp/backstage-plugins/commit/836c58c9be4bbac1033979151b2be0ea6de4bf37)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.1.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.1.2...@janus-idp/backstage-plugin-analytics-provider-segment@1.1.3) (2023-10-19) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.1.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.1.1...@janus-idp/backstage-plugin-analytics-provider-segment@1.1.2) (2023-09-22) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.1.0...@janus-idp/backstage-plugin-analytics-provider-segment@1.1.1) (2023-08-23) - -### Bug Fixes - -- **config types:** inline types in config.d.ts ([#664](https://github.com/janus-idp/backstage-plugins/issues/664)) ([ae1aea1](https://github.com/janus-idp/backstage-plugins/commit/ae1aea1f4890c0034d1c2602223d59463c61206b)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.7...@janus-idp/backstage-plugin-analytics-provider-segment@1.1.0) (2023-08-14) - -### Features - -- **ts:** transpile each plugin separately ([#634](https://github.com/janus-idp/backstage-plugins/issues/634)) ([b94c4dc](https://github.com/janus-idp/backstage-plugins/commit/b94c4dc50ada328e5ce1bed5fb7c76f64607e1ee)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.0.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.6...@janus-idp/backstage-plugin-analytics-provider-segment@1.0.7) (2023-07-25) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.0.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.5...@janus-idp/backstage-plugin-analytics-provider-segment@1.0.6) (2023-06-14) - -### Other changes - -- reorder imports via prettier ([#419](https://github.com/janus-idp/backstage-plugins/issues/419)) ([17f1e6a](https://github.com/janus-idp/backstage-plugins/commit/17f1e6a689bd793a619ec5e42e5cdda0998f78a5)) - -### Documentation - -- update plugin README formatting ([#396](https://github.com/janus-idp/backstage-plugins/issues/396)) ([9b39056](https://github.com/janus-idp/backstage-plugins/commit/9b39056f6c66e9a6a0a5d0c4059420dff66db263)), closes [#295](https://github.com/janus-idp/backstage-plugins/issues/295) [#369](https://github.com/janus-idp/backstage-plugins/issues/369) [#295](https://github.com/janus-idp/backstage-plugins/issues/295) [#369](https://github.com/janus-idp/backstage-plugins/issues/369) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.0.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.4...@janus-idp/backstage-plugin-analytics-provider-segment@1.0.5) (2023-05-30) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.0.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.3...@janus-idp/backstage-plugin-analytics-provider-segment@1.0.4) (2023-05-30) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.0.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.2...@janus-idp/backstage-plugin-analytics-provider-segment@1.0.3) (2023-05-18) - -### Documentation - -- update plugin READMEs ([#373](https://github.com/janus-idp/backstage-plugins/issues/373)) ([478560e](https://github.com/janus-idp/backstage-plugins/commit/478560e38cceaa40d976bccf4785956ed58b5221)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.0.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.1...@janus-idp/backstage-plugin-analytics-provider-segment@1.0.2) (2023-05-17) - -### Bug Fixes - -- **deps:** update all non-major dependencies ([#358](https://github.com/janus-idp/backstage-plugins/issues/358)) ([086a9ed](https://github.com/janus-idp/backstage-plugins/commit/086a9ed839f3a6dd1460f0f87b71453a7ed62ea3)) - -## @janus-idp/backstage-plugin-analytics-provider-segment [1.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-analytics-provider-segment@1.0.0...@janus-idp/backstage-plugin-analytics-provider-segment@1.0.1) (2023-05-16) - -### Bug Fixes - -- **segment:** fixes the config for optional parameters ([#363](https://github.com/janus-idp/backstage-plugins/issues/363)) ([4857f5d](https://github.com/janus-idp/backstage-plugins/commit/4857f5d6f0b028e32e492f07e5d033381b467386)) - -### Documentation - -- fix segment README ([#364](https://github.com/janus-idp/backstage-plugins/issues/364)) ([9f6ed93](https://github.com/janus-idp/backstage-plugins/commit/9f6ed9303297977864f0a3624552c454a1af64dd)) -- update Segment README.md ([#362](https://github.com/janus-idp/backstage-plugins/issues/362)) ([a75d30a](https://github.com/janus-idp/backstage-plugins/commit/a75d30a376a03b44f17cb7b410c30b3817581c43)) - -## @janus-idp/backstage-plugin-analytics-provider-segment 1.0.0 (2023-05-15) - -### Features - -- **segment:** analytics plugin for Segment ([#321](https://github.com/janus-idp/backstage-plugins/issues/321)) ([a60e047](https://github.com/janus-idp/backstage-plugins/commit/a60e04760bf45efd1005edb9ddb6d77c30911d30)) diff --git a/plugins/analytics-provider-segment/CONTRIBUTING.md b/plugins/analytics-provider-segment/CONTRIBUTING.md deleted file mode 100644 index f1ff31dc7a..0000000000 --- a/plugins/analytics-provider-segment/CONTRIBUTING.md +++ /dev/null @@ -1,17 +0,0 @@ -# Setting up the development environment for Analytics Provider Segment plugin - -If you would like to contribute improvements to this plugin, the easiest way to -make and test changes is to do the following: - -> 1. Clone the main Backstage monorepo `git clone git@github.com:janus-idp/backstage-plugins.git` -> 2. Install all dependencies `yarn install` -> 3. If one does not exist, create an `app-config.local.yaml` file in the root of -> the monorepo and add config for this plugin (see below) -> 4. Enter this plugin's working directory: `cd plugins/analytics-provider-segment` -> 5. Start the plugin in isolation: `yarn start` -> 6. Navigate to the playground page at `http://localhost:3000/segment` -> 7. Open the web console to see events fire when you navigate or when you -> interact with instrumented components. - -Code for the isolated version of the plugin can be found inside the `./dev` -directory. Changes to the plugin are hot-reloaded. diff --git a/plugins/analytics-provider-segment/README.md b/plugins/analytics-provider-segment/README.md index 21fb65e1cc..1b6b8e5491 100644 --- a/plugins/analytics-provider-segment/README.md +++ b/plugins/analytics-provider-segment/README.md @@ -1,76 +1,3 @@ -# Analytics Module: Segment +# Deprecated -This plugin provides an implementation of the Backstage Analytics API for -Segment. Once installed and configured, analytics events will be sent to -Segment as your users navigate and use your Backstage instance. - -This plugin contains no other functionality. - -## Installation - -1. Install the plugin package in your Backstage app: - - ```console - yarn workspace app add @janus-idp/backstage-plugin-analytics-provider-segment - ``` - -## Configuration - -1. Wire up the API implementation to your App in `packages/app/src/apis.ts`: - - ```tsx title="packages/app/src/apis.ts" - /* highlight-add-start */ - import { - analyticsApiRef, - configApiRef, - identityApiRef, - } from '@backstage/core-plugin-api'; - - import { SegmentAnalytics } from '@janus-idp/backstage-plugin-analytics-provider-segment'; - - /* highlight-add-end */ - - export const apis: AnyApiFactory[] = [ - // Other APIs... - // Instantiate and register the GA Analytics API Implementation. - /* highlight-add-start */ - createApiFactory({ - api: analyticsApiRef, - deps: { configApi: configApiRef, identityApi: identityApiRef }, - factory: ({ configApi, identityApi }) => - SegmentAnalytics.fromConfig(configApi, identityApi), - }), - /* highlight-add-end */ - ]; - ``` - -2. Configure the plugin in your `app-config.yaml`: - -The following is the minimum configuration required to start sending analytics -events to Segment. All that's needed is your Segment Write Key - -```yaml title="app-config.yaml" -app: - analytics: - segment: - # highlight-start - writeKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - maskIP: true # prevents IP addresses from being sent if true - # highlight-end -``` - -## Debugging and Testing - -In pre-production environments, you may wish to set additional configurations -to turn off reporting to Analytics. You can do so like this: - -```yaml title="app-config.yaml" -app: - analytics: - segment: - # highlight-next-line - testMode: true # prevents data from being sent if true -``` - -You might commonly set the above in an `app-config.local.yaml` file, which is -normally `gitignore`'d but loaded and merged in when Backstage is bootstrapped. +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-analytics-provider-segment` instead. \ No newline at end of file diff --git a/plugins/analytics-provider-segment/api-report.md b/plugins/analytics-provider-segment/api-report.md deleted file mode 100644 index 05eea30ab9..0000000000 --- a/plugins/analytics-provider-segment/api-report.md +++ /dev/null @@ -1,22 +0,0 @@ -## API Report File for "@internal/analytics-module-segment" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts -import { AnalyticsApi } from '@backstage/core-plugin-api'; -import { AnalyticsEvent } from '@backstage/core-plugin-api'; -import { BackstagePlugin } from '@backstage/core-plugin-api'; -import { Config } from '@backstage/config'; - -// @public @deprecated (undocumented) -export const analyticsModuleSegment: BackstagePlugin<{}, {}, {}>; - -// @public -export class SegmentAnalytics implements AnalyticsApi { - // (undocumented) - captureEvent(event: AnalyticsEvent): Promise; - static fromConfig(config: Config): SegmentAnalytics; -} - -// (No @packageDocumentation comment for this package) -``` diff --git a/plugins/analytics-provider-segment/app-config.janus-idp.yaml b/plugins/analytics-provider-segment/app-config.janus-idp.yaml deleted file mode 100644 index 127c2a448d..0000000000 --- a/plugins/analytics-provider-segment/app-config.janus-idp.yaml +++ /dev/null @@ -1,6 +0,0 @@ -app: - analytics: - segment: - writeKey: ${SEGMENT_WRITE_KEY} - maskIP: true # prevents IP addresses from being sent if true - testMode: false # prevents data from being sent if true diff --git a/plugins/analytics-provider-segment/catalog-info.yaml b/plugins/analytics-provider-segment/catalog-info.yaml deleted file mode 100644 index 0cd70064d3..0000000000 --- a/plugins/analytics-provider-segment/catalog-info.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-analytics-segment - title: 'Analytics Module: Segment' - description: 'Analytics Module: Segment' - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-provider-segment - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/analytics-provider-segment/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/analytics-provider-segment/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/maintainers-plugins - sonarqube.org/project-key: janus-idp_backstage-plugins - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-provider-segment - title: GitHub Source - icon: source - type: source -spec: - type: backstage-plugin - lifecycle: production - owner: rhdh-team - system: rhdh - subcomponentOf: janus-idp-backstage-plugins ---- -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-analytics-provider-segment - title: '@janus-idp/backstage-plugin-analytics-provider-segment' - description: 'Analytics Module: Segment' - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-provider-segment - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/analytics-provider-segment/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/analytics-provider-segment/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/maintainers-plugins - sonarqube.org/project-key: janus-idp_backstage-plugins - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/analytics-provider-segment - title: GitHub Source - icon: source - type: source -spec: - type: backstage-frontend-plugin-module - lifecycle: production - owner: rhdh-team - system: rhdh - subcomponentOf: janus-idp-analytics-segment diff --git a/plugins/analytics-provider-segment/config.d.ts b/plugins/analytics-provider-segment/config.d.ts deleted file mode 100644 index 2c0bb3998c..0000000000 --- a/plugins/analytics-provider-segment/config.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2022 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. - */ - -export interface Config { - app: { - // TODO: Only marked as optional because backstage-cli config:check in the - // context of the monorepo is too strict. Ideally, this would be marked as - // required. - analytics?: { - segment: - | { - /** - * The Segment write key. - * @visibility frontend - */ - writeKey?: string; - - /** - * Prevents events from actually being sent when set to true. Defaults - * to false. - * @visibility frontend - */ - testMode: true; - - /** - * Prevents IP address to be sent as when set to true. Defaults to false - * @visibility frontend - */ - maskIP?: boolean; - } - | { - /** - * The Segment write key. - * @visibility frontend - */ - writeKey: string; - - /** - * Prevents events from actually being sent when set to true. Defaults - * to false. - * @visibility frontend - */ - testMode?: false; - - /** - * Prevents IP address to be sent as when set to true. Defaults to false - * @visibility frontend - */ - maskIP?: boolean; - }; - }; - }; -} diff --git a/plugins/analytics-provider-segment/dev/Playground.tsx b/plugins/analytics-provider-segment/dev/Playground.tsx deleted file mode 100644 index 9ece76a492..0000000000 --- a/plugins/analytics-provider-segment/dev/Playground.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2022 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 React from 'react'; - -import { Link } from '@backstage/core-components'; - -export const Playground = () => { - return ( - <> - Click Here - - ); -}; diff --git a/plugins/analytics-provider-segment/dev/index.tsx b/plugins/analytics-provider-segment/dev/index.tsx deleted file mode 100644 index 400440ec09..0000000000 --- a/plugins/analytics-provider-segment/dev/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2022 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 React from 'react'; - -import { createDevApp } from '@backstage/dev-utils'; - -import { getAllThemes } from '@redhat-developer/red-hat-developer-hub-theme'; - -import { analyticsModuleSegment } from '../src'; -import { Playground } from './Playground'; - -createDevApp() - .registerPlugin(analyticsModuleSegment) - .addThemes(getAllThemes()) - .addPage({ - path: '/segment', - title: 'Segment Playground', - element: , - }) - .render(); diff --git a/plugins/analytics-provider-segment/package.json b/plugins/analytics-provider-segment/package.json deleted file mode 100644 index 401c2ba863..0000000000 --- a/plugins/analytics-provider-segment/package.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "name": "@janus-idp/backstage-plugin-analytics-provider-segment", - "version": "1.10.1", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" - }, - "backstage": { - "role": "frontend-plugin", - "supported-versions": "1.32.5", - "pluginId": "analytics-provider-segment", - "pluginPackage": "@janus-idp/backstage-plugin-analytics-provider-segment", - "pluginPackages": [ - "@janus-idp/backstage-plugin-analytics-provider-segment" - ] - }, - "sideEffects": false, - "scripts": { - "start": "backstage-cli package start", - "build": "backstage-cli package build", - "tsc": "tsc", - "prettier:check": "prettier --ignore-unknown --check .", - "prettier:fix": "prettier --ignore-unknown --write .", - "lint:check": "backstage-cli package lint", - "lint:fix": "backstage-cli package lint --fix", - "test": "backstage-cli package test --passWithNoTests --coverage", - "clean": "backstage-cli package clean", - "prepack": "backstage-cli package prepack", - "postpack": "backstage-cli package postpack" - }, - "dependencies": { - "@backstage/config": "^1.2.0", - "@backstage/core-components": "^0.15.1", - "@backstage/core-plugin-api": "^1.10.0", - "@backstage/theme": "^0.6.0", - "@material-ui/core": "^4.9.13", - "@material-ui/icons": "^4.11.3", - "@material-ui/lab": "4.0.0-alpha.61", - "@segment/analytics-next": "^1.58.0", - "prop-types": "^15.8.1", - "react-use": "^17.4.0" - }, - "peerDependencies": { - "react": "^16.13.1 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0", - "react-router-dom": "^6.0.0" - }, - "devDependencies": { - "@backstage/cli": "0.28.2", - "@backstage/core-app-api": "1.15.1", - "@backstage/dev-utils": "1.1.2", - "@backstage/test-utils": "1.7.0", - "@redhat-developer/red-hat-developer-hub-theme": "0.4.0", - "@testing-library/dom": "9.3.4", - "@testing-library/jest-dom": "6.4.8", - "@testing-library/react": "14.3.1", - "@testing-library/user-event": "14.5.2", - "@types/node": "18.19.34", - "@types/react": "18.3.3", - "cross-fetch": "4.0.0", - "msw": "1.3.3", - "prettier": "3.3.3" - }, - "files": [ - "dist", - "dist-scalprum", - "config.d.ts", - "app-config.janus-idp.yaml" - ], - "configSchema": "config.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/analytics-provider-segment" - }, - "maintainers": [ - "@janus-idp/maintainers-plugins" - ], - "author": "Red Hat", - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "keywords": [ - "support:production", - "lifecycle:active" - ] -} diff --git a/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/Segment.test.ts b/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/Segment.test.ts deleted file mode 100644 index 3787e149a0..0000000000 --- a/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/Segment.test.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 2022 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 } from '@backstage/config'; -import { IdentityApi } from '@backstage/core-plugin-api'; - -import { SegmentAnalytics } from './Segment'; - -const mockIdentify = jest.fn(); -const mockPage = jest.fn(); -const mockTrack = jest.fn(); -const mockLoad = jest.fn(); -jest.mock('@segment/analytics-next', () => { - return { - AnalyticsBrowser: function constructor() { - return { - identify: mockIdentify, - page: mockPage, - track: mockTrack, - load: mockLoad, - }; - }, - }; -}); - -describe('SegmentAnalytics', () => { - const context = { - extension: 'App', - pluginId: 'some-plugin', - routeRef: 'unknown', - releaseNum: 1337, - }; - const writeKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; - const basicValidConfig = new ConfigReader({ - app: { - analytics: { segment: { writeKey, testMode: false, maskIP: false } }, - }, - }); - - afterEach(() => { - jest.clearAllMocks(); - }); - - describe('fromConfig', () => { - it('throws when missing writeKey', () => { - const config = new ConfigReader({ app: { analytics: { segment: {} } } }); - expect(() => SegmentAnalytics.fromConfig(config)).toThrow( - /Missing required config value/, - ); - }); - - it('returns implementation', () => { - const api = SegmentAnalytics.fromConfig(basicValidConfig); - expect(api.captureEvent).toBeDefined(); - }); - }); - - describe('integration', () => { - const maskedIPConfig = new ConfigReader({ - app: { - analytics: { segment: { writeKey, testMode: false, maskIP: true } }, - }, - }); - - it('track identify calls', async () => { - const api = SegmentAnalytics.fromConfig(basicValidConfig); - await api.captureEvent({ - action: 'identify', - subject: 'jdoe', - context, - }); - - expect(mockIdentify).toHaveBeenCalledTimes(1); - expect(mockIdentify).toHaveBeenCalledWith( - /* hashed id */ '6a646f65', - {}, - {}, - ); - }); - - it('track identify with maskedIP', async () => { - const api = SegmentAnalytics.fromConfig(maskedIPConfig); - await api.captureEvent({ - action: 'identify', - subject: 'jdoe', - context, - }); - - expect(mockIdentify).toHaveBeenCalledTimes(1); - expect(mockIdentify).toHaveBeenCalledWith( - /* hashed id */ '6a646f65', - {}, - { ip: '0.0.0.0' }, - ); - }); - - it('tracks basic pageview', async () => { - const api = SegmentAnalytics.fromConfig(basicValidConfig); - await api.captureEvent({ - action: 'navigate', - subject: '/', - context, - }); - - expect(mockPage).toHaveBeenCalledTimes(1); - expect(mockPage).toHaveBeenCalledWith(context.pluginId, '/', context, {}); - }); - - it('tracks pageview with maskedIP', async () => { - const api = SegmentAnalytics.fromConfig(maskedIPConfig); - await api.captureEvent({ - action: 'navigate', - subject: '/', - context, - }); - expect(mockPage).toHaveBeenCalledTimes(1); - expect(mockPage).toHaveBeenCalledWith(context.pluginId, '/', context, { - ip: '0.0.0.0', - }); - }); - - it('tracks basic event', async () => { - const api = SegmentAnalytics.fromConfig(basicValidConfig); - - const expectedAction = 'click'; - const expectedLabel = 'on something'; - const expectedValue = 42; - await api.captureEvent({ - action: expectedAction, - subject: expectedLabel, - value: expectedValue, - context, - }); - - expect(mockTrack).toHaveBeenCalledTimes(1); - expect(mockTrack).toHaveBeenCalledWith( - expectedAction, - { - subject: expectedLabel, - context: context, - attributes: undefined, - }, - {}, - ); - }); - - it('tracks event with MaskedIP', async () => { - const api = SegmentAnalytics.fromConfig(maskedIPConfig); - - const expectedAction = 'click'; - const expectedLabel = 'on something'; - const expectedValue = 42; - await api.captureEvent({ - action: expectedAction, - subject: expectedLabel, - value: expectedValue, - context, - }); - - expect(mockTrack).toHaveBeenCalledTimes(1); - expect(mockTrack).toHaveBeenCalledWith( - expectedAction, - { - subject: expectedLabel, - context: context, - attributes: undefined, - }, - { ip: '0.0.0.0' }, - ); - }); - }); - - describe('identityApi', () => { - const identityApi = { - getBackstageIdentity: jest.fn().mockResolvedValue({ - userEntityRef: 'User:default/someone', - }), - } as unknown as IdentityApi; - it('track identify calls', async () => { - const api = SegmentAnalytics.fromConfig(basicValidConfig, identityApi); - await api.captureEvent({ - action: 'identify', - subject: 'jdoe', - context, - }); - - expect(mockIdentify).toHaveBeenCalledTimes(1); - expect(mockIdentify).toHaveBeenCalledWith( - /* hashed id */ '557365723a64656661756c742f736f6d656f6e65', - {}, - {}, - ); - }); - }); -}); diff --git a/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/Segment.ts b/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/Segment.ts deleted file mode 100644 index fa558e37b1..0000000000 --- a/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/Segment.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2022 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 { Config } from '@backstage/config'; -import { - AnalyticsApi, - AnalyticsEvent, - IdentityApi, -} from '@backstage/core-plugin-api'; - -import { AnalyticsBrowser } from '@segment/analytics-next'; - -/** - * Segment provider for the Backstage Analytics API. - * @public - */ -export class SegmentAnalytics implements AnalyticsApi { - private readonly analytics: AnalyticsBrowser; - private readonly testMode: boolean; - private readonly maskIP: boolean; - private readonly identityApi: IdentityApi | undefined; - - /** - * Instantiate the implementation and initialize Segment client. - */ - private constructor( - options: { writeKey: string; testMode: boolean; maskIP: boolean }, - identityApi?: IdentityApi, - ) { - const { writeKey, testMode, maskIP } = options; - this.identityApi = identityApi; - this.testMode = testMode; - this.maskIP = maskIP; - this.analytics = new AnalyticsBrowser(); - this.analytics.load({ writeKey: writeKey }); - } - - /** - * Instantiate a fully configured Segment API implementation. - */ - static fromConfig(config: Config, identityApi?: IdentityApi) { - const testMode = - config.getOptionalBoolean('app.analytics.segment.testMode') ?? false; - const writeKey = testMode - ? '' - : config.getString('app.analytics.segment.writeKey'); - const maskIP = - config.getOptionalBoolean('app.analytics.segment.maskIP') ?? false; - - return new SegmentAnalytics( - { - writeKey, - testMode, - maskIP, - }, - identityApi, - ); - } - - async captureEvent(event: AnalyticsEvent) { - // Don't capture events in test mode. - if (this.testMode) { - return; - } - const analyticsOpts = this.maskIP ? { ip: '0.0.0.0' } : {}; - const { action, subject, context, attributes } = event; - - // Identify users. - if (action === 'identify') { - let userId = ''; - if (this.identityApi) { - const { userEntityRef } = await this.identityApi.getBackstageIdentity(); - userId = await this.getPIIFreeUserID(userEntityRef); - } else { - userId = await this.getPIIFreeUserID(subject); - } - await this.analytics.identify(userId, {}, analyticsOpts); - return; - } - - // Track page views. - if (action === 'navigate') { - await this.analytics.page( - context.pluginId, - subject, - context, - analyticsOpts, - ); - return; - } - - // Track other events. - await this.analytics.track( - action, - { - subject: subject, - context: context, - attributes: attributes, - }, - analyticsOpts, - ); - } - - private async getPIIFreeUserID(userId: string): Promise { - return this.hash(userId); - } - - private async hash(value: string): Promise { - if (!value) return value; - const digest = await window.crypto.subtle.digest( - 'sha-256', - new TextEncoder().encode(value), - ); - const hashArray = Array.from(new Uint8Array(digest)); - return hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); - } -} diff --git a/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/index.ts b/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/index.ts deleted file mode 100644 index ab0e27d12c..0000000000 --- a/plugins/analytics-provider-segment/src/apis/implementations/AnalyticsApi/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2022 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. - */ - -export { SegmentAnalytics } from './Segment'; diff --git a/plugins/analytics-provider-segment/src/index.ts b/plugins/analytics-provider-segment/src/index.ts deleted file mode 100644 index 8c282718a5..0000000000 --- a/plugins/analytics-provider-segment/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2022 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 { - analyticsApiRef, - configApiRef, - createApiFactory, - identityApiRef, -} from '@backstage/core-plugin-api'; - -import { SegmentAnalytics } from './apis/implementations/AnalyticsApi'; - -export { analyticsModuleSegment } from './plugin'; -export * from './apis/implementations/AnalyticsApi'; -export const SegmentAnalyticsApi = createApiFactory({ - api: analyticsApiRef, - deps: { configApi: configApiRef, identityApi: identityApiRef }, - factory: ({ configApi, identityApi }) => - SegmentAnalytics.fromConfig(configApi, identityApi), -}); diff --git a/plugins/analytics-provider-segment/src/plugin.test.ts b/plugins/analytics-provider-segment/src/plugin.test.ts deleted file mode 100644 index ea59e669bf..0000000000 --- a/plugins/analytics-provider-segment/src/plugin.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2022 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 { analyticsModuleSegment } from './plugin'; - -describe('analytics-module-segment', () => { - it('should export plugin', () => { - expect(analyticsModuleSegment).toBeDefined(); - }); -}); diff --git a/plugins/analytics-provider-segment/src/plugin.ts b/plugins/analytics-provider-segment/src/plugin.ts deleted file mode 100644 index 4e7f6cfec2..0000000000 --- a/plugins/analytics-provider-segment/src/plugin.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2022 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 { createPlugin } from '@backstage/core-plugin-api'; - -/** - * - * @public Importing and including this plugin in an app has no effect. - */ -export const analyticsModuleSegment = createPlugin({ - id: 'analytics-provider-segment', -}); diff --git a/plugins/analytics-provider-segment/src/setupTests.ts b/plugins/analytics-provider-segment/src/setupTests.ts deleted file mode 100644 index 35af37896d..0000000000 --- a/plugins/analytics-provider-segment/src/setupTests.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2022 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 '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; - -// eslint-disable-next-line no-restricted-imports -import { TextEncoder } from 'util'; - -// Mock browser crypto.subtle.digest method for sha-256 hashing. -Object.defineProperty(global.self, 'crypto', { - value: { - subtle: { - digest: (_algo: string, data: Uint8Array): ArrayBuffer => data.buffer, - }, - }, -}); - -// Also used in browser-based APIs for hashing. -Object.defineProperty(global.self, 'TextEncoder', { - value: TextEncoder, -}); diff --git a/plugins/analytics-provider-segment/tsconfig.json b/plugins/analytics-provider-segment/tsconfig.json deleted file mode 100644 index f111d39822..0000000000 --- a/plugins/analytics-provider-segment/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@backstage/cli/config/tsconfig.json", - "include": ["src", "dev", "migrations"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "../../dist-types/plugins/analytics-provider-segment", - "rootDir": "." - } -} diff --git a/plugins/analytics-provider-segment/turbo.json b/plugins/analytics-provider-segment/turbo.json deleted file mode 100644 index 842f9064e6..0000000000 --- a/plugins/analytics-provider-segment/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/analytics-provider-segment/**"] - } - } -} diff --git a/plugins/matomo-backend/.eslintignore b/plugins/matomo-backend/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/matomo-backend/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/matomo-backend/.eslintrc.js b/plugins/matomo-backend/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/matomo-backend/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/matomo-backend/.lintstagedrc.json b/plugins/matomo-backend/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/matomo-backend/.lintstagedrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "*": "prettier --ignore-unknown --write", - "*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix" -} diff --git a/plugins/matomo-backend/.prettierignore b/plugins/matomo-backend/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/matomo-backend/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -dist -dist-types -coverage -.vscode -CHANGELOG.md -generated -templates -*.hbs -renovate.json -dist-dynamic -dist-scalprum -playwright-report diff --git a/plugins/matomo-backend/.prettierrc.js b/plugins/matomo-backend/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/matomo-backend/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-check - -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -module.exports = { - ...require('@spotify/prettier-config'), - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '^react(.*)$', - '', - '^@backstage/(.*)$', - '', - '', - '', - '^@janus-idp/(.*)$', - '', - '', - '', - '^[.]', - ], -}; diff --git a/plugins/matomo-backend/.versionhistory.md b/plugins/matomo-backend/.versionhistory.md deleted file mode 100644 index 161a6cfa3e..0000000000 --- a/plugins/matomo-backend/.versionhistory.md +++ /dev/null @@ -1,2 +0,0 @@ -- Bumped to 1.4.0 in main branch for next release 1.2.0 -- Bumped to 1.8.0 in main branch for next release 1.3.0 diff --git a/plugins/matomo-backend/CHANGELOG.md b/plugins/matomo-backend/CHANGELOG.md deleted file mode 100644 index 17192269ca..0000000000 --- a/plugins/matomo-backend/CHANGELOG.md +++ /dev/null @@ -1,328 +0,0 @@ -### Dependencies - -## 1.11.1 - -### Patch Changes - -- 0e6bfd3: feat: update Backstage to the latest version - - Update to Backstage 1.32.5 - -## 1.11.0 - -### Minor Changes - -- 8244f28: chore(deps): update to backstage 1.32 - -## 1.10.1 - -### Patch Changes - -- 7342e9b: chore: remove @janus-idp/cli dep and relink local packages - - This update removes `@janus-idp/cli` from all plugins, as it’s no longer necessary. Additionally, packages are now correctly linked with a specified version. - -## 1.10.0 - -### Minor Changes - -- d9551ae: feat(deps): update to backstage 1.31 - -### Patch Changes - -- d9551ae: Change local package references to a `*` -- d9551ae: pin the @janus-idp/cli package -- d9551ae: upgrade to yarn v3 -- d9551ae: Change the export-dynamic script to no longer use any flags and remove the tracking of the dist-dynamic folder - -* **@janus-idp/cli:** upgraded to 1.15.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.1 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.14.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.1 - -## @janus-idp/backstage-plugin-matomo-backend [1.7.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.6.0...@janus-idp/backstage-plugin-matomo-backend@1.7.0) (2024-07-26) - -### Features - -- **deps:** update to backstage 1.29 ([#1900](https://github.com/janus-idp/backstage-plugins/issues/1900)) ([f53677f](https://github.com/janus-idp/backstage-plugins/commit/f53677fb02d6df43a9de98c43a9f101a6db76802)) - -## @janus-idp/backstage-plugin-matomo-backend [1.6.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.5.1...@janus-idp/backstage-plugin-matomo-backend@1.6.0) (2024-07-24) - -### Features - -- **deps:** update to backstage 1.28 ([#1891](https://github.com/janus-idp/backstage-plugins/issues/1891)) ([1ba1108](https://github.com/janus-idp/backstage-plugins/commit/1ba11088e0de60e90d138944267b83600dc446e5)) - -## @janus-idp/backstage-plugin-matomo-backend [1.5.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.5.0...@janus-idp/backstage-plugin-matomo-backend@1.5.1) (2024-06-19) - -### Bug Fixes - -- **matomo:** add default export for new backend system ([#1822](https://github.com/janus-idp/backstage-plugins/issues/1822)) ([5e72920](https://github.com/janus-idp/backstage-plugins/commit/5e72920209589535d503bb28e77f54175a0bd946)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.1 - -## @janus-idp/backstage-plugin-matomo-backend [1.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.15...@janus-idp/backstage-plugin-matomo-backend@1.5.0) (2024-06-13) - -### Features - -- **deps:** update to backstage 1.27 ([#1683](https://github.com/janus-idp/backstage-plugins/issues/1683)) ([a14869c](https://github.com/janus-idp/backstage-plugins/commit/a14869c3f4177049cb8d6552b36c3ffd17e7997d)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.0 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.15](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.14...@janus-idp/backstage-plugin-matomo-backend@1.4.15) (2024-06-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.1 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.14](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.13...@janus-idp/backstage-plugin-matomo-backend@1.4.14) (2024-06-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.0 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.12...@janus-idp/backstage-plugin-matomo-backend@1.4.13) (2024-06-04) - -## @janus-idp/backstage-plugin-matomo-backend [1.4.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.11...@janus-idp/backstage-plugin-matomo-backend@1.4.12) (2024-06-04) - -## @janus-idp/backstage-plugin-matomo-backend [1.4.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.10...@janus-idp/backstage-plugin-matomo-backend@1.4.11) (2024-06-03) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.9.0 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.9...@janus-idp/backstage-plugin-matomo-backend@1.4.10) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.10 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.8...@janus-idp/backstage-plugin-matomo-backend@1.4.9) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.9 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.7...@janus-idp/backstage-plugin-matomo-backend@1.4.8) (2024-05-23) - -### Bug Fixes - -- **deps:** upgrade devex plugins to mui v5 ([#1696](https://github.com/janus-idp/backstage-plugins/issues/1696)) ([06d9cf0](https://github.com/janus-idp/backstage-plugins/commit/06d9cf0d8c134212329eb691ac21eb78ae155c09)) - -## @janus-idp/backstage-plugin-matomo-backend [1.4.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.6...@janus-idp/backstage-plugin-matomo-backend@1.4.7) (2024-05-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.7 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.5...@janus-idp/backstage-plugin-matomo-backend@1.4.6) (2024-05-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.6 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.4...@janus-idp/backstage-plugin-matomo-backend@1.4.5) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.5 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.3...@janus-idp/backstage-plugin-matomo-backend@1.4.4) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.4 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.2...@janus-idp/backstage-plugin-matomo-backend@1.4.3) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.3 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.1...@janus-idp/backstage-plugin-matomo-backend@1.4.2) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.2 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.4.0...@janus-idp/backstage-plugin-matomo-backend@1.4.1) (2024-04-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.1 - -## @janus-idp/backstage-plugin-matomo-backend [1.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.10...@janus-idp/backstage-plugin-matomo-backend@1.4.0) (2024-04-15) - -### Features - -- checkPluginVersion.sh bump plugins for 1.2.0 release ([#1511](https://github.com/janus-idp/backstage-plugins/issues/1511)) ([73c6588](https://github.com/janus-idp/backstage-plugins/commit/73c6588adb7e8c20907b06f2a8ef248cfd4332e4)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.0 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.9...@janus-idp/backstage-plugin-matomo-backend@1.3.10) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.10 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.8...@janus-idp/backstage-plugin-matomo-backend@1.3.9) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.9 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.7...@janus-idp/backstage-plugin-matomo-backend@1.3.8) (2024-04-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.8 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.6...@janus-idp/backstage-plugin-matomo-backend@1.3.7) (2024-04-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.7 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.5...@janus-idp/backstage-plugin-matomo-backend@1.3.6) (2024-03-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.6 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.4...@janus-idp/backstage-plugin-matomo-backend@1.3.5) (2024-03-04) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.5 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.3...@janus-idp/backstage-plugin-matomo-backend@1.3.4) (2024-02-27) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.4 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.2...@janus-idp/backstage-plugin-matomo-backend@1.3.3) (2024-02-26) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.3 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.1...@janus-idp/backstage-plugin-matomo-backend@1.3.2) (2024-02-21) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.2 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.3.0...@janus-idp/backstage-plugin-matomo-backend@1.3.1) (2024-02-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.1 - -## @janus-idp/backstage-plugin-matomo-backend [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.8...@janus-idp/backstage-plugin-matomo-backend@1.3.0) (2024-01-30) - -### Features - -- add new backend system support for existing backend plugins that have not been migrated over yet ([#1132](https://github.com/janus-idp/backstage-plugins/issues/1132)) ([06e16fd](https://github.com/janus-idp/backstage-plugins/commit/06e16fdcf64257dd08297cb727445d9a8a23c522)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.0 - -## @janus-idp/backstage-plugin-matomo-backend [1.2.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.7...@janus-idp/backstage-plugin-matomo-backend@1.2.8) (2024-01-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.6.0 - -## @janus-idp/backstage-plugin-matomo-backend [1.2.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.6...@janus-idp/backstage-plugin-matomo-backend@1.2.7) (2024-01-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.5.0 - -## @janus-idp/backstage-plugin-matomo-backend [1.2.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.5...@janus-idp/backstage-plugin-matomo-backend@1.2.6) (2023-12-07) - -### Bug Fixes - -- attempt to force a bump of backend plugins ([#1007](https://github.com/janus-idp/backstage-plugins/issues/1007)) ([7a37225](https://github.com/janus-idp/backstage-plugins/commit/7a372254fb7e8107aa794f7900a6511eee096677)) - -## @janus-idp/backstage-plugin-matomo-backend [1.2.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.4...@janus-idp/backstage-plugin-matomo-backend@1.2.5) (2023-12-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.7 - -## @janus-idp/backstage-plugin-matomo-backend [1.2.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.3...@janus-idp/backstage-plugin-matomo-backend@1.2.4) (2023-11-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.6 - -## @janus-idp/backstage-plugin-matomo-backend [1.2.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.2...@janus-idp/backstage-plugin-matomo-backend@1.2.3) (2023-11-23) - -### Bug Fixes - -- add config partials for dynamic frontend plugins ([#965](https://github.com/janus-idp/backstage-plugins/issues/965)) ([b01e55e](https://github.com/janus-idp/backstage-plugins/commit/b01e55e877278afc5de8d28a4c687a6989566bdc)) - -## @janus-idp/backstage-plugin-matomo-backend [1.2.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.1...@janus-idp/backstage-plugin-matomo-backend@1.2.2) (2023-11-22) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.5 - -## @janus-idp/backstage-plugin-matomo-backend [1.2.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.2.0...@janus-idp/backstage-plugin-matomo-backend@1.2.1) (2023-11-21) - -### Bug Fixes - -- sync versions in dynamic assets and publish derived packages as additional packages ([#963](https://github.com/janus-idp/backstage-plugins/issues/963)) ([7d0a386](https://github.com/janus-idp/backstage-plugins/commit/7d0a38609b4a18b54c75378a150e8b5c3ba8ff43)) - -## @janus-idp/backstage-plugin-matomo-backend [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.1.2...@janus-idp/backstage-plugin-matomo-backend@1.2.0) (2023-11-21) - -### Features - -- make all backend plugins dynamic ([#954](https://github.com/janus-idp/backstage-plugins/issues/954)) ([1b4338a](https://github.com/janus-idp/backstage-plugins/commit/1b4338a45c3b92f5607391b2bfc17c4d29050ce3)) - -## @janus-idp/backstage-plugin-matomo-backend [1.1.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.1.1...@janus-idp/backstage-plugin-matomo-backend@1.1.2) (2023-11-20) - -### Bug Fixes - -- **aap+3scale+ocm:** don't log sensitive data from errors ([#945](https://github.com/janus-idp/backstage-plugins/issues/945)) ([7a5e7b8](https://github.com/janus-idp/backstage-plugins/commit/7a5e7b8a57c9841003d9b16e1a65fb62e101fbf1)) - -## @janus-idp/backstage-plugin-matomo-backend [1.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.1.0...@janus-idp/backstage-plugin-matomo-backend@1.1.1) (2023-11-13) - -## @janus-idp/backstage-plugin-matomo-backend [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.0.1...@janus-idp/backstage-plugin-matomo-backend@1.1.0) (2023-10-23) - -### Features - -- **cli:** add frontend dynamic plugins base build config ([#747](https://github.com/janus-idp/backstage-plugins/issues/747)) ([91e06da](https://github.com/janus-idp/backstage-plugins/commit/91e06da8ab108c17fd2a6531f25e01c7a7350276)), closes [#831](https://github.com/janus-idp/backstage-plugins/issues/831) - -## @janus-idp/backstage-plugin-matomo-backend [1.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo-backend@1.0.0...@janus-idp/backstage-plugin-matomo-backend@1.0.1) (2023-10-19) - -## @janus-idp/backstage-plugin-matomo-backend 1.0.0 (2023-09-22) - -### Features - -- **#360:** implemented matomo plugin ([#370](https://github.com/janus-idp/backstage-plugins/issues/370)) ([1112a7e](https://github.com/janus-idp/backstage-plugins/commit/1112a7ee0e99e3f9959a8ec05554fde2d459452d)), closes [#360](https://github.com/janus-idp/backstage-plugins/issues/360) [#360](https://github.com/janus-idp/backstage-plugins/issues/360) diff --git a/plugins/matomo-backend/README.md b/plugins/matomo-backend/README.md index a1f3b0752d..77649c0c82 100644 --- a/plugins/matomo-backend/README.md +++ b/plugins/matomo-backend/README.md @@ -1,44 +1,3 @@ -# Matomo Backend +# Deprecated -This is the matomo backend plugin that act as a proxy with matomo instance. - -Plugin will inject the auth token and ensure that the request are only read only operations. - -Matomo API cannot be used as proxy layer due to the token auth it follows. Thus this plugin will act as proxy layer - -## Getting Started - -### Installing the NPM package - -```bash -yarn add --cwd packages/backend @janus-idp/plugin-matomo-backend -``` - -### Installing the plugin - -#### Adding the plugin to the new backend - -Add the following to your `packages/backend/src/index.ts` file: - -```ts title="packages/backend/src/index.ts" -const backend = createBackend(); - -// Add the following line -backend.add(import('@janus-idp/backstage-plugin-matomo-backend')); - -backend.start(); -``` - -### Plugin Configurations - -Add the following configurations into your `app-config.yaml` file: - -```yaml -matomo: - apiToken: ${MATOMO_API_TOKEN} - - apiUrl: ${MATOMO_API_URL} - - # (OPTIONAL) Set to false if you get SSL certificate error - secure: ${MATOMO_SECURE_FLAG} -``` +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-matomo-backend` instead. \ No newline at end of file diff --git a/plugins/matomo-backend/app-config.janus-idp.yaml b/plugins/matomo-backend/app-config.janus-idp.yaml deleted file mode 100644 index 4d698dd24d..0000000000 --- a/plugins/matomo-backend/app-config.janus-idp.yaml +++ /dev/null @@ -1,5 +0,0 @@ -matomo: - apiToken: ${MATOMO_API_TOKEN} - apiUrl: ${MATOMO_API_URL} - # Set to false if you get SSL certificate error - secure: ${MATOMO_SECURE_FLAG} diff --git a/plugins/matomo-backend/catalog-info.yaml b/plugins/matomo-backend/catalog-info.yaml deleted file mode 100644 index 27ee60f26d..0000000000 --- a/plugins/matomo-backend/catalog-info.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-matomo-backend - title: '@janus-idp/backstage-plugin-matomo-backend' - description: Matomo backend plugin - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/matomo-backend - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/matomo-backend/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/matomo-backend/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/maintainers-plugins - sonarqube.org/project-key: janus-idp_backstage-plugins - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/matomo-backend - title: GitHub Source - icon: source - type: source -spec: - type: backstage-backend-plugin - lifecycle: production - owner: rhdh-team - system: rhdh - subcomponentOf: janus-idp-matomo diff --git a/plugins/matomo-backend/config.d.ts b/plugins/matomo-backend/config.d.ts deleted file mode 100644 index 15af7acee2..0000000000 --- a/plugins/matomo-backend/config.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface Config { - matomo: { - /** - * @visibility backend - */ - apiToken: string; - /** - * @visibility backend - */ - apiUrl: string; - /** - * Set to false if you get SSL certificate error - * @visibility backend - */ - secure: boolean; - }; -} diff --git a/plugins/matomo-backend/dev/index.ts b/plugins/matomo-backend/dev/index.ts deleted file mode 100644 index 37f804fdd7..0000000000 --- a/plugins/matomo-backend/dev/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createBackend } from '@backstage/backend-defaults'; - -import matomoBackendPlugin from '../src'; - -const backend = createBackend(); - -backend.add(matomoBackendPlugin); - -backend.start(); diff --git a/plugins/matomo-backend/package.json b/plugins/matomo-backend/package.json deleted file mode 100644 index 5164ebc60e..0000000000 --- a/plugins/matomo-backend/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "@janus-idp/backstage-plugin-matomo-backend", - "version": "1.11.1", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public" - }, - "configSchema": "config.d.ts", - "backstage": { - "role": "backend-plugin", - "supported-versions": "1.32.5", - "pluginId": "matomo", - "pluginPackages": [ - "@janus-idp/backstage-plugin-matomo", - "@janus-idp/backstage-plugin-matomo-backend" - ] - }, - "exports": { - ".": "./src/index.ts", - "./package.json": "./package.json" - }, - "typesVersions": { - "*": { - "package.json": [ - "package.json" - ] - } - }, - "scripts": { - "build": "backstage-cli package build", - "clean": "backstage-cli package clean", - "lint:check": "backstage-cli package lint", - "lint:fix": "backstage-cli package lint --fix", - "postpack": "backstage-cli package postpack", - "prepack": "backstage-cli package prepack", - "start": "backstage-cli package start", - "test": "backstage-cli package test --passWithNoTests --coverage", - "tsc": "tsc", - "prettier:check": "prettier --ignore-unknown --check .", - "prettier:fix": "prettier --ignore-unknown --write ." - }, - "dependencies": { - "@backstage/backend-defaults": "^0.5.2", - "@backstage/backend-plugin-api": "^1.0.1", - "@backstage/config": "^1.2.0", - "@types/express": "4.17.20", - "express": "^4.18.2", - "http-proxy-middleware": "^2.0.6", - "node-fetch": "^3.3.2", - "yn": "^4.0.0" - }, - "devDependencies": { - "@backstage/cli": "0.28.2", - "@types/supertest": "2.0.16", - "msw": "1.3.3", - "prettier": "3.3.3", - "supertest": "6.3.4" - }, - "files": [ - "dist", - "config.d.ts", - "dist-dynamic/*.*", - "dist-dynamic/dist/**", - "dist-dynamic/alpha/*", - "app-config.janus-idp.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/matomo-backend" - }, - "keywords": [ - "support:tech-preview", - "lifecycle:active", - "backstage", - "plugin" - ], - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "maintainers": [ - "@janus-idp/maintainers-plugins", - "@janus-idp/devex-uxe" - ], - "author": "The Backstage Community" -} diff --git a/plugins/matomo-backend/src/index.ts b/plugins/matomo-backend/src/index.ts deleted file mode 100644 index 11ba5f745f..0000000000 --- a/plugins/matomo-backend/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './service/router'; -export { matomoBackendPlugin as default } from './plugin'; diff --git a/plugins/matomo-backend/src/plugin.ts b/plugins/matomo-backend/src/plugin.ts deleted file mode 100644 index 1e03649f8c..0000000000 --- a/plugins/matomo-backend/src/plugin.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2024 The Janus IDP 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 { - coreServices, - createBackendPlugin, -} from '@backstage/backend-plugin-api'; - -import { createRouter } from './service/router'; - -export const matomoBackendPlugin = createBackendPlugin({ - pluginId: 'matomo', - register(env) { - env.registerInit({ - deps: { - http: coreServices.httpRouter, - logger: coreServices.logger, - config: coreServices.rootConfig, - }, - async init({ http, logger, config }) { - logger.info('Matomo plugin is running'); - const router = await createRouter({ - config, - logger, - }); - http.use(router); - }, - }); - }, -}); diff --git a/plugins/matomo-backend/src/service/router.ts b/plugins/matomo-backend/src/service/router.ts deleted file mode 100644 index 4eac9f04c8..0000000000 --- a/plugins/matomo-backend/src/service/router.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter'; -import type { LoggerService } from '@backstage/backend-plugin-api'; -import { Config } from '@backstage/config'; - -import express, { Router } from 'express'; -import { createProxyMiddleware } from 'http-proxy-middleware'; - -export interface RouterOptions { - logger: LoggerService; - config: Config; -} - -export async function createRouter(options: RouterOptions): Promise { - const { logger, config } = options; - - const matomoToken = config.getString('matomo.apiToken'); - const matomoApiUrl = config.getString('matomo.apiUrl'); - const isSecure = config.getOptionalBoolean('matomo.secure'); - if (!matomoToken || !matomoApiUrl) { - throw new Error( - 'Missing matomo config in app-config.yaml. Add matomo.apiToken and matomo.apiUrl in config', - ); - } - - const router = Router(); - router.use(express.urlencoded({ extended: false })); - router.use((req, res, next) => { - if (req.method === 'POST' && req.body) { - const params = new URLSearchParams(req.body); - const method = params.get('method'); - if (!method?.includes('.get')) { - res.status(400).json({ message: 'read only operation' }); - return; - } - params.set('token_auth', matomoToken); - req.body = params.toString(); - } - next(); - }); - - router.use( - '/', - createProxyMiddleware({ - target: matomoApiUrl, - changeOrigin: true, - secure: isSecure ?? true, - onProxyReq: (proxyReq, req) => { - proxyReq.setHeader('Content-Type', 'application/x-www-form-urlencoded'); - proxyReq.setHeader('Content-Length', Buffer.byteLength(req.body)); - proxyReq.write(req.body); - }, - pathRewrite: { - ['/api/matomo']: '/', - }, - }), - ); - - const middleware = MiddlewareFactory.create({ logger, config }); - - router.use(middleware.error()); - return router; -} diff --git a/plugins/matomo-backend/src/setupTests.ts b/plugins/matomo-backend/src/setupTests.ts deleted file mode 100644 index cb0ff5c3b5..0000000000 --- a/plugins/matomo-backend/src/setupTests.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/plugins/matomo-backend/tsconfig.json b/plugins/matomo-backend/tsconfig.json deleted file mode 100644 index 9a78c37bc0..0000000000 --- a/plugins/matomo-backend/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@backstage/cli/config/tsconfig.json", - "include": ["src", "dev", "migrations"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "../../dist-types/plugins/matomo-backend", - "rootDir": "." - } -} diff --git a/plugins/matomo-backend/turbo.json b/plugins/matomo-backend/turbo.json deleted file mode 100644 index 35c360b0bc..0000000000 --- a/plugins/matomo-backend/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/matomo-backend/**"] - } - } -} diff --git a/plugins/matomo/.eslintignore b/plugins/matomo/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/matomo/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/matomo/.eslintrc.js b/plugins/matomo/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/matomo/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/matomo/.lintstagedrc.json b/plugins/matomo/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/matomo/.lintstagedrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "*": "prettier --ignore-unknown --write", - "*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix" -} diff --git a/plugins/matomo/.prettierignore b/plugins/matomo/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/matomo/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -dist -dist-types -coverage -.vscode -CHANGELOG.md -generated -templates -*.hbs -renovate.json -dist-dynamic -dist-scalprum -playwright-report diff --git a/plugins/matomo/.prettierrc.js b/plugins/matomo/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/matomo/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-check - -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -module.exports = { - ...require('@spotify/prettier-config'), - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '^react(.*)$', - '', - '^@backstage/(.*)$', - '', - '', - '', - '^@janus-idp/(.*)$', - '', - '', - '', - '^[.]', - ], -}; diff --git a/plugins/matomo/.versionhistory.md b/plugins/matomo/.versionhistory.md deleted file mode 100644 index 237de4f3c7..0000000000 --- a/plugins/matomo/.versionhistory.md +++ /dev/null @@ -1,2 +0,0 @@ -- Bumped to 1.3.0 in main branch for next release 1.2.0 -- Bumped to 1.8.0 in main branch for next release 1.3.0 diff --git a/plugins/matomo/CHANGELOG.md b/plugins/matomo/CHANGELOG.md deleted file mode 100644 index bba893b4b9..0000000000 --- a/plugins/matomo/CHANGELOG.md +++ /dev/null @@ -1,365 +0,0 @@ -### Dependencies - -## 1.10.1 - -### Patch Changes - -- 0e6bfd3: feat: update Backstage to the latest version - - Update to Backstage 1.32.5 - -## 1.10.0 - -### Minor Changes - -- 8244f28: chore(deps): update to backstage 1.32 - -## 1.9.1 - -### Patch Changes - -- 7342e9b: chore: remove @janus-idp/cli dep and relink local packages - - This update removes `@janus-idp/cli` from all plugins, as it’s no longer necessary. Additionally, packages are now correctly linked with a specified version. - -## 1.9.0 - -### Minor Changes - -- d9551ae: feat(deps): update to backstage 1.31 - -### Patch Changes - -- d9551ae: Change local package references to a `*` -- d9551ae: pin the @janus-idp/cli package -- d9551ae: upgrade to yarn v3 - -* **@janus-idp/cli:** upgraded to 1.15.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.1 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.14.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.1 - -## @janus-idp/backstage-plugin-matomo [1.7.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.6.0...@janus-idp/backstage-plugin-matomo@1.7.0) (2024-07-26) - -### Features - -- **deps:** update to backstage 1.29 ([#1900](https://github.com/janus-idp/backstage-plugins/issues/1900)) ([f53677f](https://github.com/janus-idp/backstage-plugins/commit/f53677fb02d6df43a9de98c43a9f101a6db76802)) - -## @janus-idp/backstage-plugin-matomo [1.6.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.5.1...@janus-idp/backstage-plugin-matomo@1.6.0) (2024-07-24) - -### Features - -- **deps:** update to backstage 1.28 ([#1891](https://github.com/janus-idp/backstage-plugins/issues/1891)) ([1ba1108](https://github.com/janus-idp/backstage-plugins/commit/1ba11088e0de60e90d138944267b83600dc446e5)) - -## @janus-idp/backstage-plugin-matomo [1.5.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.5.0...@janus-idp/backstage-plugin-matomo@1.5.1) (2024-06-19) - -### Bug Fixes - -- **matomo:** add default export for new backend system ([#1822](https://github.com/janus-idp/backstage-plugins/issues/1822)) ([5e72920](https://github.com/janus-idp/backstage-plugins/commit/5e72920209589535d503bb28e77f54175a0bd946)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.1 - -## @janus-idp/backstage-plugin-matomo [1.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.11...@janus-idp/backstage-plugin-matomo@1.5.0) (2024-06-13) - -### Features - -- **deps:** update to backstage 1.27 ([#1683](https://github.com/janus-idp/backstage-plugins/issues/1683)) ([a14869c](https://github.com/janus-idp/backstage-plugins/commit/a14869c3f4177049cb8d6552b36c3ffd17e7997d)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.0 - -## @janus-idp/backstage-plugin-matomo [1.4.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.10...@janus-idp/backstage-plugin-matomo@1.4.11) (2024-06-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.1 - -## @janus-idp/backstage-plugin-matomo [1.4.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.9...@janus-idp/backstage-plugin-matomo@1.4.10) (2024-06-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.0 - -## @janus-idp/backstage-plugin-matomo [1.4.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.8...@janus-idp/backstage-plugin-matomo@1.4.9) (2024-06-04) - -## @janus-idp/backstage-plugin-matomo [1.4.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.7...@janus-idp/backstage-plugin-matomo@1.4.8) (2024-06-04) - -## @janus-idp/backstage-plugin-matomo [1.4.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.6...@janus-idp/backstage-plugin-matomo@1.4.7) (2024-06-03) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.9.0 - -## @janus-idp/backstage-plugin-matomo [1.4.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.5...@janus-idp/backstage-plugin-matomo@1.4.6) (2024-05-31) - -## @janus-idp/backstage-plugin-matomo [1.4.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.4...@janus-idp/backstage-plugin-matomo@1.4.5) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.10 - -## @janus-idp/backstage-plugin-matomo [1.4.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.3...@janus-idp/backstage-plugin-matomo@1.4.4) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.9 - -## @janus-idp/backstage-plugin-matomo [1.4.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.2...@janus-idp/backstage-plugin-matomo@1.4.3) (2024-05-28) - -### Bug Fixes - -- **deps:** upgrade devex plugins to mui v5 ([#1696](https://github.com/janus-idp/backstage-plugins/issues/1696)) ([06d9cf0](https://github.com/janus-idp/backstage-plugins/commit/06d9cf0d8c134212329eb691ac21eb78ae155c09)) - -## @janus-idp/backstage-plugin-matomo [1.4.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.1...@janus-idp/backstage-plugin-matomo@1.4.2) (2024-05-16) - -## @janus-idp/backstage-plugin-matomo [1.4.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.4.0...@janus-idp/backstage-plugin-matomo@1.4.1) (2024-05-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.7 - -## @janus-idp/backstage-plugin-matomo [1.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.3.6...@janus-idp/backstage-plugin-matomo@1.4.0) (2024-05-14) - -### Features - -- **deps:** use RHDH themes in the backstage app and dev pages ([#1480](https://github.com/janus-idp/backstage-plugins/issues/1480)) ([8263bf0](https://github.com/janus-idp/backstage-plugins/commit/8263bf099736cbb0d0f2316082d338ba81fa6927)) - -## @janus-idp/backstage-plugin-matomo [1.3.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.3.5...@janus-idp/backstage-plugin-matomo@1.3.6) (2024-05-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.6 - -## @janus-idp/backstage-plugin-matomo [1.3.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.3.4...@janus-idp/backstage-plugin-matomo@1.3.5) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.5 - -## @janus-idp/backstage-plugin-matomo [1.3.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.3.3...@janus-idp/backstage-plugin-matomo@1.3.4) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.4 - -## @janus-idp/backstage-plugin-matomo [1.3.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.3.2...@janus-idp/backstage-plugin-matomo@1.3.3) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.3 - -## @janus-idp/backstage-plugin-matomo [1.3.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.3.1...@janus-idp/backstage-plugin-matomo@1.3.2) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.2 - -## @janus-idp/backstage-plugin-matomo [1.3.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.3.0...@janus-idp/backstage-plugin-matomo@1.3.1) (2024-04-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.1 - -## @janus-idp/backstage-plugin-matomo [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.12...@janus-idp/backstage-plugin-matomo@1.3.0) (2024-04-15) - -### Features - -- checkPluginVersion.sh bump plugins for 1.2.0 release ([#1511](https://github.com/janus-idp/backstage-plugins/issues/1511)) ([73c6588](https://github.com/janus-idp/backstage-plugins/commit/73c6588adb7e8c20907b06f2a8ef248cfd4332e4)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.0 - -## @janus-idp/backstage-plugin-matomo [1.2.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.11...@janus-idp/backstage-plugin-matomo@1.2.12) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.10 - -## @janus-idp/backstage-plugin-matomo [1.2.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.10...@janus-idp/backstage-plugin-matomo@1.2.11) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.9 - -## @janus-idp/backstage-plugin-matomo [1.2.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.9...@janus-idp/backstage-plugin-matomo@1.2.10) (2024-04-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.8 - -## @janus-idp/backstage-plugin-matomo [1.2.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.8...@janus-idp/backstage-plugin-matomo@1.2.9) (2024-04-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.7 - -## @janus-idp/backstage-plugin-matomo [1.2.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.7...@janus-idp/backstage-plugin-matomo@1.2.8) (2024-03-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.6 - -## @janus-idp/backstage-plugin-matomo [1.2.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.6...@janus-idp/backstage-plugin-matomo@1.2.7) (2024-03-04) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.5 - -## @janus-idp/backstage-plugin-matomo [1.2.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.5...@janus-idp/backstage-plugin-matomo@1.2.6) (2024-02-27) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.4 - -## @janus-idp/backstage-plugin-matomo [1.2.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.4...@janus-idp/backstage-plugin-matomo@1.2.5) (2024-02-26) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.3 - -## @janus-idp/backstage-plugin-matomo [1.2.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.3...@janus-idp/backstage-plugin-matomo@1.2.4) (2024-02-21) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.2 - -## @janus-idp/backstage-plugin-matomo [1.2.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.2...@janus-idp/backstage-plugin-matomo@1.2.3) (2024-02-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.1 - -## @janus-idp/backstage-plugin-matomo [1.2.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.1...@janus-idp/backstage-plugin-matomo@1.2.2) (2024-01-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.0 - -## @janus-idp/backstage-plugin-matomo [1.2.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.2.0...@janus-idp/backstage-plugin-matomo@1.2.1) (2024-01-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.6.0 - -## @janus-idp/backstage-plugin-matomo [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.13...@janus-idp/backstage-plugin-matomo@1.2.0) (2024-01-16) - -### Features - -- **Notifications:** new notifications FE plugin, API and backend ([#933](https://github.com/janus-idp/backstage-plugins/issues/933)) ([4d4cb78](https://github.com/janus-idp/backstage-plugins/commit/4d4cb781ca9fc331a2c621583e9203f9e4585ee7)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.5.0 - -## @janus-idp/backstage-plugin-matomo [1.1.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.12...@janus-idp/backstage-plugin-matomo@1.1.13) (2023-12-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.7 - -## @janus-idp/backstage-plugin-matomo [1.1.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.11...@janus-idp/backstage-plugin-matomo@1.1.12) (2023-11-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.6 - -## @janus-idp/backstage-plugin-matomo [1.1.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.10...@janus-idp/backstage-plugin-matomo@1.1.11) (2023-11-23) - -### Bug Fixes - -- add config partials for dynamic frontend plugins ([#965](https://github.com/janus-idp/backstage-plugins/issues/965)) ([b01e55e](https://github.com/janus-idp/backstage-plugins/commit/b01e55e877278afc5de8d28a4c687a6989566bdc)) - -## @janus-idp/backstage-plugin-matomo [1.1.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.9...@janus-idp/backstage-plugin-matomo@1.1.10) (2023-11-22) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.5 - -## @janus-idp/backstage-plugin-matomo [1.1.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.8...@janus-idp/backstage-plugin-matomo@1.1.9) (2023-11-21) - -### Bug Fixes - -- sync versions in dynamic assets and publish derived packages as additional packages ([#963](https://github.com/janus-idp/backstage-plugins/issues/963)) ([7d0a386](https://github.com/janus-idp/backstage-plugins/commit/7d0a38609b4a18b54c75378a150e8b5c3ba8ff43)) - -## @janus-idp/backstage-plugin-matomo [1.1.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.7...@janus-idp/backstage-plugin-matomo@1.1.8) (2023-11-20) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.4 - -## @janus-idp/backstage-plugin-matomo [1.1.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.6...@janus-idp/backstage-plugin-matomo@1.1.7) (2023-11-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.3 - -## @janus-idp/backstage-plugin-matomo [1.1.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.5...@janus-idp/backstage-plugin-matomo@1.1.6) (2023-11-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.2 - -## @janus-idp/backstage-plugin-matomo [1.1.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.4...@janus-idp/backstage-plugin-matomo@1.1.5) (2023-11-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.1 - -## @janus-idp/backstage-plugin-matomo [1.1.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.3...@janus-idp/backstage-plugin-matomo@1.1.4) (2023-11-13) - -## @janus-idp/backstage-plugin-matomo [1.1.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.2...@janus-idp/backstage-plugin-matomo@1.1.3) (2023-11-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.0 - -## @janus-idp/backstage-plugin-matomo [1.1.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.1...@janus-idp/backstage-plugin-matomo@1.1.2) (2023-11-06) - -### Bug Fixes - -- **cli:** add default scalprum config ([#909](https://github.com/janus-idp/backstage-plugins/issues/909)) ([d74fc72](https://github.com/janus-idp/backstage-plugins/commit/d74fc72ab7e0a843da047c7b6570d8a6fbc068e1)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.3.3 - -## @janus-idp/backstage-plugin-matomo [1.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.1.0...@janus-idp/backstage-plugin-matomo@1.1.1) (2023-11-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.3.2 - -## @janus-idp/backstage-plugin-matomo [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.0.1...@janus-idp/backstage-plugin-matomo@1.1.0) (2023-11-01) - -### Features - -- **dynamic-plugins:** publish dynamic assets for all frontend plugins ([#896](https://github.com/janus-idp/backstage-plugins/issues/896)) ([dcfb0ac](https://github.com/janus-idp/backstage-plugins/commit/dcfb0ac56769c82f6b8b2cef2726251e0b60c375)) - -## @janus-idp/backstage-plugin-matomo [1.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-matomo@1.0.0...@janus-idp/backstage-plugin-matomo@1.0.1) (2023-10-19) - -## @janus-idp/backstage-plugin-matomo 1.0.0 (2023-09-22) - -### Features - -- **#360:** implemented matomo plugin ([#370](https://github.com/janus-idp/backstage-plugins/issues/370)) ([1112a7e](https://github.com/janus-idp/backstage-plugins/commit/1112a7ee0e99e3f9959a8ec05554fde2d459452d)), closes [#360](https://github.com/janus-idp/backstage-plugins/issues/360) [#360](https://github.com/janus-idp/backstage-plugins/issues/360) diff --git a/plugins/matomo/README.md b/plugins/matomo/README.md index 9ad5f56b63..b92e69b54d 100644 --- a/plugins/matomo/README.md +++ b/plugins/matomo/README.md @@ -1,49 +1,3 @@ -# Matomo Plugin +# Deprecated -The matomo plugin shows the basic analytics from [Matomo](https://matomo.org/) - -![Matomo tab](./docs/matomo-tab.png) - -## Getting started - -1. Install the plugin - -```bash -yarn workspace app add @janus-idp/backstage-plugin-matomo -``` - -2. Make sure the [Matomo backend plugin](../matomo-backend/README.md) is installed and configured - -### Entity Pages - -1. Add the plugin as a tab to website entity pages - -```ts -// In packages/app/src/components/catalog/EntityPage.tsx -import { MatomoPage } from '@janus-idp/plugin-matomo'; - -const websiteEntityPage = ( - - - - - -); -``` - -2. Add `matomo.io/site-id`annotation to `catalog-info-yaml` - -```yaml -metadata: - name: matomo-website - annotations: - matomo.io/site-id: ', - title: 'Root Page', - path: '/matomo', - }) - .render(); diff --git a/plugins/matomo/docs/matomo-tab.png b/plugins/matomo/docs/matomo-tab.png deleted file mode 100644 index 667a82a3cd..0000000000 Binary files a/plugins/matomo/docs/matomo-tab.png and /dev/null differ diff --git a/plugins/matomo/package.json b/plugins/matomo/package.json deleted file mode 100644 index 5444ddd051..0000000000 --- a/plugins/matomo/package.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "name": "@janus-idp/backstage-plugin-matomo", - "version": "1.10.1", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" - }, - "configSchema": "config.d.ts", - "backstage": { - "role": "frontend-plugin", - "supported-versions": "1.32.5", - "pluginId": "matomo", - "pluginPackages": [ - "@janus-idp/backstage-plugin-matomo", - "@janus-idp/backstage-plugin-matomo-backend" - ] - }, - "sideEffects": false, - "scripts": { - "build": "backstage-cli package build", - "clean": "backstage-cli package clean", - "lint:check": "backstage-cli package lint", - "lint:fix": "backstage-cli package lint --fix", - "postpack": "backstage-cli package postpack", - "prepack": "backstage-cli package prepack", - "start": "backstage-cli package start", - "test": "backstage-cli package test --passWithNoTests --coverage", - "tsc": "tsc", - "prettier:check": "prettier --ignore-unknown --check .", - "prettier:fix": "prettier --ignore-unknown --write ." - }, - "dependencies": { - "@backstage/catalog-model": "^1.7.0", - "@backstage/core-components": "^0.15.1", - "@backstage/core-plugin-api": "^1.10.0", - "@backstage/plugin-catalog-react": "^1.14.0", - "@backstage/theme": "^0.6.0", - "@mui/icons-material": "^5.15.18", - "@mui/material": "^5.15.18", - "@tanstack/react-query": "^4.36.1", - "axios": "^1.7.4", - "react-use": "^17.4.0", - "recharts": "^2.9.0" - }, - "peerDependencies": { - "react": "^16.13.1 || ^17.0.0 || ^18.0.0" - }, - "devDependencies": { - "@backstage/cli": "0.28.2", - "@backstage/core-app-api": "1.15.1", - "@backstage/dev-utils": "1.1.2", - "@backstage/test-utils": "1.7.0", - "@redhat-developer/red-hat-developer-hub-theme": "0.4.0", - "@testing-library/jest-dom": "6.4.8", - "@testing-library/react": "14.3.1", - "@testing-library/user-event": "14.5.2", - "@types/node": "18.19.33", - "cross-fetch": "4.0.0", - "msw": "1.3.3", - "prettier": "3.3.3" - }, - "files": [ - "dist", - "dist-scalprum", - "config.d.ts", - "app-config.janus-idp.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/matomo" - }, - "keywords": [ - "support:tech-preview", - "lifecycle:active", - "backstage", - "plugin" - ], - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "maintainers": [ - "@janus-idp/maintainers-plugins", - "@janus-idp/devex-uxe" - ], - "author": "The Backstage Community" -} diff --git a/plugins/matomo/src/api/index.ts b/plugins/matomo/src/api/index.ts deleted file mode 100644 index e8648da672..0000000000 --- a/plugins/matomo/src/api/index.ts +++ /dev/null @@ -1,238 +0,0 @@ -import { ConfigApi, createApiRef, FetchApi } from '@backstage/core-plugin-api'; - -import { - TActionByPageURLMetrics, - TActionMetrics, - TDeviceMetrics, - TGeoMetrics, - TUserVisitMetrics, - TUserVisitReportData, -} from './types'; - -type Metric = { value: number; metric: string }; - -export type MatomoAPI = { - getUserVisitMetrics: ( - idSite: string, - period: string, - date: string, - ) => Promise; - getUserGeoMetrics: ( - idSite: string, - period: string, - date: string, - ) => Promise; - getUserDeviceMetrics: ( - idSite: string, - period: string, - date: string, - ) => Promise; - getUserActionByPageURL: ( - idSite: string, - period: string, - date: string, - ) => Promise< - Array< - Omit & { - avg_time_on_page: number; - } - > - >; - getUserActionMetrics: ( - idSite: string, - period: string, - date: string, - ) => Promise; -}; - -type Options = { - configApi: ConfigApi; - fetchApi: FetchApi; -}; - -export const matomoApiRef = createApiRef({ - id: 'plugin.matomo.service', -}); - -export const transformVisitByTime = ( - reportData: TUserVisitMetrics['reportData'], -) => { - const data: { name: string; visitors: number; uniqVisitors: number }[] = []; - Object.keys(reportData).forEach(key => { - data.push({ - name: key, - visitors: - (reportData[key as keyof TUserVisitReportData] as TUserVisitReportData) - .nb_visits || 0, - uniqVisitors: - (reportData[key as keyof TUserVisitReportData] as TUserVisitReportData) - .nb_uniq_visitors || 0, - }); - }); - return data.sort( - (a, b) => new Date(a.name).valueOf() - new Date(b.name).valueOf(), - ); -}; - -export class MatomoApiClient implements MatomoAPI { - private readonly configApi: ConfigApi; - private readonly fetchApi: FetchApi; - - constructor(options: Options) { - this.configApi = options.configApi; - this.fetchApi = options.fetchApi; - } - - async getUserVisitMetrics( - idSite: string, - period: string, - date: string, - ): Promise { - const backendUrl = this.configApi.getString('backend.baseUrl'); - const res = await this.fetchApi.fetch( - `${backendUrl}/api/matomo?module=API&format=json`, - { - method: 'POST', - body: new URLSearchParams({ - idSite, - method: 'API.getProcessedReport', - period, - date, - apiModule: 'VisitsSummary', - apiAction: 'get', - }).toString(), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - }, - }, - ); - return res.json(); - } - - async getUserGeoMetrics( - idSite: string, - period: string, - date: string, - ): Promise { - const backendUrl = this.configApi.getString('backend.baseUrl'); - const res = await this.fetchApi.fetch( - `${backendUrl}/api/matomo?module=API&format=json`, - { - method: 'POST', - body: new URLSearchParams({ - idSite, - method: 'API.getProcessedReport', - period, - date, - apiModule: 'UserCountry', - apiAction: 'getCountry', - }).toString(), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - }, - }, - ); - return res.json(); - } - - async getUserDeviceMetrics( - idSite: string, - period: string, - date: string, - ): Promise { - const backendUrl = this.configApi.getString('backend.baseUrl'); - const res = await this.fetchApi.fetch( - `${backendUrl}/api/matomo?module=API&format=json`, - { - method: 'POST', - body: new URLSearchParams({ - idSite, - method: 'API.getProcessedReport', - period, - date, - apiModule: 'DevicesDetection', - apiAction: 'getType', - }).toString(), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - }, - }, - ); - return res.json(); - } - - async getUserActionByPageURL( - idSite: string, - period: string, - date: string, - ): Promise< - Array< - Omit & { - avg_time_on_page: number; - } - > - > { - const backendUrl = this.configApi.getString('backend.baseUrl'); - const res = await this.fetchApi.fetch( - `${backendUrl}/api/matomo?module=API&format=json`, - { - method: 'POST', - body: new URLSearchParams({ - idSite, - method: 'API.getProcessedReport', - period, - date, - apiModule: 'Actions', - apiAction: 'getPageUrls', - }).toString(), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - }, - }, - ); - const data = (await res.json()) as TActionByPageURLMetrics; - return data.reportData.map(({ bounce_rate, avg_time_on_page, ...el }) => { - const avgTimeStr = avg_time_on_page.split(':'); - const avgTime = - parseInt(avgTimeStr[0], 10) * 3600 + - parseInt(avgTimeStr[1], 10) * 60 + - parseInt(avgTimeStr[2], 10); - - return { - ...el, - bounce_rate: bounce_rate.slice(0, -1), - avg_time_on_page: avgTime, - }; - }); - } - - async getUserActionMetrics( - idSite: string, - period: string, - date: string, - ): Promise { - const backendUrl = this.configApi.getString('backend.baseUrl'); - const res = await this.fetchApi.fetch( - `${backendUrl}/api/matomo?module=API&format=json`, - { - method: 'POST', - body: new URLSearchParams({ - idSite, - method: 'API.getProcessedReport', - period, - date, - apiModule: 'Actions', - apiAction: 'get', - }).toString(), - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - }, - }, - ); - const { reportData, columns } = (await res.json()) as TActionMetrics; - return Object.keys(columns).map(metric => ({ - metric: columns[metric as keyof TActionMetrics['reportData']], - value: reportData?.[metric as keyof TActionMetrics['reportData']], - })); - } -} diff --git a/plugins/matomo/src/api/types.ts b/plugins/matomo/src/api/types.ts deleted file mode 100644 index 3cfc6edfe8..0000000000 --- a/plugins/matomo/src/api/types.ts +++ /dev/null @@ -1,60 +0,0 @@ -export type TUserVisitMetrics = { - columns: Record; - reportData: TUserVisitReportData | Record; -}; - -export type TUserVisitReportData = { - nb_uniq_visitors: number; - nb_visits: number; - nb_actions: number; - max_actions: number; - nb_actions_per_visit: number; - avg_time_on_site: string; - bounce_rate: string; -}; - -export type TGeoMetrics = { - columns: Record; - reportData: Array; -}; - -export type TDeviceMetrics = { - columns: Record; - reportData: Array; -}; - -export type TActionMetrics = { - columns: Record; - reportData: { - nb_pageviews: number; - nb_uniq_pageviews: number; - nb_downloads: number; - nb_uniq_downloads: number; - nb_outlinks: number; - nb_uniq_outlinks: number; - nb_searches: number; - nb_keywords: number; - }; -}; - -type TVisitorReport = { - label: string; - nb_uniq_visitors: number; - nb_visits: number; - nb_actions: number; - nb_actions_per_visit: number; - avg_time_on_site: string; - bounce_rate: string; - revenue: string; -}; - -export type TActionByPageURLMetrics = { - reportData: Array<{ - label: string; - nb_visits: number; - nb_hits: number; - bounce_rate: string; - avg_time_on_page: string; - exit_rate: string; - }>; -}; diff --git a/plugins/matomo/src/components/MatomoPage/MatomoPage.tsx b/plugins/matomo/src/components/MatomoPage/MatomoPage.tsx deleted file mode 100644 index 167009cd1c..0000000000 --- a/plugins/matomo/src/components/MatomoPage/MatomoPage.tsx +++ /dev/null @@ -1,516 +0,0 @@ -/* eslint-disable no-nested-ternary */ -import React, { ReactNode, useState } from 'react'; -import useAsync from 'react-use/lib/useAsync'; - -import { Entity } from '@backstage/catalog-model'; -import { - InfoCard, - MissingAnnotationEmptyState, - Table, - TableColumn, -} from '@backstage/core-components'; -import { configApiRef, useApi } from '@backstage/core-plugin-api'; -import { useEntity } from '@backstage/plugin-catalog-react'; - -import Assessment from '@mui/icons-material/Assessment'; -import ContactMail from '@mui/icons-material/ContactMail'; -import Box from '@mui/material/Box'; -import Card from '@mui/material/Card'; -import CardContent from '@mui/material/CardContent'; -import CircularProgress from '@mui/material/CircularProgress'; -import FormControl from '@mui/material/FormControl'; -import Grid from '@mui/material/Grid'; -import InputLabel from '@mui/material/InputLabel'; -import MenuItem from '@mui/material/MenuItem'; -import Select from '@mui/material/Select'; -import MuiTooltip from '@mui/material/Tooltip'; -import Typography from '@mui/material/Typography'; -import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { - CartesianGrid, - Cell, - Legend, - Line, - LineChart, - Pie, - PieChart, - ResponsiveContainer, - Tooltip, - XAxis, - YAxis, -} from 'recharts'; - -import { matomoApiRef, transformVisitByTime } from '../../api'; -import { StatsCard } from './StatsCard'; - -const visitColumns: TableColumn[] = [ - { - title: 'Type', - field: 'metric', - }, - { - title: 'Value', - field: 'value', - }, -]; - -const geoColumns: TableColumn[] = [ - { - title: 'Country', - field: 'label', - }, - { - title: 'Avg. Site Time', - field: 'avg_time_on_site', - }, - { - title: 'Bounce Rate', - field: 'bounce_rate', - }, - { - title: 'Actions', - field: 'nb_actions', - }, - { - title: 'Actions/Visit', - field: 'nb_actions_per_visit', - }, - { - title: 'Visitors', - field: 'nb_visits', - }, - { - title: 'Unique Visitors', - field: 'nb_uniq_visitors', - }, -]; - -const Center = ({ children }: { children: ReactNode }) => ( -
- {children} -
-); - -const EmptyState = () => ( - - N/A - -); - -const getMatomoConfig = (entity: Entity) => - entity.metadata.annotations?.['matomo.io/site-id']; - -export const MatomoHomePage = () => { - const [period, setPeriod] = useState('day'); - const [range, setRange] = useState('today'); - const [lineGraphRange, setLineGraphRange] = useState('last10'); - - const { entity } = useEntity(); - const config = useApi(configApiRef); - const matomoApi = useApi(matomoApiRef); - const matomoSiteId = getMatomoConfig(entity); - - const matomoContact = config.getOptionalString('matomo.contactUsLink'); - const matomoInstanceUrl = config.getOptionalString('matomo.frontendBaseUrl'); - const isMatomoConfigured = Boolean(matomoSiteId); - - // visitor data - const { loading: isVisitSummaryLoading, value: visitSummary } = - useAsync(async () => { - if (matomoSiteId) { - return await matomoApi.getUserVisitMetrics(matomoSiteId, period, range); - } - return undefined; - }, [matomoSiteId, period, range]); - - const { loading: isVisitByTimeLoading, value: visitByTime } = - useAsync(async () => { - if (matomoSiteId) { - const data = await matomoApi.getUserVisitMetrics( - matomoSiteId, - period, - lineGraphRange, - ); - return transformVisitByTime(data.reportData); - } - return undefined; - }, [matomoSiteId, period, lineGraphRange]); - - const { loading: isGeoMetricsLoading, value: geoMetrics } = - useAsync(async () => { - if (matomoSiteId) { - return await matomoApi.getUserGeoMetrics(matomoSiteId, period, range); - } - return undefined; - }, [matomoSiteId, period, range]); - - const { loading: isDeviceMetricsLoading, value: deviceMetrics } = - useAsync(async () => { - if (matomoSiteId) { - return await matomoApi.getUserDeviceMetrics( - matomoSiteId, - period, - range, - ); - } - return undefined; - }, [matomoSiteId, period, range]); - - const { loading: isActionMetricsLoading, value: actionMetrics } = - useAsync(async () => { - if (matomoSiteId) { - return await matomoApi.getUserActionMetrics( - matomoSiteId, - period, - range, - ); - } - return undefined; - }, [matomoSiteId, period, range]); - - const { loading: isActionByPageUrlLoading, value: actionByPageURL } = - useAsync(async () => { - if (matomoSiteId) { - return await matomoApi.getUserActionByPageURL( - matomoSiteId, - period, - range, - ); - } - return undefined; - }, [matomoSiteId, period, range]); - - const visitPieChart = [ - { name: 'visitors', value: visitSummary?.reportData?.nb_visits }, - { - name: 'unique visitors', - value: visitSummary?.reportData?.nb_uniq_visitors, - }, - ]; - - if (!isMatomoConfigured) { - return ; - } - - return ( - <> - - - - - Matomo Site ID: {matomoSiteId} - - - {Boolean(matomoContact) && ( - - - - - - - - )} - {Boolean(matomoInstanceUrl) && ( - - - - - - - - )} - - - -
- - Period - - -
-
- - Range - - -
-
-
-
- - - - - - Visit Summary - - {isVisitSummaryLoading ? ( -
- -
- ) : Boolean(visitSummary?.reportData?.nb_visits) ? ( - - - - - - - - - - - ) : ( -
- -
- )} -
-
-
- - - -
- - Visits Over Time - -
- - Range - - -
-
- {isVisitByTimeLoading ? ( -
- -
- ) : Boolean(visitByTime) ? ( - - - - - - - - - - - - ) : ( -
- -
- )} -
-
-
- - - - - - - - - - - - - - - - - - - Visit By Page URL - - {isActionByPageUrlLoading ? ( -
- -
- ) : Boolean(actionByPageURL?.length) ? ( - - - - - - - - - - - - ) : ( -
- -
- )} -
-
-
- - - - - Time By Page URL - - {isActionByPageUrlLoading ? ( -
- -
- ) : Boolean(actionByPageURL?.length) ? ( - - - - - - - - - - - - ) : ( -
- -
- )} -
-
-
-
- - -
- - -
- - - - ); -}; - -const queryClient = new QueryClient(); - -export const MatomoPage = () => ( - - - -); diff --git a/plugins/matomo/src/components/MatomoPage/StatsCard.tsx b/plugins/matomo/src/components/MatomoPage/StatsCard.tsx deleted file mode 100644 index e5ee4df667..0000000000 --- a/plugins/matomo/src/components/MatomoPage/StatsCard.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React, { ReactNode } from 'react'; - -import Card from '@mui/material/Card'; -import CardContent from '@mui/material/CardContent'; -import CircularProgress from '@mui/material/CircularProgress'; -import Typography from '@mui/material/Typography'; - -type Props = { - title: string; - subTitle?: ReactNode; - isLoading?: boolean; -}; - -export const StatsCard = ({ title, subTitle, isLoading }: Props) => { - return ( - - - {isLoading ? ( - - ) : ( - <> - - {title} - - - {subTitle || 'N/A'} - - - )} - - - ); -}; diff --git a/plugins/matomo/src/components/MatomoPage/index.tsx b/plugins/matomo/src/components/MatomoPage/index.tsx deleted file mode 100644 index 709d410861..0000000000 --- a/plugins/matomo/src/components/MatomoPage/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { MatomoPage } from './MatomoPage'; diff --git a/plugins/matomo/src/index.ts b/plugins/matomo/src/index.ts deleted file mode 100644 index a13126b81f..0000000000 --- a/plugins/matomo/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { matomoPlugin, MatomoPage } from './plugin'; diff --git a/plugins/matomo/src/plugin.test.ts b/plugins/matomo/src/plugin.test.ts deleted file mode 100644 index f101d39bc4..0000000000 --- a/plugins/matomo/src/plugin.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { matomoPlugin } from './plugin'; - -describe('matomo', () => { - it('should export plugin', () => { - expect(matomoPlugin).toBeDefined(); - }); -}); diff --git a/plugins/matomo/src/plugin.ts b/plugins/matomo/src/plugin.ts deleted file mode 100644 index 1bc9c6ffff..0000000000 --- a/plugins/matomo/src/plugin.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { - configApiRef, - createApiFactory, - createPlugin, - createRoutableExtension, - fetchApiRef, -} from '@backstage/core-plugin-api'; - -import { MatomoApiClient, matomoApiRef } from './api'; -import { rootRouteRef } from './routes'; - -export const matomoPlugin = createPlugin({ - id: 'matomo', - routes: { - root: rootRouteRef, - }, - apis: [ - createApiFactory({ - api: matomoApiRef, - deps: { - configApi: configApiRef, - fetchApi: fetchApiRef, - }, - factory: ({ configApi, fetchApi }) => - new MatomoApiClient({ configApi, fetchApi }), - }), - ], -}); - -export const MatomoPage = matomoPlugin.provide( - createRoutableExtension({ - name: 'MatomoPage', - component: () => import('./components/MatomoPage').then(m => m.MatomoPage), - mountPoint: rootRouteRef, - }), -); diff --git a/plugins/matomo/src/routes.ts b/plugins/matomo/src/routes.ts deleted file mode 100644 index 3fe9f8fa14..0000000000 --- a/plugins/matomo/src/routes.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createRouteRef } from '@backstage/core-plugin-api'; - -export const rootRouteRef = createRouteRef({ - id: 'matomo', -}); diff --git a/plugins/matomo/src/setupTests.ts b/plugins/matomo/src/setupTests.ts deleted file mode 100644 index 48c09b5346..0000000000 --- a/plugins/matomo/src/setupTests.ts +++ /dev/null @@ -1,2 +0,0 @@ -import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/matomo/tsconfig.json b/plugins/matomo/tsconfig.json deleted file mode 100644 index 8bbeccfd36..0000000000 --- a/plugins/matomo/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@backstage/cli/config/tsconfig.json", - "include": ["src", "dev", "migrations"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "../../dist-types/plugins/matomo", - "rootDir": "." - } -} diff --git a/plugins/matomo/turbo.json b/plugins/matomo/turbo.json deleted file mode 100644 index e9962c9914..0000000000 --- a/plugins/matomo/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/matomo/**"] - } - } -} diff --git a/plugins/quay-actions/.eslintignore b/plugins/quay-actions/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/quay-actions/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/quay-actions/.eslintrc.js b/plugins/quay-actions/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/quay-actions/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/quay-actions/.lintstagedrc.json b/plugins/quay-actions/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/quay-actions/.lintstagedrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "*": "prettier --ignore-unknown --write", - "*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix" -} diff --git a/plugins/quay-actions/.prettierignore b/plugins/quay-actions/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/quay-actions/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -dist -dist-types -coverage -.vscode -CHANGELOG.md -generated -templates -*.hbs -renovate.json -dist-dynamic -dist-scalprum -playwright-report diff --git a/plugins/quay-actions/.prettierrc.js b/plugins/quay-actions/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/quay-actions/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-check - -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -module.exports = { - ...require('@spotify/prettier-config'), - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '^react(.*)$', - '', - '^@backstage/(.*)$', - '', - '', - '', - '^@janus-idp/(.*)$', - '', - '', - '', - '^[.]', - ], -}; diff --git a/plugins/quay-actions/.versionhistory.md b/plugins/quay-actions/.versionhistory.md deleted file mode 100644 index 161a6cfa3e..0000000000 --- a/plugins/quay-actions/.versionhistory.md +++ /dev/null @@ -1,2 +0,0 @@ -- Bumped to 1.4.0 in main branch for next release 1.2.0 -- Bumped to 1.8.0 in main branch for next release 1.3.0 diff --git a/plugins/quay-actions/CHANGELOG.md b/plugins/quay-actions/CHANGELOG.md deleted file mode 100644 index d225d6d309..0000000000 --- a/plugins/quay-actions/CHANGELOG.md +++ /dev/null @@ -1,320 +0,0 @@ -### Dependencies - -## 2.2.1 - -### Patch Changes - -- 0e6bfd3: feat: update Backstage to the latest version - - Update to Backstage 1.32.5 - -## 2.2.0 - -### Minor Changes - -- 8244f28: chore(deps): update to backstage 1.32 - -## 2.1.1 - -### Patch Changes - -- 7342e9b: chore: remove @janus-idp/cli dep and relink local packages - - This update removes `@janus-idp/cli` from all plugins, as it’s no longer necessary. Additionally, packages are now correctly linked with a specified version. - -## 2.1.0 - -### Minor Changes - -- d9551ae: feat(deps): update to backstage 1.31 - -### Patch Changes - -- d9551ae: Change local package references to a `*` -- d9551ae: pin the @janus-idp/cli package -- d9551ae: upgrade to yarn v3 -- d9551ae: Change the export-dynamic script to no longer use any flags and remove the tracking of the dist-dynamic folder - -* **@janus-idp/cli:** upgraded to 1.15.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.1 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.14.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.1 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.7.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.6.0...@janus-idp/backstage-scaffolder-backend-module-quay@1.7.0) (2024-07-26) - -### Features - -- **deps:** update to backstage 1.29 ([#1900](https://github.com/janus-idp/backstage-plugins/issues/1900)) ([f53677f](https://github.com/janus-idp/backstage-plugins/commit/f53677fb02d6df43a9de98c43a9f101a6db76802)) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.6.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.5.1...@janus-idp/backstage-scaffolder-backend-module-quay@1.6.0) (2024-07-24) - -### Features - -- **deps:** update to backstage 1.28 ([#1891](https://github.com/janus-idp/backstage-plugins/issues/1891)) ([1ba1108](https://github.com/janus-idp/backstage-plugins/commit/1ba11088e0de60e90d138944267b83600dc446e5)) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.5.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.5.0...@janus-idp/backstage-scaffolder-backend-module-quay@1.5.1) (2024-06-19) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.1 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.13...@janus-idp/backstage-scaffolder-backend-module-quay@1.5.0) (2024-06-13) - -### Features - -- **deps:** update to backstage 1.27 ([#1683](https://github.com/janus-idp/backstage-plugins/issues/1683)) ([a14869c](https://github.com/janus-idp/backstage-plugins/commit/a14869c3f4177049cb8d6552b36c3ffd17e7997d)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.0 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.12...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.13) (2024-06-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.1 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.11...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.12) (2024-06-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.0 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.10...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.11) (2024-06-04) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.9...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.10) (2024-06-03) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.9.0 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.8...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.9) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.10 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.7...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.8) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.9 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.6...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.7) (2024-05-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.7 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.5...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.6) (2024-05-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.6 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.4...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.5) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.5 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.3...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.4) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.4 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.2...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.3) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.3 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.1...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.2) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.2 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.4.0...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.1) (2024-04-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.1 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.10...@janus-idp/backstage-scaffolder-backend-module-quay@1.4.0) (2024-04-15) - -### Features - -- checkPluginVersion.sh bump plugins for 1.2.0 release ([#1511](https://github.com/janus-idp/backstage-plugins/issues/1511)) ([73c6588](https://github.com/janus-idp/backstage-plugins/commit/73c6588adb7e8c20907b06f2a8ef248cfd4332e4)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.0 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.9...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.10) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.10 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.8...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.9) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.9 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.7...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.8) (2024-04-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.8 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.6...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.7) (2024-04-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.7 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.5...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.6) (2024-03-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.6 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.4...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.5) (2024-03-04) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.5 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.3...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.4) (2024-02-27) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.4 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.2...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.3) (2024-02-26) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.3 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.1...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.2) (2024-02-21) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.2 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.3.0...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.1) (2024-02-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.1 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.7...@janus-idp/backstage-scaffolder-backend-module-quay@1.3.0) (2024-01-30) - -### Features - -- add new backend system support for existing backend plugins that have not been migrated over yet ([#1132](https://github.com/janus-idp/backstage-plugins/issues/1132)) ([06e16fd](https://github.com/janus-idp/backstage-plugins/commit/06e16fdcf64257dd08297cb727445d9a8a23c522)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.0 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.6...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.7) (2024-01-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.6.0 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.5...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.6) (2024-01-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.5.0 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.4...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.5) (2023-12-07) - -### Bug Fixes - -- attempt to force a bump of backend plugins ([#1007](https://github.com/janus-idp/backstage-plugins/issues/1007)) ([7a37225](https://github.com/janus-idp/backstage-plugins/commit/7a372254fb7e8107aa794f7900a6511eee096677)) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.3...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.4) (2023-12-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.7 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.2...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.3) (2023-11-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.6 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.1...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.2) (2023-11-22) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.5 - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.2.0...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.1) (2023-11-21) - -### Bug Fixes - -- sync versions in dynamic assets and publish derived packages as additional packages ([#963](https://github.com/janus-idp/backstage-plugins/issues/963)) ([7d0a386](https://github.com/janus-idp/backstage-plugins/commit/7d0a38609b4a18b54c75378a150e8b5c3ba8ff43)) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.1.1...@janus-idp/backstage-scaffolder-backend-module-quay@1.2.0) (2023-11-21) - -### Features - -- make all backend plugins dynamic ([#954](https://github.com/janus-idp/backstage-plugins/issues/954)) ([1b4338a](https://github.com/janus-idp/backstage-plugins/commit/1b4338a45c3b92f5607391b2bfc17c4d29050ce3)) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.1.0...@janus-idp/backstage-scaffolder-backend-module-quay@1.1.1) (2023-10-19) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.0.3...@janus-idp/backstage-scaffolder-backend-module-quay@1.1.0) (2023-08-14) - -### Features - -- **ts:** transpile each plugin separately ([#634](https://github.com/janus-idp/backstage-plugins/issues/634)) ([b94c4dc](https://github.com/janus-idp/backstage-plugins/commit/b94c4dc50ada328e5ce1bed5fb7c76f64607e1ee)) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.0.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.0.2...@janus-idp/backstage-scaffolder-backend-module-quay@1.0.3) (2023-07-25) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.0.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.0.1...@janus-idp/backstage-scaffolder-backend-module-quay@1.0.2) (2023-06-14) - -### Documentation - -- update plugin README formatting ([#396](https://github.com/janus-idp/backstage-plugins/issues/396)) ([9b39056](https://github.com/janus-idp/backstage-plugins/commit/9b39056f6c66e9a6a0a5d0c4059420dff66db263)), closes [#295](https://github.com/janus-idp/backstage-plugins/issues/295) [#369](https://github.com/janus-idp/backstage-plugins/issues/369) [#295](https://github.com/janus-idp/backstage-plugins/issues/295) [#369](https://github.com/janus-idp/backstage-plugins/issues/369) - -## @janus-idp/backstage-scaffolder-backend-module-quay [1.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-quay@1.0.0...@janus-idp/backstage-scaffolder-backend-module-quay@1.0.1) (2023-06-08) - -### Bug Fixes - -- **monorepo:** update test script ([#436](https://github.com/janus-idp/backstage-plugins/issues/436)) ([0f1f3ff](https://github.com/janus-idp/backstage-plugins/commit/0f1f3ff25176225076a112f90412d5dcd6f28a75)) - -### Other changes - -- reorder imports via prettier ([#419](https://github.com/janus-idp/backstage-plugins/issues/419)) ([17f1e6a](https://github.com/janus-idp/backstage-plugins/commit/17f1e6a689bd793a619ec5e42e5cdda0998f78a5)) - -## @janus-idp/backstage-scaffolder-backend-module-quay 1.0.0 (2023-05-31) - -### Features - -- **quay-actions:** create action to create quay repository ([#244](https://github.com/janus-idp/backstage-plugins/issues/244)) ([0fcd8b4](https://github.com/janus-idp/backstage-plugins/commit/0fcd8b4ed1924280048f7ec8c8571e10af711cd9)) diff --git a/plugins/quay-actions/CONTRIBUTING.md b/plugins/quay-actions/CONTRIBUTING.md deleted file mode 100644 index 3b41fe34bf..0000000000 --- a/plugins/quay-actions/CONTRIBUTING.md +++ /dev/null @@ -1,24 +0,0 @@ -# Setting up the development environment for Quay actions - -1. Add the local package dependency to the Backstage instance - - ```shell - yarn workspace backend add file:./plugins/quay-actions - ``` - -2. [Register](./README.md#configuration) the Quay actions in your Backstage project -3. **Optional**: You can use the sample template from this repository and add it as `locations` in your `app-config.yaml` file - - ```yaml - --- - catalog: - locations: - - type: file - target: ../../plugins/quay-actions/examples/templates/01-quay-template.yaml - rules: - - allow: [Template] - ``` - -4. Run `yarn dev` -5. If you don't have a Quay account created yet you can create one for free on the [quay](https://quay.io) website -6. Start using the Quay actions in your templates diff --git a/plugins/quay-actions/README.md b/plugins/quay-actions/README.md index e29083f6c9..584c6e4a01 100644 --- a/plugins/quay-actions/README.md +++ b/plugins/quay-actions/README.md @@ -1,68 +1,3 @@ -# Quay actions for Backstage +# Deprecated -This module provides [Backstage](https://backstage.io/) template [actions](https://backstage.io/docs/features/software-templates/builtin-actions) for [Quay](https://docs.quay.io/). - -The following actions are currently supported in this module: - -- Create a Quay repository - -## Installation - -Run the following command to install the action package in your Backstage project - -```bash -yarn workspace backend add @janus-idp/backstage-scaffolder-backend-module-quay -``` - -### Installing the action on the new backend - -Add the following to your `packages/backend/src/index.ts` file: - -```ts title="packages/backend/src/index.ts" -const backend = createBackend(); - -// Add the following line -backend.add(import('@janus-idp/backstage-scaffolder-backend-module-quay')); - -backend.start(); -``` - -## Configuration - -Add the Quay actions to your templates, see the [example](./examples/templates/01-quay-template.yaml) file in this repository for complete usage examples - -```yaml -action: quay:create-repository -id: create-quay-repo -name: Create quay repo -input: - baseUrl: https://quay.io - token: UW1dLVdCTj8uZWNuIW97K1k0XiBkSmppVU9MYzFT - name: foo - visibility: public - description: This is a foo repository - namespace: bar - repoKind: image -``` - -## Usage - -### Action: quay:create-repository - -#### Input - -| Parameter Name | Type | Required | Description | Example | -| -------------- | :----: | :------: | --------------------------------------------------------------------------------- | ---------------------------------------- | -| name | string | Yes | Quay repository name | foo | -| visibility | string | Yes | Visibility setting for the created repository, either public or private | public | -| description | string | Yes | Description for the created repository | This if foo repository | -| token | string | Yes | Authentication token, see [docs](https://docs.quay.io/api/) | UW1dLVdCTj8uZWNuIW97K1k0XiBkSmppVU9MYzFT | -| baseUrl | string | No | Base url of a quay instance, defaults to | | -| namespace | string | No | Namespace to create repository in, defaults to the namespace the token belongs to | bar | -| repoKind | string | No | Created repository kind, either image or application, if empty defaults to image | image | - -#### Output - -| Name | Type | Description | -| ------------- | :----: | ------------------------------------------ | -| repositoryUrl | string | Quay repository URL created by this action | +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-scaffolder-backend-module-quay` instead. \ No newline at end of file diff --git a/plugins/quay-actions/catalog-info.yaml b/plugins/quay-actions/catalog-info.yaml deleted file mode 100644 index aa8c9b1c12..0000000000 --- a/plugins/quay-actions/catalog-info.yaml +++ /dev/null @@ -1,59 +0,0 @@ -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-quay-actions - title: Quay scaffolder actions - description: Quay actions for Backstage - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/quay-actions - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/quay-actions/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/quay-actions/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/maintainers-plugins - sonarqube.org/project-key: janus-idp_backstage-plugins - tags: - - quay - - scaffolder - - actions - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/quay-actions - title: GitHub Source - icon: source - type: source -spec: - type: backstage-plugin - lifecycle: production - owner: rhdh-team - system: rhdh - subcomponentOf: janus-idp-backstage-plugins ---- -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-quay-actions-module - title: '@janus-idp/backstage-scaffolder-backend-module-quay' - description: Quay actions for Backstage - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/quay-actions - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/quay-actions/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/quay-actions/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/maintainers-plugins - sonarqube.org/project-key: janus-idp_backstage-plugins - tags: - - quay - - scaffolder - - actions - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/quay-actions - title: GitHub Source - icon: source - type: source -spec: - type: backstage-frontend-plugin-module - lifecycle: production - owner: rhdh-team - system: rhdh - subcomponentOf: janus-idp-quay-actions diff --git a/plugins/quay-actions/examples/templates/01-quay-template.yaml b/plugins/quay-actions/examples/templates/01-quay-template.yaml deleted file mode 100644 index 29eaf7c96b..0000000000 --- a/plugins/quay-actions/examples/templates/01-quay-template.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: scaffolder.backstage.io/v1beta3 -kind: Template -metadata: - name: create-quay-repo - title: Create a Quay repository - description: Create a Quay repository - -spec: - type: service - parameters: - - title: Repository information - required: ['name', 'visibility', 'description', 'token'] - properties: - name: - title: Repository name - type: string - description: Name of the repository to be created - token: - title: Token - type: string - description: Bearer token used for authorization - ui:widget: password - visibility: - title: Visiblity - type: string - description: Visibility setting for the created repository, either public or private - ui:widget: select - enum: ['public', 'private'] - repoKind: - title: Repository kind - type: string - description: The created repository kind either image, application or none - ui:widget: select - enum: ['image', 'application'] - description: - title: Description - type: string - description: The repository desription - namespace: - title: Namespace - type: string - description: The users namespace is used by default - baseUrl: - title: Base URL - type: string - description: URL of your quay instance, set to "https://quay.io" by default - - steps: - - id: create-quay-repo - name: Create quay repo - action: quay:create-repository - input: - baseUrl: ${{ parameters.baseUrl }} - token: ${{ parameters.token }} - name: ${{ parameters.name }} - visibility: ${{ parameters.visibility }} - description: ${{ parameters.description }} - namespace: ${{ parameters.namespace }} - repoKind: ${{ parameters.repoKind }} - - output: - links: - - title: Quay repository link - url: ${{ steps['create-quay-repo'].output.repositoryUrl }} diff --git a/plugins/quay-actions/package.json b/plugins/quay-actions/package.json deleted file mode 100644 index 8da20d6b41..0000000000 --- a/plugins/quay-actions/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@janus-idp/backstage-scaffolder-backend-module-quay", - "description": "The quay-actions module for @backstage/plugin-scaffolder-backend", - "version": "2.2.1", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public" - }, - "backstage": { - "role": "backend-plugin-module", - "supported-versions": "1.32.5", - "pluginId": "scaffolder", - "pluginPackage": "@backstage/plugin-scaffolder-backend" - }, - "exports": { - ".": "./src/index.ts", - "./package.json": "./package.json" - }, - "typesVersions": { - "*": { - "package.json": [ - "package.json" - ] - } - }, - "scripts": { - "build": "backstage-cli package build", - "clean": "backstage-cli package clean", - "lint:check": "backstage-cli package lint", - "lint:fix": "backstage-cli package lint --fix", - "postpack": "backstage-cli package postpack", - "prepack": "backstage-cli package prepack", - "start": "backstage-cli package start", - "test": "backstage-cli package test --passWithNoTests --coverage", - "tsc": "tsc", - "prettier:check": "prettier --ignore-unknown --check .", - "prettier:fix": "prettier --ignore-unknown --write ." - }, - "dependencies": { - "@backstage/backend-plugin-api": "^1.0.1", - "@backstage/plugin-scaffolder-node": "^0.5.0" - }, - "devDependencies": { - "@backstage/cli": "0.28.2", - "@backstage/plugin-scaffolder-node-test-utils": "0.1.14", - "prettier": "3.3.3" - }, - "files": [ - "dist", - "dist-dynamic/*.*", - "dist-dynamic/dist/**" - ], - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/quay-actions" - }, - "maintainers": [ - "@janus-idp/maintainers-plugins" - ], - "author": "Red Hat", - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "keywords": [ - "support:production", - "lifecycle:active" - ] -} diff --git a/plugins/quay-actions/src/actions/createQuayRepository.test.ts b/plugins/quay-actions/src/actions/createQuayRepository.test.ts deleted file mode 100644 index af3406882e..0000000000 --- a/plugins/quay-actions/src/actions/createQuayRepository.test.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils'; - -import { - createQuayRepositoryAction, - ResponseBody, - ResponseErrorBody, -} from './createQuayRepository'; - -describe('quay:create-repository', () => { - const action = createQuayRepositoryAction(); - - beforeEach(() => { - jest.resetAllMocks(); - }); - - const mockContext = createMockActionContext(); - - it('should create a quay repository', async () => { - const body: ResponseBody = { - name: 'foo', - kind: 'image', - namespace: 'bar', - }; - const fetchMock = jest.spyOn(global, 'fetch').mockImplementationOnce(() => - Promise.resolve( - new Response(new Blob([JSON.stringify(body)]), { - status: 200, - }), - ), - ); - - await action.handler({ - ...mockContext, - input: { - baseUrl: 'http://localhost:9090', - token: 'TOKEN', - name: 'foo', - visibility: 'public', - description: 'bar', - }, - }); - - expect(fetchMock).toHaveBeenCalledTimes(1); - expect(mockContext.output).toHaveBeenCalledWith( - 'repositoryUrl', - 'http://localhost:9090/repository/bar/foo', - ); - }); - - it("should use the default url if it isn't provider", async () => { - const fetchMock = jest.spyOn(global, 'fetch').mockImplementationOnce(() => - Promise.resolve( - new Response(new Blob(['{}']), { - status: 200, - }), - ), - ); - - await action.handler({ - ...mockContext, - input: { - token: 'TOKEN', - name: 'foo', - visibility: 'public', - description: 'bar', - }, - }); - - expect(fetchMock).toHaveBeenCalledWith( - 'https://quay.io/api/v1/repository', - { - body: '{"description":"bar","repository":"foo","visibility":"public"}', - headers: { - Accept: 'application/json', - Authorization: 'Bearer TOKEN', - 'Content-Type': 'application/json', - }, - method: 'POST', - }, - ); - }); - - it('should handle and format errors correctly', async () => { - const body: ResponseErrorBody = { - detail: 'Repository already exists', - error_message: 'Repository already exists', - error_type: 'invalid_request', - status: 400, - title: 'invalid_request', - type: 'https://quay.io/api/v1/error/invalid_request', - }; - - const fetchMock = jest.spyOn(global, 'fetch').mockImplementationOnce(() => - Promise.resolve( - new Response(new Blob([JSON.stringify(body)]), { - status: 400, - }), - ), - ); - - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - baseUrl: 'http://localhost:9090', - token: 'TOKEN', - name: 'foo', - visibility: 'public', - description: 'bar', - }, - }); - }).rejects.toThrow( - 'Failed to create Quay repository, 400 -- Repository already exists', - ); - expect(fetchMock).toHaveBeenCalledTimes(1); - }); - - it.each([ - { - input: { - baseUrl: 'baz', - token: 'TOKEN', - name: 'foo', - visibility: 'public', - description: 'bar', - }, - error: '"baseUrl" is invalid', - name: 'url', - }, - { - input: { - baseUrl: 'http://example.com', - token: 'TOKEN', - name: 'foo', - visibility: 'baz', - description: 'bar', - }, - error: - 'For the "visibility" parameter "baz" is not a valid option, available options are: public, private', - name: 'visibility', - }, - { - input: { - baseUrl: 'http://example.com', - token: 'TOKEN', - name: 'foo', - visibility: 'public', - description: 'bar', - repoKind: 'baz', - }, - error: - 'For the "repository kind" parameter "baz" is not a valid option, available options are: application, image, none', - name: 'repoKind', - }, - ])( - 'should throw an error on invalid $name input', - async ({ input, error }) => { - await expect(async () => { - await action.handler({ - ...mockContext, - input, - }); - }).rejects.toThrow(error); - }, - ); -}); diff --git a/plugins/quay-actions/src/actions/createQuayRepository.ts b/plugins/quay-actions/src/actions/createQuayRepository.ts deleted file mode 100644 index 1fd19c0942..0000000000 --- a/plugins/quay-actions/src/actions/createQuayRepository.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { createTemplateAction } from '@backstage/plugin-scaffolder-node'; - -export interface ResponseBody { - namespace: string; - name: string; - kind: string; -} -export interface ResponseErrorBody { - detail: string; - error_message: string; - error_type: string; - title: string; - type: string; - status: number; -} -interface RequestBody { - repository: string; - visibility: string; - namespace?: string; - description: string; - repo_kind?: string; -} - -type TemplateActionParameters = { - name: string; - visibility: string; - description: string; - token: string; - baseUrl?: string; - namespace?: string; - repoKind?: string; -}; - -const getUrl = (url: string | undefined): string => { - if (!url) { - return 'https://quay.io'; - } - try { - // eslint-disable-next-line no-new - new URL(url); - } catch (error) { - throw new Error('"baseUrl" is invalid'); - } - return url; -}; - -const isValueValid = ( - value: string | undefined, - valueName: string, - valueOpts: Array, -) => { - if (valueOpts.includes(value)) { - return; - } - throw new Error( - `For the "${valueName}" parameter "${value}" is not a valid option,` + - ` available options are: ${valueOpts.map(v => v || 'none').join(', ')}`, - ); -}; - -export function createQuayRepositoryAction() { - return createTemplateAction({ - id: 'quay:create-repository', - description: 'Create an quay image repository', - schema: { - input: { - type: 'object', - required: ['name', 'visibility', 'description', 'token'], - properties: { - name: { - title: 'Repository name', - description: 'Name of the repository to be created', - type: 'string', - }, - visibility: { - title: 'Visibility setting', - description: - 'Visibility setting for the created repository, either public or private', - type: 'string', - }, - description: { - title: 'Repository description', - description: 'The repository desription', - type: 'string', - }, - token: { - title: 'Token', - description: 'Bearer token used for authorization', - type: 'string', - }, - baseUrl: { - title: 'Base URL', - description: - 'URL of your quay instance, set to "https://quay.io" by default', - type: 'string', - }, - namespace: { - title: 'Namespace', - description: - 'Namespace in which to create the repository, by default the users namespace', - type: 'string', - }, - repoKind: { - title: 'Repository kind', - description: - 'The crated repository type either image or an application, if empty image will be used', - type: 'string', - }, - }, - }, - output: { - type: 'object', - properties: { - repositoryUrl: { - title: 'Quay image repository URL', - type: 'string', - description: 'Created repository URL link', - }, - }, - }, - }, - async handler(ctx) { - const { token, name, visibility, namespace, description, repoKind } = - ctx.input; - const baseUrl = getUrl(ctx.input.baseUrl); - isValueValid(visibility, 'visibility', ['public', 'private']); - isValueValid(repoKind, 'repository kind', [ - 'application', - 'image', - undefined, - ]); - - const params: RequestBody = { - description, - repository: name, - visibility, - namespace, - repo_kind: repoKind, - }; - - const uri = encodeURI(`${baseUrl}/api/v1/repository`); - const response = await fetch(uri, { - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - Authorization: `Bearer ${token}`, - }, - body: JSON.stringify(params), - method: 'POST', - }); - - if (!response.ok) { - const errorBody = (await response.json()) as ResponseErrorBody; - const errorStatus = errorBody.status || response.status; - // Some error responses don't have the structure defined in ResponseErrorBody - const errorMsg = errorBody.detail || (errorBody as any).error; - throw new Error( - `Failed to create Quay repository, ${errorStatus} -- ${errorMsg}`, - ); - } - - const body = (await response.json()) as ResponseBody; - ctx.output( - 'repositoryUrl', - `${baseUrl}/repository/${body.namespace}/${body.name}`, - ); - }, - }); -} diff --git a/plugins/quay-actions/src/actions/index.ts b/plugins/quay-actions/src/actions/index.ts deleted file mode 100644 index c94d9084f4..0000000000 --- a/plugins/quay-actions/src/actions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { createQuayRepositoryAction } from './createQuayRepository'; diff --git a/plugins/quay-actions/src/index.ts b/plugins/quay-actions/src/index.ts deleted file mode 100644 index c0d0c5161a..0000000000 --- a/plugins/quay-actions/src/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/***/ -/** - * The quay-actions module for @backstage/plugin-scaffolder-backend. - * - * @packageDocumentation - */ - -export * from './actions'; -export { scaffolderModuleQuayAction as default } from './module'; diff --git a/plugins/quay-actions/src/module.ts b/plugins/quay-actions/src/module.ts deleted file mode 100644 index b857a829fc..0000000000 --- a/plugins/quay-actions/src/module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { createBackendModule } from '@backstage/backend-plugin-api'; -import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha'; - -import { createQuayRepositoryAction } from './actions'; - -export const scaffolderModuleQuayAction = createBackendModule({ - moduleId: 'scaffolder-backend-quay', - pluginId: 'scaffolder', - register(env) { - env.registerInit({ - deps: { - scaffolder: scaffolderActionsExtensionPoint, - }, - async init({ scaffolder }) { - scaffolder.addActions(createQuayRepositoryAction()); - }, - }); - }, -}); diff --git a/plugins/quay-actions/tsconfig.json b/plugins/quay-actions/tsconfig.json deleted file mode 100644 index d6ae37b25e..0000000000 --- a/plugins/quay-actions/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@backstage/cli/config/tsconfig.json", - "include": ["src", "dev", "migrations"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "../../dist-types/plugins/quay-actions", - "rootDir": "." - } -} diff --git a/plugins/quay-actions/turbo.json b/plugins/quay-actions/turbo.json deleted file mode 100644 index 64f535df58..0000000000 --- a/plugins/quay-actions/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/quay-actions/**"] - } - } -} diff --git a/plugins/tekton-common/.eslintignore b/plugins/tekton-common/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/tekton-common/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/tekton-common/.eslintrc.js b/plugins/tekton-common/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/tekton-common/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/tekton-common/.lintstagedrc.json b/plugins/tekton-common/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/tekton-common/.lintstagedrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "*": "prettier --ignore-unknown --write", - "*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix" -} diff --git a/plugins/tekton-common/.prettierignore b/plugins/tekton-common/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/tekton-common/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -dist -dist-types -coverage -.vscode -CHANGELOG.md -generated -templates -*.hbs -renovate.json -dist-dynamic -dist-scalprum -playwright-report diff --git a/plugins/tekton-common/.prettierrc.js b/plugins/tekton-common/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/tekton-common/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-check - -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -module.exports = { - ...require('@spotify/prettier-config'), - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '^react(.*)$', - '', - '^@backstage/(.*)$', - '', - '', - '', - '^@janus-idp/(.*)$', - '', - '', - '', - '^[.]', - ], -}; diff --git a/plugins/tekton-common/.versionhistory.md b/plugins/tekton-common/.versionhistory.md deleted file mode 100644 index b17e69831a..0000000000 --- a/plugins/tekton-common/.versionhistory.md +++ /dev/null @@ -1 +0,0 @@ -- Bumped to 1.1.0 in main branch for next release 1.3.0 diff --git a/plugins/tekton-common/CHANGELOG.md b/plugins/tekton-common/CHANGELOG.md deleted file mode 100644 index 63ee379ddc..0000000000 --- a/plugins/tekton-common/CHANGELOG.md +++ /dev/null @@ -1,26 +0,0 @@ -# @janus-idp/backstage-plugin-tekton-common - -## 1.3.1 - -### Patch Changes - -- 0e6bfd3: feat: update Backstage to the latest version - - Update to Backstage 1.32.5 - -## 1.3.0 - -### Minor Changes - -- 8244f28: chore(deps): update to backstage 1.32 - -## 1.2.0 - -### Minor Changes - -- d9551ae: feat(deps): update to backstage 1.31 - -### Patch Changes - -- d9551ae: change deps to peer deps in common packages -- d9551ae: upgrade to yarn v3 diff --git a/plugins/tekton-common/README.md b/plugins/tekton-common/README.md index 91d9152729..53e0db6dce 100644 --- a/plugins/tekton-common/README.md +++ b/plugins/tekton-common/README.md @@ -1,11 +1,3 @@ -# Tekton Common plugin +# Deprecated -Welcome to the tekton-common plugin! - -This plugin contains common utilities for the tekton plugin. - -# Tekton plugin for Backstage - -The Tekton plugin enables you to visualize the `PipelineRun` resources available on the Kubernetes cluster. - -For more information about Tekton plugin, see the [Tekton plugin documentation](https://github.com/janus-idp/backstage-plugins/tree/main/plugins/tekton) on GitHub. +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-tekton-common` instead. diff --git a/plugins/tekton-common/catalog-info.yaml b/plugins/tekton-common/catalog-info.yaml deleted file mode 100644 index 9a5a6d5c99..0000000000 --- a/plugins/tekton-common/catalog-info.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-tekton-common - title: '@janus-idp/backstage-plugin-tekton-common' - description: Tekton Common plugin - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/tekton-common - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/tekton-common/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/tekton-common/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/rhtap - sonarqube.org/project-key: janus-idp_backstage-plugins - tags: - - kubernetes - - openshift - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/tekton-common - title: GitHub Source - icon: source - type: source -spec: - type: backstage-common-library - lifecycle: production - owner: rhtap-team - system: rhdh - subcomponentOf: janus-idp-tekton diff --git a/plugins/tekton-common/package.json b/plugins/tekton-common/package.json deleted file mode 100644 index 23099c61ef..0000000000 --- a/plugins/tekton-common/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@janus-idp/backstage-plugin-tekton-common", - "version": "1.3.1", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts" - }, - "backstage": { - "role": "common-library", - "supported-versions": "1.32.5", - "pluginId": "tekton", - "pluginPackage": "@janus-idp/backstage-plugin-tekton-common", - "pluginPackages": [ - "@janus-idp/backstage-plugin-tekton", - "@janus-idp/backstage-plugin-tekton-common" - ] - }, - "sideEffects": false, - "scripts": { - "build": "backstage-cli package build", - "clean": "backstage-cli package clean", - "lint:check": "backstage-cli package lint", - "lint:fix": "backstage-cli package lint --fix", - "postpack": "backstage-cli package postpack", - "prepack": "backstage-cli package prepack", - "test": "backstage-cli package test --passWithNoTests --coverage", - "tsc": "tsc", - "prettier:check": "prettier --ignore-unknown --check .", - "prettier:fix": "prettier --ignore-unknown --write ." - }, - "peerDependencies": { - "@backstage/plugin-permission-common": "^0.8.1" - }, - "devDependencies": { - "@backstage/cli": "0.28.2", - "prettier": "3.3.3" - }, - "files": [ - "dist" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/janus-idp/backstage-plugins.git", - "directory": "plugins/tekton-common" - }, - "keywords": [ - "support:production", - "lifecycle:active", - "backstage", - "plugin" - ], - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "maintainers": [ - "@janus-idp/rhtap" - ], - "author": "Red Hat" -} diff --git a/plugins/tekton-common/src/index.ts b/plugins/tekton-common/src/index.ts deleted file mode 100644 index b8170324a8..0000000000 --- a/plugins/tekton-common/src/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Common functionalities for the tekton plugin. - * - * @packageDocumentation - */ - -export * from './permissions'; diff --git a/plugins/tekton-common/src/permissions.ts b/plugins/tekton-common/src/permissions.ts deleted file mode 100644 index caece05842..0000000000 --- a/plugins/tekton-common/src/permissions.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { createPermission } from '@backstage/plugin-permission-common'; - -export const tektonViewPermission = createPermission({ - name: 'tekton.view.read', - attributes: { - action: 'read', - }, -}); - -/** - * List of all permissions on permission polices. - */ -export const tektonPermissions = [tektonViewPermission]; diff --git a/plugins/tekton-common/tsconfig.json b/plugins/tekton-common/tsconfig.json deleted file mode 100644 index eb4f3f81ea..0000000000 --- a/plugins/tekton-common/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@backstage/cli/config/tsconfig.json", - "include": ["src", "dev"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "../../dist-types/plugins/tekton-common", - "rootDir": "." - } -} diff --git a/plugins/tekton-common/turbo.json b/plugins/tekton-common/turbo.json deleted file mode 100644 index e051f8d934..0000000000 --- a/plugins/tekton-common/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/tekton-common/**"] - } - } -} diff --git a/plugins/tekton/.eslintignore b/plugins/tekton/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/tekton/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/tekton/.eslintrc.js b/plugins/tekton/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/tekton/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/tekton/.lintstagedrc.json b/plugins/tekton/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/tekton/.lintstagedrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "*": "prettier --ignore-unknown --write", - "*.{js,jsx,ts,tsx,mjs,cjs}": "backstage-cli package lint --fix" -} diff --git a/plugins/tekton/.prettierignore b/plugins/tekton/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/tekton/.prettierignore +++ /dev/null @@ -1,12 +0,0 @@ -dist -dist-types -coverage -.vscode -CHANGELOG.md -generated -templates -*.hbs -renovate.json -dist-dynamic -dist-scalprum -playwright-report diff --git a/plugins/tekton/.prettierrc.js b/plugins/tekton/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/tekton/.prettierrc.js +++ /dev/null @@ -1,20 +0,0 @@ -// @ts-check - -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -module.exports = { - ...require('@spotify/prettier-config'), - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '^react(.*)$', - '', - '^@backstage/(.*)$', - '', - '', - '', - '^@janus-idp/(.*)$', - '', - '', - '', - '^[.]', - ], -}; diff --git a/plugins/tekton/.versionhistory.md b/plugins/tekton/.versionhistory.md deleted file mode 100644 index 4966372c52..0000000000 --- a/plugins/tekton/.versionhistory.md +++ /dev/null @@ -1,2 +0,0 @@ -- Bumped to 3.6.0 in main branch for next release 1.2.0 -- Bumped to 3.13.0 in main branch for next release 1.3.0 diff --git a/plugins/tekton/CHANGELOG.md b/plugins/tekton/CHANGELOG.md deleted file mode 100644 index d52be1ecd9..0000000000 --- a/plugins/tekton/CHANGELOG.md +++ /dev/null @@ -1,786 +0,0 @@ -### Dependencies - -## 3.15.1 - -### Patch Changes - -- 0e6bfd3: feat: update Backstage to the latest version - - Update to Backstage 1.32.5 - -- Updated dependencies [0e6bfd3] - - @janus-idp/backstage-plugin-tekton-common@1.3.1 - - @janus-idp/shared-react@2.13.1 - -## 3.15.0 - -### Minor Changes - -- 8244f28: chore(deps): update to backstage 1.32 - -### Patch Changes - -- Updated dependencies [8244f28] - - @janus-idp/backstage-plugin-tekton-common@1.3.0 - - @janus-idp/shared-react@2.13.0 - -## 3.14.2 - -### Patch Changes - -- 7342e9b: chore: remove @janus-idp/cli dep and relink local packages - - This update removes `@janus-idp/cli` from all plugins, as it’s no longer necessary. Additionally, packages are now correctly linked with a specified version. - -## 3.14.1 - -### Patch Changes - -- ffe2546: Fix CVE-2024-21534 by upgrading @kubernetes/client-node package to 0.22.1 -- Updated dependencies [ffe2546] - - @janus-idp/shared-react@2.12.1 - -## 3.14.0 - -### Minor Changes - -- d9551ae: feat(deps): update to backstage 1.31 - -### Patch Changes - -- d9551ae: Change local package references to a `*` -- d9551ae: pin the @janus-idp/cli package -- d9551ae: upgrade to yarn v3 -- Updated dependencies [d9551ae] -- Updated dependencies [d9551ae] -- Updated dependencies [d9551ae] -- Updated dependencies [d9551ae] - - @janus-idp/shared-react@2.12.0 - - @janus-idp/backstage-plugin-tekton-common@1.2.0 - -* **@janus-idp/cli:** upgraded to 1.15.2 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.15.1 - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.11.1 -- **@janus-idp/cli:** upgraded to 1.15.0 - -### Dependencies - -- **@janus-idp/backstage-plugin-tekton-common:** upgraded to 1.1.0 -- **@janus-idp/shared-react:** upgraded to 2.11.0 -- **@janus-idp/cli:** upgraded to 1.14.0 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.2 - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.10.3 - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.10.2 - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.10.1 - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.13.1 - -## @janus-idp/backstage-plugin-tekton [3.12.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.11.0...@janus-idp/backstage-plugin-tekton@3.12.0) (2024-08-02) - -### Features - -- **topology:** remove usage of k8s plugin from topology & tekton plugins ([#1869](https://github.com/janus-idp/backstage-plugins/issues/1869)) ([ae7d8ee](https://github.com/janus-idp/backstage-plugins/commit/ae7d8ee7014c109a5f5265967590559fc778eec7)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.10.0 -- **@janus-idp/backstage-plugin-tekton-common:** upgraded to 1.0.0 - -## @janus-idp/backstage-plugin-tekton [3.11.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.10.0...@janus-idp/backstage-plugin-tekton@3.11.0) (2024-07-26) - -### Features - -- **tekton:** add permissions support for tekton plugin ([#1854](https://github.com/janus-idp/backstage-plugins/issues/1854)) ([f744896](https://github.com/janus-idp/backstage-plugins/commit/f7448963c252574e0309a091563c19e1ed9a58fd)) - -## @janus-idp/backstage-plugin-tekton [3.10.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.9.0...@janus-idp/backstage-plugin-tekton@3.10.0) (2024-07-26) - -### Features - -- **deps:** update to backstage 1.29 ([#1900](https://github.com/janus-idp/backstage-plugins/issues/1900)) ([f53677f](https://github.com/janus-idp/backstage-plugins/commit/f53677fb02d6df43a9de98c43a9f101a6db76802)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.9.0 - -## @janus-idp/backstage-plugin-tekton [3.9.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.8.1...@janus-idp/backstage-plugin-tekton@3.9.0) (2024-07-24) - -### Features - -- **deps:** update to backstage 1.28 ([#1891](https://github.com/janus-idp/backstage-plugins/issues/1891)) ([1ba1108](https://github.com/janus-idp/backstage-plugins/commit/1ba11088e0de60e90d138944267b83600dc446e5)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.8.0 - -## @janus-idp/backstage-plugin-tekton [3.8.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.8.0...@janus-idp/backstage-plugin-tekton@3.8.1) (2024-06-19) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.7.1 -- **@janus-idp/cli:** upgraded to 1.11.1 - -## @janus-idp/backstage-plugin-tekton [3.8.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.9...@janus-idp/backstage-plugin-tekton@3.8.0) (2024-06-13) - -### Features - -- **deps:** update to backstage 1.27 ([#1683](https://github.com/janus-idp/backstage-plugins/issues/1683)) ([a14869c](https://github.com/janus-idp/backstage-plugins/commit/a14869c3f4177049cb8d6552b36c3ffd17e7997d)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.7.0 -- **@janus-idp/cli:** upgraded to 1.11.0 - -## @janus-idp/backstage-plugin-tekton [3.7.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.8...@janus-idp/backstage-plugin-tekton@3.7.9) (2024-06-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.1 - -## @janus-idp/backstage-plugin-tekton [3.7.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.7...@janus-idp/backstage-plugin-tekton@3.7.8) (2024-06-10) - -## @janus-idp/backstage-plugin-tekton [3.7.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.6...@janus-idp/backstage-plugin-tekton@3.7.7) (2024-06-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.0 - -## @janus-idp/backstage-plugin-tekton [3.7.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.5...@janus-idp/backstage-plugin-tekton@3.7.6) (2024-06-04) - -## @janus-idp/backstage-plugin-tekton [3.7.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.4...@janus-idp/backstage-plugin-tekton@3.7.5) (2024-06-03) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.9.0 - -## @janus-idp/backstage-plugin-tekton [3.7.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.3...@janus-idp/backstage-plugin-tekton@3.7.4) (2024-05-31) - -## @janus-idp/backstage-plugin-tekton [3.7.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.2...@janus-idp/backstage-plugin-tekton@3.7.3) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.10 - -## @janus-idp/backstage-plugin-tekton [3.7.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.1...@janus-idp/backstage-plugin-tekton@3.7.2) (2024-05-29) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.6.3 -- **@janus-idp/cli:** upgraded to 1.8.9 - -## @janus-idp/backstage-plugin-tekton [3.7.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.7.0...@janus-idp/backstage-plugin-tekton@3.7.1) (2024-05-16) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.6.2 -- **@janus-idp/cli:** upgraded to 1.8.7 - -## @janus-idp/backstage-plugin-tekton [3.7.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.6.5...@janus-idp/backstage-plugin-tekton@3.7.0) (2024-05-14) - -### Features - -- **deps:** use RHDH themes in the backstage app and dev pages ([#1480](https://github.com/janus-idp/backstage-plugins/issues/1480)) ([8263bf0](https://github.com/janus-idp/backstage-plugins/commit/8263bf099736cbb0d0f2316082d338ba81fa6927)) - -## @janus-idp/backstage-plugin-tekton [3.6.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.6.4...@janus-idp/backstage-plugin-tekton@3.6.5) (2024-05-09) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.6.1 -- **@janus-idp/cli:** upgraded to 1.8.6 - -## @janus-idp/backstage-plugin-tekton [3.6.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.6.3...@janus-idp/backstage-plugin-tekton@3.6.4) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.5 - -## @janus-idp/backstage-plugin-tekton [3.6.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.6.2...@janus-idp/backstage-plugin-tekton@3.6.3) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.4 - -## @janus-idp/backstage-plugin-tekton [3.6.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.6.1...@janus-idp/backstage-plugin-tekton@3.6.2) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.3 - -## @janus-idp/backstage-plugin-tekton [3.6.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.6.0...@janus-idp/backstage-plugin-tekton@3.6.1) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.2 - -## @janus-idp/backstage-plugin-tekton [3.6.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.18...@janus-idp/backstage-plugin-tekton@3.6.0) (2024-04-15) - -### Features - -- checkPluginVersion.sh bump plugins for 1.2.0 release ([#1511](https://github.com/janus-idp/backstage-plugins/issues/1511)) ([73c6588](https://github.com/janus-idp/backstage-plugins/commit/73c6588adb7e8c20907b06f2a8ef248cfd4332e4)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.6.0 -- **@janus-idp/cli:** upgraded to 1.8.0 - -## @janus-idp/backstage-plugin-tekton [3.5.18](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.17...@janus-idp/backstage-plugin-tekton@3.5.18) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.10 - -## @janus-idp/backstage-plugin-tekton [3.5.17](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.16...@janus-idp/backstage-plugin-tekton@3.5.17) (2024-04-09) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.5.5 - -## @janus-idp/backstage-plugin-tekton [3.5.16](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.15...@janus-idp/backstage-plugin-tekton@3.5.16) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.9 - -## @janus-idp/backstage-plugin-tekton [3.5.15](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.14...@janus-idp/backstage-plugin-tekton@3.5.15) (2024-04-08) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.5.4 - -## @janus-idp/backstage-plugin-tekton [3.5.14](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.13...@janus-idp/backstage-plugin-tekton@3.5.14) (2024-04-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.7 - -## @janus-idp/backstage-plugin-tekton [3.5.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.12...@janus-idp/backstage-plugin-tekton@3.5.13) (2024-03-29) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.5.3 -- **@janus-idp/cli:** upgraded to 1.7.6 - -## @janus-idp/backstage-plugin-tekton [3.5.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.11...@janus-idp/backstage-plugin-tekton@3.5.12) (2024-03-25) - -### Bug Fixes - -- **tekton:** bump aonic-ui/pipelines package to fix acs table crashing issue ([#1382](https://github.com/janus-idp/backstage-plugins/issues/1382)) ([b37cc94](https://github.com/janus-idp/backstage-plugins/commit/b37cc94ad140be43896bbd3bc48dd7af582eb7ff)) - -## @janus-idp/backstage-plugin-tekton [3.5.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.10...@janus-idp/backstage-plugin-tekton@3.5.11) (2024-03-19) - -### Bug Fixes - -- **tekton:** fix low vulnerability tooltip text ([#1347](https://github.com/janus-idp/backstage-plugins/issues/1347)) ([47640a5](https://github.com/janus-idp/backstage-plugins/commit/47640a5c3a7ad33ad6ae6b190f2ca3d861970d94)) - -## @janus-idp/backstage-plugin-tekton [3.5.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.9...@janus-idp/backstage-plugin-tekton@3.5.10) (2024-03-04) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.5 - -## @janus-idp/backstage-plugin-tekton [3.5.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.8...@janus-idp/backstage-plugin-tekton@3.5.9) (2024-02-27) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.4 - -## @janus-idp/backstage-plugin-tekton [3.5.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.7...@janus-idp/backstage-plugin-tekton@3.5.8) (2024-02-26) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.3 - -## @janus-idp/backstage-plugin-tekton [3.5.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.6...@janus-idp/backstage-plugin-tekton@3.5.7) (2024-02-21) - -### Other changes - -- **tekton:** add playwright tests for the plugin ([#1228](https://github.com/janus-idp/backstage-plugins/issues/1228)) ([705afc2](https://github.com/janus-idp/backstage-plugins/commit/705afc2892839f39a8cbad39f51c959aa3ac4c8a)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.5.2 -- **@janus-idp/cli:** upgraded to 1.7.2 - -## @janus-idp/backstage-plugin-tekton [3.5.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.5...@janus-idp/backstage-plugin-tekton@3.5.6) (2024-02-16) - -### Bug Fixes - -- **tekton:** upgrade to use latest @aonic-ui/pipelines package ([#1212](https://github.com/janus-idp/backstage-plugins/issues/1212)) ([0ae37f7](https://github.com/janus-idp/backstage-plugins/commit/0ae37f7a6c56df374e0e4e326397617ccd46aca8)) - -## @janus-idp/backstage-plugin-tekton [3.5.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.4...@janus-idp/backstage-plugin-tekton@3.5.5) (2024-02-07) - -### Bug Fixes - -- **topology/tekton:** stop polling after log streaming completes ([#1122](https://github.com/janus-idp/backstage-plugins/issues/1122)) ([191bac2](https://github.com/janus-idp/backstage-plugins/commit/191bac2d21259b4fdc42193c6cf436987968eb88)) - -## @janus-idp/backstage-plugin-tekton [3.5.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.3...@janus-idp/backstage-plugin-tekton@3.5.4) (2024-02-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.1 - -## @janus-idp/backstage-plugin-tekton [3.5.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.2...@janus-idp/backstage-plugin-tekton@3.5.3) (2024-02-02) - -### Bug Fixes - -- **tekton:** external sbom view action should not open logs modal ([#1152](https://github.com/janus-idp/backstage-plugins/issues/1152)) ([714ac5d](https://github.com/janus-idp/backstage-plugins/commit/714ac5d10a5b878232dc1468ebfa03a7a52aa656)) -- **tekton:** fix [#947](https://github.com/janus-idp/backstage-plugins/issues/947): Reset pagination when changing any filter ([#1140](https://github.com/janus-idp/backstage-plugins/issues/1140)) ([5a1a2f4](https://github.com/janus-idp/backstage-plugins/commit/5a1a2f442e2c5957bd725e57066448e5b67d8807)) - -### Documentation - -- **tekton:** add tekton plugin documentation to enable UI elements ([#1148](https://github.com/janus-idp/backstage-plugins/issues/1148)) ([91742e8](https://github.com/janus-idp/backstage-plugins/commit/91742e8c524a8b4f87fe9a6cb0d1f5006661b4d2)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.5.1 - -## @janus-idp/backstage-plugin-tekton [3.5.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.1...@janus-idp/backstage-plugin-tekton@3.5.2) (2024-01-31) - -### Bug Fixes - -- **tekton:** fix [#922](https://github.com/janus-idp/backstage-plugins/issues/922) and [#962](https://github.com/janus-idp/backstage-plugins/issues/962) by using full width for pipeline visualization ([#1145](https://github.com/janus-idp/backstage-plugins/issues/1145)) ([1ea9f01](https://github.com/janus-idp/backstage-plugins/commit/1ea9f01c3487035f8495bb98fce30c6c34396510)) - -## @janus-idp/backstage-plugin-tekton [3.5.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.5.0...@janus-idp/backstage-plugin-tekton@3.5.1) (2024-01-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.0 - -## @janus-idp/backstage-plugin-tekton [3.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.4.2...@janus-idp/backstage-plugin-tekton@3.5.0) (2024-01-30) - -### Features - -- **tekton:** add view output action in pipelinerun list view ([#1128](https://github.com/janus-idp/backstage-plugins/issues/1128)) ([ad50c44](https://github.com/janus-idp/backstage-plugins/commit/ad50c44233332b0f1325cef5a41d82ba79c538fb)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.5.0 - -## @janus-idp/backstage-plugin-tekton [3.4.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.4.1...@janus-idp/backstage-plugin-tekton@3.4.2) (2024-01-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.6.0 - -## @janus-idp/backstage-plugin-tekton [3.4.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.4.0...@janus-idp/backstage-plugin-tekton@3.4.1) (2024-01-17) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.4.0 - -## @janus-idp/backstage-plugin-tekton [3.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.3.0...@janus-idp/backstage-plugin-tekton@3.4.0) (2023-12-22) - -### Features - -- **tekton:** add CVE summary and signed badge ([#1028](https://github.com/janus-idp/backstage-plugins/issues/1028)) ([effdef0](https://github.com/janus-idp/backstage-plugins/commit/effdef085deaeea78a819d1bde960f83820ec705)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.3.0 - -## @janus-idp/backstage-plugin-tekton [3.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.2.0...@janus-idp/backstage-plugin-tekton@3.3.0) (2023-12-20) - -### Features - -- **tekton:** add view logs and view sbom actions in the pipelineRun list ([#1003](https://github.com/janus-idp/backstage-plugins/issues/1003)) ([c7eff5f](https://github.com/janus-idp/backstage-plugins/commit/c7eff5f33daef8eaba58df7e987b44f09c7a8ff9)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.2.0 - -## @janus-idp/backstage-plugin-tekton [3.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.14...@janus-idp/backstage-plugin-tekton@3.2.0) (2023-12-14) - -### Features - -- **tekton:** add support for downloading task and pipelinerun logs ([#1014](https://github.com/janus-idp/backstage-plugins/issues/1014)) ([f588292](https://github.com/janus-idp/backstage-plugins/commit/f5882921756a7aa6d5a74d8fdb6bfc52a7c0c209)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.1.0 - -## @janus-idp/backstage-plugin-tekton [3.1.14](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.13...@janus-idp/backstage-plugin-tekton@3.1.14) (2023-12-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.7 - -## @janus-idp/backstage-plugin-tekton [3.1.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.12...@janus-idp/backstage-plugin-tekton@3.1.13) (2023-12-07) - -### Bug Fixes - -- **tekton:** fix expand collapse with sorting of PLR list table ([#980](https://github.com/janus-idp/backstage-plugins/issues/980)) ([d5fc710](https://github.com/janus-idp/backstage-plugins/commit/d5fc710c09e272583e27dbf5beaa3694d18100fe)) - -## @janus-idp/backstage-plugin-tekton [3.1.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.11...@janus-idp/backstage-plugin-tekton@3.1.12) (2023-11-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.6 - -## @janus-idp/backstage-plugin-tekton [3.1.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.10...@janus-idp/backstage-plugin-tekton@3.1.11) (2023-11-23) - -### Bug Fixes - -- add config partials for dynamic frontend plugins ([#965](https://github.com/janus-idp/backstage-plugins/issues/965)) ([b01e55e](https://github.com/janus-idp/backstage-plugins/commit/b01e55e877278afc5de8d28a4c687a6989566bdc)) - -## @janus-idp/backstage-plugin-tekton [3.1.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.9...@janus-idp/backstage-plugin-tekton@3.1.10) (2023-11-23) - -### Bug Fixes - -- **tekton:** update tekton version in the documentation ([#958](https://github.com/janus-idp/backstage-plugins/issues/958)) ([51cc924](https://github.com/janus-idp/backstage-plugins/commit/51cc924b1341d04aa75a1713713c8a6700b2c0a3)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.0.1 - -## @janus-idp/backstage-plugin-tekton [3.1.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.8...@janus-idp/backstage-plugin-tekton@3.1.9) (2023-11-22) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.5 - -## @janus-idp/backstage-plugin-tekton [3.1.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.7...@janus-idp/backstage-plugin-tekton@3.1.8) (2023-11-21) - -### Bug Fixes - -- sync versions in dynamic assets and publish derived packages as additional packages ([#963](https://github.com/janus-idp/backstage-plugins/issues/963)) ([7d0a386](https://github.com/janus-idp/backstage-plugins/commit/7d0a38609b4a18b54c75378a150e8b5c3ba8ff43)) -- **tekton:** fix sorting for pipeline run durations ([#952](https://github.com/janus-idp/backstage-plugins/issues/952)) ([dc711dd](https://github.com/janus-idp/backstage-plugins/commit/dc711dd24b267a8ba7671e5380d84179e65f4995)) - -## @janus-idp/backstage-plugin-tekton [3.1.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.6...@janus-idp/backstage-plugin-tekton@3.1.7) (2023-11-20) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.4 - -## @janus-idp/backstage-plugin-tekton [3.1.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.5...@janus-idp/backstage-plugin-tekton@3.1.6) (2023-11-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.3 - -## @janus-idp/backstage-plugin-tekton [3.1.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.4...@janus-idp/backstage-plugin-tekton@3.1.5) (2023-11-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.2 - -## @janus-idp/backstage-plugin-tekton [3.1.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.3...@janus-idp/backstage-plugin-tekton@3.1.4) (2023-11-13) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.1 - -## @janus-idp/backstage-plugin-tekton [3.1.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.2...@janus-idp/backstage-plugin-tekton@3.1.3) (2023-11-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.0 - -## @janus-idp/backstage-plugin-tekton [3.1.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.1...@janus-idp/backstage-plugin-tekton@3.1.2) (2023-11-06) - -### Bug Fixes - -- **cli:** add default scalprum config ([#909](https://github.com/janus-idp/backstage-plugins/issues/909)) ([d74fc72](https://github.com/janus-idp/backstage-plugins/commit/d74fc72ab7e0a843da047c7b6570d8a6fbc068e1)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.3.3 - -## @janus-idp/backstage-plugin-tekton [3.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.1.0...@janus-idp/backstage-plugin-tekton@3.1.1) (2023-11-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.3.2 - -## @janus-idp/backstage-plugin-tekton [3.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.0.2...@janus-idp/backstage-plugin-tekton@3.1.0) (2023-11-01) - -### Features - -- **dynamic-plugins:** publish dynamic assets for all frontend plugins ([#896](https://github.com/janus-idp/backstage-plugins/issues/896)) ([dcfb0ac](https://github.com/janus-idp/backstage-plugins/commit/dcfb0ac56769c82f6b8b2cef2726251e0b60c375)) - -## @janus-idp/backstage-plugin-tekton [3.0.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.0.1...@janus-idp/backstage-plugin-tekton@3.0.2) (2023-10-27) - -### Bug Fixes - -- **tekton:** handle flaky cluster error gracefully ([#887](https://github.com/janus-idp/backstage-plugins/issues/887)) ([10ed80e](https://github.com/janus-idp/backstage-plugins/commit/10ed80e4882d473eaee8319a9b1643b14f99a203)) - -## @janus-idp/backstage-plugin-tekton [3.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@3.0.0...@janus-idp/backstage-plugin-tekton@3.0.1) (2023-10-26) - -### Bug Fixes - -- **tekton:** update README and cleanup ([#881](https://github.com/janus-idp/backstage-plugins/issues/881)) ([c495515](https://github.com/janus-idp/backstage-plugins/commit/c495515bc146dfb9e2b64ec8df50d2e5fe01a6c7)) - -## @janus-idp/backstage-plugin-tekton [3.0.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@2.0.2...@janus-idp/backstage-plugin-tekton@3.0.0) (2023-10-23) - -### ⚠ BREAKING CHANGES - -- **tekton:** update tekton UX (#839) - -### Features - -- **tekton:** update tekton UX ([#839](https://github.com/janus-idp/backstage-plugins/issues/839)) ([789c945](https://github.com/janus-idp/backstage-plugins/commit/789c945580b8f82349a5c62b98c77d5dbf4781f1)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 2.0.0 - -## @janus-idp/backstage-plugin-tekton [2.0.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@2.0.1...@janus-idp/backstage-plugin-tekton@2.0.2) (2023-10-19) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.3.3 - -## @janus-idp/backstage-plugin-tekton [2.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@2.0.0...@janus-idp/backstage-plugin-tekton@2.0.1) (2023-10-16) - -### Bug Fixes - -- **tekton:** fix pipelinerun status icon color ([#734](https://github.com/janus-idp/backstage-plugins/issues/734)) ([c800f98](https://github.com/janus-idp/backstage-plugins/commit/c800f987afc9a96bec93c13295d8fdb0c5964a93)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.3.2 - -## @janus-idp/backstage-plugin-tekton [2.0.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.9.6...@janus-idp/backstage-plugin-tekton@2.0.0) (2023-10-09) - -### ⚠ BREAKING CHANGES - -- **tekton:** enable tekton related features when the tekton annotation is present (#741) - -### Features - -- **tekton:** enable tekton related features when the tekton annotation is present ([#741](https://github.com/janus-idp/backstage-plugins/issues/741)) ([474d3f0](https://github.com/janus-idp/backstage-plugins/commit/474d3f01bb312a668bc8b39dc4c78f6f52b5cf87)) - -## @janus-idp/backstage-plugin-tekton [1.9.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.9.5...@janus-idp/backstage-plugin-tekton@1.9.6) (2023-09-22) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.3.1 - -## @janus-idp/backstage-plugin-tekton [1.9.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.9.4...@janus-idp/backstage-plugin-tekton@1.9.5) (2023-09-11) - -## @janus-idp/backstage-plugin-tekton [1.9.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.9.3...@janus-idp/backstage-plugin-tekton@1.9.4) (2023-09-05) - -### Documentation - -- **tekton:** minor changes in tekton documentation ([#691](https://github.com/janus-idp/backstage-plugins/issues/691)) ([02a18fb](https://github.com/janus-idp/backstage-plugins/commit/02a18fb75a31fbbd221385ac18e5c05cecec0d7d)) - -## @janus-idp/backstage-plugin-tekton [1.9.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.9.2...@janus-idp/backstage-plugin-tekton@1.9.3) (2023-08-28) - -### Documentation - -- **tekton:** updated images ([#606](https://github.com/janus-idp/backstage-plugins/issues/606)) ([b138c64](https://github.com/janus-idp/backstage-plugins/commit/b138c64b5476216eac38a5553b05751e3df736f1)) - -## @janus-idp/backstage-plugin-tekton [1.9.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.9.1...@janus-idp/backstage-plugin-tekton@1.9.2) (2023-08-24) - -### Documentation - -- update tekton and topology documentation with pod log permissions ([#668](https://github.com/janus-idp/backstage-plugins/issues/668)) ([5b0a9f7](https://github.com/janus-idp/backstage-plugins/commit/5b0a9f77448d624c50f58e19d7f439700bef9cfe)) - -## @janus-idp/backstage-plugin-tekton [1.9.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.9.0...@janus-idp/backstage-plugin-tekton@1.9.1) (2023-08-22) - -### Bug Fixes - -- **tekton:** fix code smells ([#632](https://github.com/janus-idp/backstage-plugins/issues/632)) ([2ad13da](https://github.com/janus-idp/backstage-plugins/commit/2ad13dac8ae27959d74d45c91da01c95e7b80e20)) - -## @janus-idp/backstage-plugin-tekton [1.9.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.8.3...@janus-idp/backstage-plugin-tekton@1.9.0) (2023-08-14) - -### Features - -- **ts:** transpile each plugin separately ([#634](https://github.com/janus-idp/backstage-plugins/issues/634)) ([b94c4dc](https://github.com/janus-idp/backstage-plugins/commit/b94c4dc50ada328e5ce1bed5fb7c76f64607e1ee)) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.3.0 - -## @janus-idp/backstage-plugin-tekton [1.8.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.8.2...@janus-idp/backstage-plugin-tekton@1.8.3) (2023-08-14) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.2.2 - -## @janus-idp/backstage-plugin-tekton [1.8.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.8.1...@janus-idp/backstage-plugin-tekton@1.8.2) (2023-08-14) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.2.1 - -## @janus-idp/backstage-plugin-tekton [1.8.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.8.0...@janus-idp/backstage-plugin-tekton@1.8.1) (2023-08-11) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.2.0 - -## @janus-idp/backstage-plugin-tekton [1.8.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.7.2...@janus-idp/backstage-plugin-tekton@1.8.0) (2023-08-10) - -### Features - -- **tekton:** visualize pipelinerun logs ([#553](https://github.com/janus-idp/backstage-plugins/issues/553)) ([540a105](https://github.com/janus-idp/backstage-plugins/commit/540a105287ee557de724f44389e9c571405d0a3d)) - -## @janus-idp/backstage-plugin-tekton [1.7.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.7.1...@janus-idp/backstage-plugin-tekton@1.7.2) (2023-08-10) - -### Dependencies - -- **@janus-idp/shared-react:** upgraded to 1.1.1 - -## @janus-idp/backstage-plugin-tekton [1.7.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.7.0...@janus-idp/backstage-plugin-tekton@1.7.1) (2023-08-09) - -### Bug Fixes - -- **tekton:** use shared-react package ([#623](https://github.com/janus-idp/backstage-plugins/issues/623)) ([57672c0](https://github.com/janus-idp/backstage-plugins/commit/57672c0d7f5549360e2cef19421648f3fea1f332)) - -## @janus-idp/backstage-plugin-tekton [1.7.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.6.0...@janus-idp/backstage-plugin-tekton@1.7.0) (2023-07-25) - -### Features - -- **tekton:** view pipelinerun visualization on click of pipelinerun ([#506](https://github.com/janus-idp/backstage-plugins/issues/506)) ([092d2bd](https://github.com/janus-idp/backstage-plugins/commit/092d2bd55d69171f9d3c290c9346c7d13dafcf97)) - -## @janus-idp/backstage-plugin-tekton [1.6.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.5.2...@janus-idp/backstage-plugin-tekton@1.6.0) (2023-07-10) - -### Features - -- **tekton:** create paginated table using Backstage core components ([#503](https://github.com/janus-idp/backstage-plugins/issues/503)) ([5cc47c1](https://github.com/janus-idp/backstage-plugins/commit/5cc47c1a346a4f006adf88ad15c942be5151b913)) - -## @janus-idp/backstage-plugin-tekton [1.5.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.5.1...@janus-idp/backstage-plugin-tekton@1.5.2) (2023-06-30) - -### Bug Fixes - -- **tekton:** fix pipelinerun task status info ([#491](https://github.com/janus-idp/backstage-plugins/issues/491)) ([191ba44](https://github.com/janus-idp/backstage-plugins/commit/191ba44fd3e5c7e092a5b0231325427300383a0e)) - -## @janus-idp/backstage-plugin-tekton [1.5.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.5.0...@janus-idp/backstage-plugin-tekton@1.5.1) (2023-06-14) - -### Other changes - -- reorder imports via prettier ([#419](https://github.com/janus-idp/backstage-plugins/issues/419)) ([17f1e6a](https://github.com/janus-idp/backstage-plugins/commit/17f1e6a689bd793a619ec5e42e5cdda0998f78a5)) - -### Documentation - -- update plugin README formatting ([#396](https://github.com/janus-idp/backstage-plugins/issues/396)) ([9b39056](https://github.com/janus-idp/backstage-plugins/commit/9b39056f6c66e9a6a0a5d0c4059420dff66db263)), closes [#295](https://github.com/janus-idp/backstage-plugins/issues/295) [#369](https://github.com/janus-idp/backstage-plugins/issues/369) [#295](https://github.com/janus-idp/backstage-plugins/issues/295) [#369](https://github.com/janus-idp/backstage-plugins/issues/369) - -## @janus-idp/backstage-plugin-tekton [1.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.14...@janus-idp/backstage-plugin-tekton@1.5.0) (2023-05-31) - -### Features - -- **tekton:** show cluster label before the select dropdown ([#345](https://github.com/janus-idp/backstage-plugins/issues/345)) ([582586e](https://github.com/janus-idp/backstage-plugins/commit/582586eca35af76fa931ace6d823e74dd4012215)) - -## @janus-idp/backstage-plugin-tekton [1.4.14](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.13...@janus-idp/backstage-plugin-tekton@1.4.14) (2023-05-30) - -## @janus-idp/backstage-plugin-tekton [1.4.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.12...@janus-idp/backstage-plugin-tekton@1.4.13) (2023-05-30) - -## @janus-idp/backstage-plugin-tekton [1.4.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.11...@janus-idp/backstage-plugin-tekton@1.4.12) (2023-05-30) - -### Bug Fixes - -- **tekton:** in case of bad configuration show empty state for tekton plugin and no cluster selector ([#390](https://github.com/janus-idp/backstage-plugins/issues/390)) ([83e47df](https://github.com/janus-idp/backstage-plugins/commit/83e47df6247cf9dccc0842eec1380b37e58bea47)) - -## @janus-idp/backstage-plugin-tekton [1.4.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.10...@janus-idp/backstage-plugin-tekton@1.4.11) (2023-05-29) - -### Bug Fixes - -- **tekton:** handles unnecessary rerenders on tekton ([#391](https://github.com/janus-idp/backstage-plugins/issues/391)) ([86c1700](https://github.com/janus-idp/backstage-plugins/commit/86c1700a89db238dda0efca23ada72c94a2ee72b)) - -## @janus-idp/backstage-plugin-tekton [1.4.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.9...@janus-idp/backstage-plugin-tekton@1.4.10) (2023-05-22) - -### Documentation - -- **tekton:** add user docs ([#365](https://github.com/janus-idp/backstage-plugins/issues/365)) ([4dc7e1a](https://github.com/janus-idp/backstage-plugins/commit/4dc7e1a2a81676642a24905d720967cfb78f4194)) - -## @janus-idp/backstage-plugin-tekton [1.4.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.8...@janus-idp/backstage-plugin-tekton@1.4.9) (2023-05-18) - -### Documentation - -- update plugin READMEs ([#373](https://github.com/janus-idp/backstage-plugins/issues/373)) ([478560e](https://github.com/janus-idp/backstage-plugins/commit/478560e38cceaa40d976bccf4785956ed58b5221)) - -## @janus-idp/backstage-plugin-tekton [1.4.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.7...@janus-idp/backstage-plugin-tekton@1.4.8) (2023-05-17) - -### Bug Fixes - -- **deps:** update all non-major dependencies ([#358](https://github.com/janus-idp/backstage-plugins/issues/358)) ([086a9ed](https://github.com/janus-idp/backstage-plugins/commit/086a9ed839f3a6dd1460f0f87b71453a7ed62ea3)) - -## @janus-idp/backstage-plugin-tekton [1.4.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.6...@janus-idp/backstage-plugin-tekton@1.4.7) (2023-05-15) - -## @janus-idp/backstage-plugin-tekton [1.4.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.5...@janus-idp/backstage-plugin-tekton@1.4.6) (2023-05-15) - -## @janus-idp/backstage-plugin-tekton [1.4.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.4...@janus-idp/backstage-plugin-tekton@1.4.5) (2023-05-11) - -### Bug Fixes - -- **deps:** update all non-major dependencies ([#339](https://github.com/janus-idp/backstage-plugins/issues/339)) ([d19d96d](https://github.com/janus-idp/backstage-plugins/commit/d19d96de7b55c205e0f77528e476104c0685aad2)) - -## @janus-idp/backstage-plugin-tekton [1.4.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.3...@janus-idp/backstage-plugin-tekton@1.4.4) (2023-05-09) - -### Bug Fixes - -- **plugins:** remove React.FC types ([#335](https://github.com/janus-idp/backstage-plugins/issues/335)) ([f3d40af](https://github.com/janus-idp/backstage-plugins/commit/f3d40af9c6e55e5699ed78d07ae6617e25b33c18)) - -## @janus-idp/backstage-plugin-tekton [1.4.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.2...@janus-idp/backstage-plugin-tekton@1.4.3) (2023-05-09) - -### Other changes - -- **deps:** update all non-major dependencies ([#333](https://github.com/janus-idp/backstage-plugins/issues/333)) ([dce0ea4](https://github.com/janus-idp/backstage-plugins/commit/dce0ea4a9b9f517bd864d39f0b364c68e6a2e143)) -- **plugins:** remove react namespace import ([#336](https://github.com/janus-idp/backstage-plugins/issues/336)) ([01ab4aa](https://github.com/janus-idp/backstage-plugins/commit/01ab4aaf9c88c58c955903372b556f33e2e6461e)) - -## @janus-idp/backstage-plugin-tekton [1.4.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.1...@janus-idp/backstage-plugin-tekton@1.4.2) (2023-05-04) - -### Other changes - -- **deps:** update all non-major dependencies ([#127](https://github.com/janus-idp/backstage-plugins/issues/127)) ([a9d359f](https://github.com/janus-idp/backstage-plugins/commit/a9d359f01448d1b9b4b4d3d9b087052fb6ff16b3)) - -## @janus-idp/backstage-plugin-tekton [1.4.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.4.0...@janus-idp/backstage-plugin-tekton@1.4.1) (2023-05-02) - -### Bug Fixes - -- **tekton:** fix task node status ([#320](https://github.com/janus-idp/backstage-plugins/issues/320)) ([22b0b1e](https://github.com/janus-idp/backstage-plugins/commit/22b0b1ece1b0da5e3ac49949b6ac57dd116f564b)) - -## @janus-idp/backstage-plugin-tekton [1.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.3.0...@janus-idp/backstage-plugin-tekton@1.4.0) (2023-04-28) - -### Features - -- **tekton:** add cluster selector in the pipeline vis card ([#308](https://github.com/janus-idp/backstage-plugins/issues/308)) ([e321ba9](https://github.com/janus-idp/backstage-plugins/commit/e321ba9a18a8e72af86abe1df7d8ea47d429e3a5)) - -## @janus-idp/backstage-plugin-tekton [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.2.0...@janus-idp/backstage-plugin-tekton@1.3.0) (2023-04-28) - -### Features - -- **tekton:** tekton pipeline run list sort ([#253](https://github.com/janus-idp/backstage-plugins/issues/253)) ([356f637](https://github.com/janus-idp/backstage-plugins/commit/356f637d183eaa58e27be383db5834167f13c058)) - -## @janus-idp/backstage-plugin-tekton [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.1.1...@janus-idp/backstage-plugin-tekton@1.2.0) (2023-04-25) - -### Features - -- **tekton:** add latest pipelineRun visualization ([#242](https://github.com/janus-idp/backstage-plugins/issues/242)) ([87f7f5c](https://github.com/janus-idp/backstage-plugins/commit/87f7f5c3753c100dfd50fe8e6359e22651cfb3ae)) - -## @janus-idp/backstage-plugin-tekton [1.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.1.0...@janus-idp/backstage-plugin-tekton@1.1.1) (2023-04-19) - -### Bug Fixes - -- **tekton:** updates pf react-topology to standalone release ([#263](https://github.com/janus-idp/backstage-plugins/issues/263)) ([e739463](https://github.com/janus-idp/backstage-plugins/commit/e73946309fecfb3785419cf3543feefff4f54111)) - -## @janus-idp/backstage-plugin-tekton [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-tekton@1.0.0...@janus-idp/backstage-plugin-tekton@1.1.0) (2023-04-17) - -### Features - -- **tekton:** tekton pipeline run list page ([#236](https://github.com/janus-idp/backstage-plugins/issues/236)) ([864941f](https://github.com/janus-idp/backstage-plugins/commit/864941f96a0a733dc20914cc6127c39a9e3ebfb2)) - -## @janus-idp/backstage-plugin-tekton 1.0.0 (2023-04-03) - -### Features - -- **tekton:** tekton plugin init with backstage k8s plugin ([#214](https://github.com/janus-idp/backstage-plugins/issues/214)) ([eb2f6d8](https://github.com/janus-idp/backstage-plugins/commit/eb2f6d8dd3056e9be84051dbb8bba09de1455eb2)) diff --git a/plugins/tekton/CONTRIBUTING.md b/plugins/tekton/CONTRIBUTING.md deleted file mode 100644 index f26271984a..0000000000 --- a/plugins/tekton/CONTRIBUTING.md +++ /dev/null @@ -1,7 +0,0 @@ -# Setting up the development environment for Tekton plugin - -In [Backstage plugin terminology](https://backstage.io/docs/local-dev/cli-build-system#package-roles), the Tekton plugin is a front-end plugin. You can start a live development session from the repository root using the following command: - -```console -yarn workspace @janus-idp/backstage-plugin-tekton run start -``` diff --git a/plugins/tekton/README.md b/plugins/tekton/README.md index f61cd8526d..af6428986a 100644 --- a/plugins/tekton/README.md +++ b/plugins/tekton/README.md @@ -1,369 +1,3 @@ -# Tekton plugin for Backstage +# Deprecated -The Tekton plugin enables you to visualize the `PipelineRun` resources available on the Kubernetes cluster. - -## For administrators - -### Setting up the Tekton plugin - -#### Prerequisites - -- The Kubernetes backend plugin `@backstage/plugin-kubernetes-backend` is installed and configured by following the [installation](https://backstage.io/docs/features/kubernetes/installation) and [configuration](https://backstage.io/docs/features/kubernetes/configuration) guides. - -- The following `customResources` component is added in the [`app-config.yaml`](https://backstage.io/docs/features/kubernetes/configuration#configuring-kubernetes-clusters) file: - ```yaml - kubernetes: - ... - customResources: - - group: 'tekton.dev' - apiVersion: 'v1' - plural: 'pipelineruns' - - group: 'tekton.dev' - apiVersion: 'v1' - plural: 'taskruns' - ``` -- The Kubernetes plugin is configured and connects to the cluster using a `ServiceAccount`. -- The [`ClusterRole`](https://backstage.io/docs/features/kubernetes/configuration#role-based-access-control) must be granted for custom resources (PipelineRuns and TaskRuns) to `ServiceAccount` accessing the cluster. -- To view the pod logs, you have granted permissions for `pods/log`. -- If you have the Backstage Kubernetes Plugin configured, then the `ClusterRole` is already granted. - - You can use the following code to grant the `ClusterRole` for custom resources and pod logs: - - ```yaml - ... - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRole - metadata: - name: backstage-read-only - rules: - - apiGroups: - - "" - resources: - - pods/log - verbs: - - get - - list - - watch - ... - - apiGroups: - - tekton.dev - resources: - - pipelineruns - - taskruns - verbs: - - get - - list - - ``` - - > Tip: You can use the [prepared manifest for a read-only `ClusterRole`](https://raw.githubusercontent.com/janus-idp/backstage-plugins/main/plugins/tekton/manifests/clusterrole.yaml), which provides access for both Kubernetes plugin and Tekton plugin. - -- The following annotation is added to the entity's `catalog-info.yaml` file to identify whether an entity contains the Kubernetes resources: - - ```yaml - annotations: - ... - - backstage.io/kubernetes-id: - ``` - - You can also add the `backstage.io/kubernetes-namespace` annotation to identify the Kubernetes resources using the defined namespace. - - ```yaml - annotations: - ... - - backstage.io/kubernetes-namespace: - ``` - -- The following annotation is added to the `catalog-info.yaml` file of the entity to enable the Tekton related features in Backstage. The value of the annotation identifies the name of the Backstage entity: - - ```yaml - annotations: - ... - - janus-idp.io/tekton : - ``` - -- A custom label selector can be added, which Backstage uses to find the Kubernetes resources. The label selector takes precedence over the ID annotations. - - ```yaml - annotations: - ... - - backstage.io/kubernetes-label-selector: 'app=my-app,component=front-end' - ``` - -- The following label is added to the resources so that the Kubernetes plugin gets the Kubernetes resources from the requested entity: - - ```yaml - labels: - ... - - backstage.io/kubernetes-id: ` - ``` - - *** - - **NOTE** - - When using the label selector, the mentioned labels must be present on the resource. - - *** - -#### Procedure - -1. Install the Tekton plugin using the following command: - - ```console - yarn workspace app add @janus-idp/backstage-plugin-tekton - ``` - -1. To enable the PipelineRun list in the **CI/CD** tab on the entity view page, add the following snippet in the `packages/app/src/components/catalog/EntityPage.tsx`. - - ```tsx title="packages/app/src/components/catalog/EntityPage.tsx" - /* highlight-add-next-line */ - import { - isTektonCIAvailable, - TektonCI, - } from '@janus-idp/backstage-plugin-tekton'; - - const cicdContent = ( - - {/* ... */} - {/* highlight-add-start */} - - - - {/* highlight-add-end */} - - ); - ``` - -## For users - -### Using the Tekton plugin in Backstage - -Tekton is a front-end plugin that enables you to view the `PipelineRun` resources. - -#### Prerequisites - -- Your Backstage application is installed and running. -- You have installed the Tekton plugin. For the installation process, see [Installation](#setting-up-the-tekton-plugin). - -#### Procedure - -1. Open your Backstage application and select a component from the **Catalog** page. - -1. Go to the **CI/CD** tab. - - The **CI/CD** tab displays the list of PipelineRun resources associated with a Kubernetes cluster. The list contains pipeline run details, such as **NAME**, **STATUS**, **TASK STATUS**, **STARTED**, and **DURATION**. - - ![ci-cd-tab-tekton](./images/tekton-plugin-user4.png) - -1. Click on expand row button besides PipelineRun name in the list to view the PipelineRun visualization. The pipeline run resource include tasks to complete. When you hover the mouse pointer on a task card, you can view the steps to complete that particular task. - - ![pipelinerun-view](./images/tekton-plugin-user5.png) - -## Enabling UI elements - -### Vulnerabilites Column - -`Vulnerabilities` column provides a visual representation of identified vulnerabilities in the OCI image produced by the pipelinerun. The Author of the pipeline scanner task would provide the CVE summary data using the below format that the UI can interpret. - -The result of the scanner task should be emitted back to the pipelinerun and it should contain a result that ends with `SCAN_OUTPUT` string. - -## Format: - -Result name: `_SCAN_OUTPUT` -eg: `SCAN_OUTPUT`, `MY_ACS_SCAN_OUTPUT` - -Result value: `'{"vulnerabilities":{"critical": 0,"high": 9,"medium": 2,"low": 13,"unknown": 0}, - "unpatched_vulnerabilities": {"critical": 0,"high": 1,"medium": 0,"low":1}}'` - ---- - -Example PipelineRun: - -``` - ... - status: - results: - - name: 'MY_SCAN_OUTPUT' - value: - '{"vulnerabilities":{"critical": 0,"high": 9,"medium": 2,"low": 13,"unknown": 0}, - "unpatched_vulnerabilities": {"critical": 0,"high": 1,"medium": 0,"low":1}}' -``` - -![tekton-vulnerabilites](./images/tekton-plugin-vulnerabilities.png) - ---- - -## Action buttons - -### SBOM - -Link to SBOM action will be enabled if there is a SBOM task in the pipelinerun and it should contain required annotations and emit the below result - -## Format: - -annotations: - -``` - task.output.location: results - task.results.format: application/text - task.results.type: external-link # Optional: This will redirect to external page - task.results.key: LINK_TO_SBOM - -``` - -results.name: `LINK_T0_SBOM` - -results.value: `` - ---- - -Example: - -## Task: [Optional] - -``` -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: export-sbom-task - annotations: - task.output.location: results - task.results.format: application/text - task.results.type: external-link # Optional: This will redirect to external page - task.results.key: LINK_TO_SBOM -spec: … - steps: - - image: registry.access.redhat.com/ubi8/ubi-minimal - name: export-sbom - script: | - #!/bin/sh - ## sbom image generation script goes here - echo 'quay.io/repo/image:build-8e536-1692702836' | tee $(results.LINK_TO_SBOM.path) -``` - -_Note: Absence of the below annotation will open SBOM taskrun logs modal._ - -``` -task.results.type: external-link # This will redirect to external page -``` - -### Output: - -Output action will be enabled when the pipelinerun emits some results and/or contains taskruns with supported annotations and emits report data in pod logs. - -This action opens a modal where it will render the reports for Enterprise contract and Advanced cluster security. The report data should be exposed via pod logs and the taskruns should contain the following annotations. - -Examples: - -list of supported report tasks with correct annotations are listed below: - -## Enterprise contract Task [Optional]: - -``` -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: enterprise-contract-task - annotations: - task.results.format: application/json - task.results.type: ec - task.output.location: logs - task.results.container: step-report-json -spec: … - steps: - - name: report-json - image: quay.io/enterprise-contract/ec-cli:snapshot@sha256:33be4031a3316a46db3559a4d8566bc22f9d4d491d262d699614f32f35b45b67 - command: [cat] - args: - - "$(params.HOMEDIR)/report-json.json" - -``` - -![tekton-ec-report](./images/tekton-plugin-ec-output.png) - ---- - -## ACS Image scan Task [Optional]: - -``` -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: acs-image-scan - annotations: - task.results.format: application/json - task.results.type: roxctl-image-scan - task.results.key: SCAN_OUTPUT - task.output.location: logs - task.results.container: step-report -spec: … - steps: - - name: report - image: 'quay.io/lrangine/crda-maven:11.0' - script: | - #!/bin/sh - cat $(workspaces.reports.path)/image-scan - -``` - -## ACS Image check Task [Optional]: - -``` -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: acs-image-check - annotations: - task.results.format: application/json - task.results.type: roxctl-image-check - task.results.key: SCAN_OUTPUT - task.output.location: logs - task.results.container: step-report -spec: … - steps: - - name: report - image: 'quay.io/lrangine/crda-maven:11.0' - script: | - #!/bin/sh - cat $(workspaces.reports.path)/image-check - -``` - -## ACS Deployment check Task [Optional]: - -``` -apiVersion: tekton.dev/v1 -kind: Task -metadata: - name: acs-deployment-check - annotations: - task.results.format: application/json - task.results.type: roxctl-deployment-check - task.results.key: SCAN_OUTPUT - task.output.location: logs - task.results.container: step-report -spec: … - steps: - - name: report - image: 'quay.io/lrangine/crda-maven:11.0' - script: | - #!/bin/sh - cat $(workspaces.reports.path)/deployment-check - -``` - -![tekton-acs-report](./images/tekton-plugin-acs-output.png) - ---- - -## Pipelinerun results - -The results emitted in the pipelinerun resource will be available in the Others section in the output modal. - -![tekton-pipelinerun-report](./images/tekton-plugin-pipelinerun-output.png) +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-tekton` instead. \ No newline at end of file diff --git a/plugins/tekton/app-config.janus-idp.yaml b/plugins/tekton/app-config.janus-idp.yaml deleted file mode 100644 index 65affeda61..0000000000 --- a/plugins/tekton/app-config.janus-idp.yaml +++ /dev/null @@ -1,12 +0,0 @@ -dynamicPlugins: - frontend: - janus-idp.backstage-plugin-tekton: - mountPoints: - - mountPoint: entity.page.ci/cards - importName: TektonCI - config: - layout: - gridColumn: '1 / -1' - if: - allOf: - - isTektonCIAvailable diff --git a/plugins/tekton/catalog-info.yaml b/plugins/tekton/catalog-info.yaml deleted file mode 100644 index f4495c41e1..0000000000 --- a/plugins/tekton/catalog-info.yaml +++ /dev/null @@ -1,57 +0,0 @@ -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-tekton - title: Tekton plugin - description: Tekton plugin for Backstage - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/tekton - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/tekton/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/tekton/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/rhtap - sonarqube.org/project-key: janus-idp_backstage-plugins - tags: - - kubernetes - - openshift - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/tekton - title: GitHub Source - icon: source - type: source -spec: - type: backstage-plugin - lifecycle: production - owner: rhtap-team - system: rhdh - subcomponentOf: janus-idp-backstage-plugins ---- -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-tekton-frontend - title: '@janus-idp/backstage-plugin-tekton' - description: Tekton plugin for Backstage - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/tekton - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/tekton/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/tekton/catalog-info.yaml - github.com/project-slug: janus-idp/backstage-plugins - github.com/team-slug: janus-idp/rhtap - sonarqube.org/project-key: janus-idp_backstage-plugins - tags: - - kubernetes - - openshift - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/tekton - title: GitHub Source - icon: source - type: source -spec: - type: backstage-frontend-plugin - lifecycle: production - owner: rhtap-team - system: rhdh - subcomponentOf: janus-idp-tekton diff --git a/plugins/tekton/dev/index.tsx b/plugins/tekton/dev/index.tsx deleted file mode 100644 index b85b67ca40..0000000000 --- a/plugins/tekton/dev/index.tsx +++ /dev/null @@ -1,212 +0,0 @@ -import React from 'react'; - -import { Entity } from '@backstage/catalog-model'; -import { createDevApp } from '@backstage/dev-utils'; -import { EntityProvider } from '@backstage/plugin-catalog-react'; -import { - KubernetesApi, - KubernetesProxyApi, -} from '@backstage/plugin-kubernetes-react'; -import { permissionApiRef } from '@backstage/plugin-permission-react'; -import { MockPermissionApi, TestApiProvider } from '@backstage/test-utils'; - -import { getAllThemes } from '@redhat-developer/red-hat-developer-hub-theme'; - -import { mockKubernetesPlrResponse } from '../src/__fixtures__/1-pipelinesData'; -import { - acsDeploymentCheck, - acsImageCheckResults, - acsImageScanResult, -} from '../src/__fixtures__/advancedClusterSecurityData'; -import { enterpriseContractResult } from '../src/__fixtures__/enterpriseContractData'; -import { TektonCI, tektonPlugin } from '../src/plugin'; -import { - kubernetesApiRef, - kubernetesAuthProvidersApiRef, - kubernetesProxyApiRef, -} from '../src/types/types'; - -const mockEntity: Entity = { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Component', - metadata: { - name: 'backstage', - description: 'backstage.io', - annotations: { - 'backstage.io/kubernetes-id': 'backstage', - 'janus-idp.io/tekton': 'app', - }, - }, - spec: { - lifecycle: 'production', - type: 'service', - owner: 'user:guest', - }, -}; - -const mockPermissionApi = new MockPermissionApi(); -class MockKubernetesProxyApi implements KubernetesProxyApi { - async getPodLogs(_request: any): Promise { - const delayedResponse = (data: string, ms: number) => - new Promise(resolve => { - setTimeout(() => { - resolve({ - text: data, - }); - }, ms); - }); - - if (_request.podName.includes('ec-task')) { - return delayedResponse(JSON.stringify(enterpriseContractResult), 100); - } - - if (_request.podName.includes('image-scan-task')) { - return delayedResponse(JSON.stringify(acsImageScanResult), 200); - } - - if (_request.podName.includes('image-check-task')) { - return delayedResponse(JSON.stringify(acsImageCheckResults), 300); - } - - if (_request.podName.includes('deployment-check-task')) { - return delayedResponse(JSON.stringify(acsDeploymentCheck), 400); - } - - const response = `\nstreaming logs from container: ${_request.containerName} \n...`; - return delayedResponse(response, 500); - } - - async getEventsByInvolvedObjectName(): Promise { - return {}; - } -} -class MockKubernetesClient implements KubernetesApi { - readonly resources; - - constructor(fixtureData: { [resourceType: string]: any[] }) { - this.resources = Object.entries(fixtureData).flatMap( - ([type, resources]) => { - if (type === 'pipelineruns' && resources[0]?.kind === 'PipelineRun') { - return { - type: 'customresources', - resources, - }; - } else if (type === 'taskruns' && resources[0]?.kind === 'TaskRun') { - return { - type: 'customresources', - resources, - }; - } - return { - type: type.toLocaleLowerCase('en-US'), - resources, - }; - }, - ); - } - - async getWorkloadsByEntity(_request: any): Promise { - return { - items: [ - { - cluster: { name: 'mock-cluster' }, - resources: this.resources, - podMetrics: [], - errors: [], - }, - ], - }; - } - async getCustomObjectsByEntity(_request: any): Promise { - return { - items: [ - { - cluster: { name: 'mock-cluster' }, - resources: this.resources, - podMetrics: [], - errors: [], - }, - ], - }; - } - - async getObjectsByEntity(): Promise { - return { - items: [ - { - cluster: { name: 'mock-cluster' }, - resources: this.resources, - podMetrics: [], - errors: [], - }, - ], - }; - } - - async getClusters(): Promise<{ name: string; authProvider: string }[]> { - return [{ name: 'mock-cluster', authProvider: 'serviceAccount' }]; - } - - async getCluster(_clusterName: string): Promise< - | { - name: string; - authProvider: string; - oidcTokenProvider?: string; - dashboardUrl?: string; - } - | undefined - > { - return { name: 'mock-cluster', authProvider: 'serviceAccount' }; - } - - async proxy(_options: { clusterName: String; path: String }): Promise { - return { - kind: 'Namespace', - apiVersion: 'v1', - metadata: { - name: 'mock-ns', - }, - }; - } -} - -const mockKubernetesAuthProviderApiRef = { - decorateRequestBodyForAuth: async () => { - return { - entity: { - apiVersion: 'v1', - kind: 'xyz', - metadata: { name: 'hey' }, - }, - }; - }, - getCredentials: async () => { - return {}; - }, -}; - -createDevApp() - .addThemes(getAllThemes()) - .addPage({ - element: ( - - - - - - ), - title: 'Tekton CI', - path: '/tekton', - }) - .registerPlugin(tektonPlugin) - .render(); diff --git a/plugins/tekton/images/tekton-plugin-acs-output.png b/plugins/tekton/images/tekton-plugin-acs-output.png deleted file mode 100644 index 263ee4f4b4..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-acs-output.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-ec-output.png b/plugins/tekton/images/tekton-plugin-ec-output.png deleted file mode 100644 index 3dc5b01b23..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-ec-output.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-pipelinerun-output.png b/plugins/tekton/images/tekton-plugin-pipelinerun-output.png deleted file mode 100644 index b10d9e4b30..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-pipelinerun-output.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-user1.png b/plugins/tekton/images/tekton-plugin-user1.png deleted file mode 100644 index e9c60c2f14..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-user1.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-user2.png b/plugins/tekton/images/tekton-plugin-user2.png deleted file mode 100644 index 6eae95ffa9..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-user2.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-user3.png b/plugins/tekton/images/tekton-plugin-user3.png deleted file mode 100644 index cbe6aabde6..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-user3.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-user4.png b/plugins/tekton/images/tekton-plugin-user4.png deleted file mode 100644 index 6703ccc776..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-user4.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-user5.png b/plugins/tekton/images/tekton-plugin-user5.png deleted file mode 100644 index e3f701c237..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-user5.png and /dev/null differ diff --git a/plugins/tekton/images/tekton-plugin-vulnerabilities.png b/plugins/tekton/images/tekton-plugin-vulnerabilities.png deleted file mode 100644 index 8d1b287448..0000000000 Binary files a/plugins/tekton/images/tekton-plugin-vulnerabilities.png and /dev/null differ diff --git a/plugins/tekton/manifests/clusterrole.yaml b/plugins/tekton/manifests/clusterrole.yaml deleted file mode 100644 index 61586fd5d4..0000000000 --- a/plugins/tekton/manifests/clusterrole.yaml +++ /dev/null @@ -1,71 +0,0 @@ -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: janus-idp-tekton-plugin -rules: - # Base for Kubernetes plugin - - apiGroups: - - '' - resources: - - pods/log - - pods - - services - - configmaps - - limitranges - verbs: - - get - - watch - - list - - apiGroups: - - metrics.k8s.io - resources: - - pods - verbs: - - get - - watch - - list - - apiGroups: - - apps - resources: - - daemonsets - - deployments - - replicasets - - statefulsets - verbs: - - get - - watch - - list - - apiGroups: - - autoscaling - resources: - - horizontalpodautoscalers - verbs: - - get - - watch - - list - - apiGroups: - - networking.k8s.io - resources: - - ingresses - verbs: - - get - - watch - - list - - apiGroups: - - batch - resources: - - jobs - - cronjobs - verbs: - - get - - watch - - list - # Additional permissions for the @janus-idp/backstage-plugin-tekton - - apiGroups: - - tekton.dev - resources: - - pipelineruns - - taskruns - verbs: - - get - - list diff --git a/plugins/tekton/package.json b/plugins/tekton/package.json deleted file mode 100644 index 07493cb19f..0000000000 --- a/plugins/tekton/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@janus-idp/backstage-plugin-tekton", - "version": "3.15.1", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" - }, - "backstage": { - "role": "frontend-plugin", - "supported-versions": "1.32.5", - "pluginId": "tekton", - "pluginPackage": "@janus-idp/backstage-plugin-tekton", - "pluginPackages": [ - "@janus-idp/backstage-plugin-tekton", - "@janus-idp/backstage-plugin-tekton-common" - ] - }, - "sideEffects": [ - "./**/*.css" - ], - "scripts": { - "build": "backstage-cli package build", - "clean": "backstage-cli package clean", - "lint:check": "backstage-cli package lint", - "lint:fix": "backstage-cli package lint --fix", - "postpack": "backstage-cli package postpack", - "prepack": "backstage-cli package prepack", - "start": "backstage-cli package start", - "test": "backstage-cli package test --passWithNoTests --coverage", - "tsc": "tsc", - "prettier:check": "prettier --ignore-unknown --check .", - "prettier:fix": "prettier --ignore-unknown --write .", - "ui-test": "start-server-and-test start localhost:3000 'playwright test'" - }, - "dependencies": { - "@aonic-ui/pipelines": "^1.1.1", - "@backstage/catalog-model": "^1.7.0", - "@backstage/core-components": "^0.15.1", - "@backstage/core-plugin-api": "^1.10.0", - "@backstage/plugin-catalog-react": "^1.14.0", - "@backstage/plugin-kubernetes": "^0.11.16", - "@backstage/plugin-kubernetes-common": "^0.8.3", - "@backstage/plugin-kubernetes-react": "^0.4.4", - "@backstage/plugin-permission-react": "^0.4.27", - "@backstage/theme": "^0.6.0", - "@janus-idp/backstage-plugin-tekton-common": "^1.3.1", - "@janus-idp/shared-react": "^2.13.1", - "@kubernetes/client-node": "^0.22.1", - "@material-ui/core": "^4.9.13", - "@material-ui/icons": "^4.11.3", - "@material-ui/lab": "^4.0.0-alpha.45", - "@mui/icons-material": "5.15.17", - "@patternfly/patternfly": "^5.1.0", - "@patternfly/react-charts": "^7.1.1", - "@patternfly/react-core": "^5.1.2", - "@patternfly/react-tokens": "^5.1.2", - "@patternfly/react-topology": "^5.1.0", - "classnames": "^2.3.2", - "dagre": "^0.8.5", - "lodash": "^4.17.21", - "react-measure": "^2.5.2", - "react-use": "^17.4.0" - }, - "peerDependencies": { - "react": "^16.13.1 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0", - "react-router-dom": "^6.0.0" - }, - "devDependencies": { - "@backstage/cli": "0.28.2", - "@backstage/core-app-api": "1.15.1", - "@backstage/dev-utils": "1.1.2", - "@backstage/test-utils": "1.7.0", - "@playwright/test": "1.45.3", - "@redhat-developer/red-hat-developer-hub-theme": "0.4.0", - "@testing-library/jest-dom": "6.4.8", - "@testing-library/react": "14.3.1", - "@testing-library/react-hooks": "8.0.1", - "@testing-library/user-event": "14.5.2", - "@types/node": "18.19.34", - "cross-fetch": "4.0.0", - "msw": "1.3.3", - "prettier": "3.3.3", - "start-server-and-test": "2.0.8" - }, - "files": [ - "dist", - "dist-scalprum", - "app-config.janus-idp.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/tekton" - }, - "keywords": [ - "support:production", - "lifecycle:active", - "backstage", - "plugin" - ], - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "maintainers": [ - "@janus-idp/rhtap" - ], - "author": "Red Hat" -} diff --git a/plugins/tekton/playwright.config.ts b/plugins/tekton/playwright.config.ts deleted file mode 100644 index 0802a5e45d..0000000000 --- a/plugins/tekton/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test'; - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, - /* Run tests in sequence. */ - workers: 1, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: process.env.CI ? 'github' : 'list', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - baseURL: process.env.PLUGIN_BASE_URL || 'http://localhost:3000', - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - screenshot: 'only-on-failure', - video: 'retain-on-failure', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}); diff --git a/plugins/tekton/src/__fixtures__/1-pipelinesData.ts b/plugins/tekton/src/__fixtures__/1-pipelinesData.ts deleted file mode 100644 index 17335fd502..0000000000 --- a/plugins/tekton/src/__fixtures__/1-pipelinesData.ts +++ /dev/null @@ -1,1243 +0,0 @@ -import { - acsDeploymentCheckTaskRun, - acsImageCheckTaskRun, - acsImageScanTaskRun, - enterpriseContractTaskRun, - taskRunWithSBOMResult, - taskRunWithSBOMResultExternalLink, -} from './taskRunData'; - -export const mockKubernetesPlrResponse = { - pods: [ - { - metadata: { - name: 'pipeline-test-wbvtlk-tkn-pod', - namespace: 'karthik', - uid: 'bd868fde-1b37-4168-a780-f1772c5924e3', - resourceVersion: '379524', - labels: { - 'app.kubernetes.io/managed-by': 'tekton-pipelines', - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/clusterTask': 'tkn', - 'tekton.dev/memberOf': 'tasks', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'pipeline-test-wbvtlk', - 'tekton.dev/pipelineTask': 'tkn', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-task1', - }, - }, - spec: { - volumes: [ - { - name: 'tekton-internal-workspace', - emptyDir: {}, - }, - ], - containers: [ - { - name: 'step-tkn', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - startTime: new Date('2023-12-08T12:19:29Z'), - }, - }, - { - metadata: { - name: 'ruby-ex-git-xf45fo-build-pod', - generateName: 'ruby-ex-git-66d547b559-', - namespace: 'jai-test', - uid: 'cec5c859-3557-49aa-89db-d287f94d1ad8', - resourceVersion: '87565', - creationTimestamp: new Date('2023-03-30T07:04:54Z'), - labels: { - app: 'ruby-ex-git', - 'backstage.io/kubernetes-id': 'backstage', - deployment: 'ruby-ex-git', - 'pod-template-hash': '66d547b559', - 'tekton.dev/pipelineRun': 'ruby-ex-git-xf45fo', - 'tekton.dev/pipelineTask': 'build', - }, - ownerReferences: [ - { - apiVersion: 'apps/v1', - kind: 'ReplicaSet', - name: 'ruby-ex-git-66d547b559', - uid: '8a781d94-c73d-4f07-8d1f-b797db949e4a', - controller: true, - blockOwnerDeletion: true, - }, - ], - }, - spec: { - volumes: [ - { - name: 'kube-api-access-hzpnl', - projected: { - sources: [ - { - serviceAccountToken: { - expirationSeconds: 3607, - path: 'token', - }, - }, - { - configMap: { - name: 'kube-root-ca.crt', - items: [ - { - key: 'ca.crt', - path: 'ca.crt', - }, - ], - }, - }, - { - downwardAPI: { - items: [ - { - path: 'namespace', - fieldRef: { - apiVersion: 'v1', - fieldPath: 'metadata.namespace', - }, - }, - ], - }, - }, - { - configMap: { - name: 'openshift-service-ca.crt', - items: [ - { - key: 'service-ca.crt', - path: 'service-ca.crt', - }, - ], - }, - }, - ], - defaultMode: 420, - }, - }, - ], - containers: [ - { - name: 'ruby-ex-git', - image: - 'image-registry.openshift-image-registry.svc:5000/jai-test/ruby-ex-git@sha256:ade428dd4cb303a2ab9f1e0d5a6a86d6c035655d14f989e856f11bf3baef9bf2', - ports: [ - { - containerPort: 8080, - protocol: 'TCP', - }, - ], - resources: {}, - volumeMounts: [ - { - name: 'kube-api-access-hzpnl', - readOnly: true, - mountPath: '/var/run/secrets/kubernetes.io/serviceaccount', - }, - ], - terminationMessagePath: '/dev/termination-log', - terminationMessagePolicy: 'File', - imagePullPolicy: 'Always', - securityContext: { - capabilities: { - drop: ['ALL'], - }, - runAsUser: 1000690000, - runAsNonRoot: true, - allowPrivilegeEscalation: false, - }, - }, - ], - restartPolicy: 'Always', - terminationGracePeriodSeconds: 30, - dnsPolicy: 'ClusterFirst', - serviceAccountName: 'default', - serviceAccount: 'default', - nodeName: 'ip-10-0-170-221.us-east-2.compute.internal', - securityContext: { - seLinuxOptions: { - level: 's0:c26,c20', - }, - fsGroup: 1000690000, - seccompProfile: { - type: 'RuntimeDefault', - }, - }, - imagePullSecrets: [ - { - name: 'default-dockercfg-wtjl6', - }, - ], - schedulerName: 'default-scheduler', - tolerations: [ - { - key: 'node.kubernetes.io/not-ready', - operator: 'Exists', - effect: 'NoExecute', - tolerationSeconds: 300, - }, - { - key: 'node.kubernetes.io/unreachable', - operator: 'Exists', - effect: 'NoExecute', - tolerationSeconds: 300, - }, - ], - priority: 0, - enableServiceLinks: true, - preemptionPolicy: 'PreemptLowerPriority', - }, - status: { - phase: 'Running', - conditions: [ - { - type: 'Initialized', - status: 'True', - lastProbeTime: null, - lastTransitionTime: '2023-03-30T07:04:54Z', - }, - { - type: 'Ready', - status: 'True', - lastProbeTime: null, - lastTransitionTime: '2023-03-30T07:05:12Z', - }, - { - type: 'ContainersReady', - status: 'True', - lastProbeTime: null, - lastTransitionTime: '2023-03-30T07:05:12Z', - }, - { - type: 'PodScheduled', - status: 'True', - lastProbeTime: null, - lastTransitionTime: '2023-03-30T07:04:54Z', - }, - ], - startTime: '2023-03-30T07:04:54Z', - containerStatuses: [ - { - name: 'ruby-ex-git', - state: { - running: { - startedAt: '2023-03-30T07:05:11Z', - }, - }, - lastState: {}, - ready: true, - restartCount: 0, - image: - 'image-registry.openshift-image-registry.svc:5000/jai-test/ruby-ex-git@sha256:ade428dd4cb303a2ab9f1e0d5a6a86d6c035655d14f989e856f11bf3baef9bf2', - imageID: - 'image-registry.openshift-image-registry.svc:5000/jai-test/ruby-ex-git@sha256:ade428dd4cb303a2ab9f1e0d5a6a86d6c035655d14f989e856f11bf3baef9bf2', - containerID: - 'cri-o://85af7fd408b95c3800ea83349541f10bf888903d0a1e19378489724b9a718607', - started: true, - }, - ], - qosClass: 'BestEffort', - }, - }, - { - metadata: { - name: 'pipelineRun-ec-task-t237ev-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-three', - 'tekton.dev/pipelineTask': 'scan-task', - 'tekton.dev/task': 'scan-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-scan-task', - }, - }, - spec: { - containers: [ - { - name: 'step-ec-report', - }, - ], - }, - status: { - phase: 'Running', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - { - metadata: { - name: 'pipelineRun-ec-task-t237ev-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-8e09zm', - 'tekton.dev/pipelineTask': 'sbom-task', - 'tekton.dev/task': 'sbom-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-ec-report', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - { - metadata: { - name: 'pipelineRun-image-scan-task-t237ev-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-8e09zm', - 'tekton.dev/pipelineTask': 'sbom-task', - 'tekton.dev/task': 'sbom-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-print-scan-results', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - { - metadata: { - name: 'pipelineRun-image-check-task-t237ev-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-8e09zm', - 'tekton.dev/pipelineTask': 'sbom-task', - 'tekton.dev/task': 'sbom-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-print-scan-results', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - { - metadata: { - name: 'pipelineRun-deployment-check-task-t237ev-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-8e09zm', - 'tekton.dev/pipelineTask': 'sbom-task', - 'tekton.dev/task': 'sbom-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-print-scan-results', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - { - metadata: { - name: 'pipelinerun-with-sbom-task-t237ev-sbom-task-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'pipelinerun-with-sbom-task', - 'tekton.dev/pipelineTask': 'sbom-task', - 'tekton.dev/task': 'sbom-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-print-sbom-results', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - { - metadata: { - name: 'pipelinerun-with-sbom-task-with-external-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'pipelinerun-with-external-sbom-task', - 'tekton.dev/pipelineTask': 'sbom-task-with-external-link', - 'tekton.dev/task': 'sbom-task-with-external-link', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-print-sbom-results', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - ], - pipelineruns: [ - { - apiVersion: 'tekton.dev/v1', - kind: 'PipelineRun', - metadata: { - annotations: { - 'chains.tekton.dev/signed': 'true', - 'pipeline.openshift.io/started-by': 'kube:admin', - }, - creationTimestamp: new Date('2023-03-30T07:03:04Z'), - generation: 1, - labels: { - 'app.kubernetes.io/instance': 'ruby-ex-git', - 'app.kubernetes.io/name': 'ruby-ex-git', - 'backstage.io/kubernetes-id': 'backstage', - 'operator.tekton.dev/operand-name': 'openshift-pipelines-addons', - 'pipeline.openshift.io/runtime': 'ruby', - 'pipeline.openshift.io/runtime-version': '3.0-ubi7', - 'pipeline.openshift.io/type': 'kubernetes', - 'tekton.dev/pipeline': 'ruby-ex-git', - }, - name: 'ruby-ex-git-xf45fo', - namespace: 'jai-test', - resourceVersion: '87613', - uid: 'b7584993-146c-4d4d-ba39-8619237e940b', - }, - spec: { - params: [], - pipelineRef: { - name: 'ruby-ex-git', - }, - serviceAccountName: 'pipeline', - timeout: '1h0m0s', - workspaces: [], - }, - status: { - completionTime: '2023-03-30T07:05:13Z', - conditions: [ - { - lastTransitionTime: '2023-03-30T07:05:13Z', - message: 'Tasks Completed: 3 (Failed: 0, Cancelled 0), Skipped: 0', - status: 'Unknown', - type: 'Succeeded', - }, - ], - pipelineSpec: { - params: [], - tasks: [ - { - name: 'fetch-repository', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'git-clone', - }, - workspaces: [], - }, - { - name: 'build', - params: [], - runAfter: ['fetch-repository'], - taskRef: { - kind: 'ClusterTask', - name: 's2i-ruby', - }, - workspaces: [], - }, - { - name: 'deploy', - params: [], - runAfter: ['build'], - taskRef: { - kind: 'ClusterTask', - name: 'openshift-client', - }, - }, - ], - workspaces: [], - }, - startTime: '2023-03-30T07:03:04Z', - }, - }, - { - apiVersion: 'tekton.dev/v1', - kind: 'PipelineRun', - metadata: { - annotations: { - 'pipeline.openshift.io/started-by': 'kube-admin', - 'chains.tekton.dev/signed': 'false', - }, - labels: { - 'backstage.io/kubernetes-id': 'test-backstage', - 'tekton.dev/pipeline': 'pipeline-test', - 'app.kubernetes.io/instance': 'abs', - 'app.kubernetes.io/name': 'ghg', - 'operator.tekton.dev/operand-name': 'ytui', - 'pipeline.openshift.io/runtime-version': 'hjkhk', - 'pipeline.openshift.io/type': 'hhu', - 'pipeline.openshift.io/runtime': 'node', - }, - name: 'pipeline-test-wbvtlk', - namespace: 'deb-test', - resourceVersion: '117337', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a9a24', - creationTimestamp: new Date('2023-04-11T12:31:56Z'), - }, - spec: { - pipelineRef: { - name: 'pipeline-test', - }, - serviceAccountName: 'pipeline', - workspaces: [], - }, - status: { - completionTime: '2023-04-11T06:49:05Z', - conditions: [ - { - lastTransitionTime: '2023-04-11T06:49:05Z', - message: 'Tasks Completed: 4 (Failed: 3, Cancelled 0), Skipped: 0', - reason: 'Failed', - status: 'False', - type: 'Succeeded', - }, - ], - pipelineSpec: { - finally: [ - { - name: 'git-clone', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'git-clone', - }, - workspaces: [], - }, - ], - tasks: [ - { - name: 'buildah', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'buildah', - }, - workspaces: [], - }, - { - name: 'tkn', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'tkn', - }, - }, - { - name: 'argocd-task-sync-and-wait', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'argocd-task-sync-and-wait', - }, - }, - ], - workspaces: [], - startTime: '2023-04-11T06:48:50Z', - }, - startTime: '2023-04-11T05:49:05Z', - }, - }, - { - apiVersion: 'tekton.dev/v1', - kind: 'PipelineRun', - metadata: { - annotations: { - 'pipeline.openshift.io/started-by': 'kube-admin', - 'chains.tekton.dev/signed': 'false', - }, - labels: { - 'backstage.io/kubernetes-id': 'test-backstage', - 'tekton.dev/pipeline': 'pipeline-test', - 'app.kubernetes.io/instance': 'abs', - 'app.kubernetes.io/name': 'ghg', - 'operator.tekton.dev/operand-name': 'ytui', - 'pipeline.openshift.io/runtime-version': 'hjkhk', - 'pipeline.openshift.io/type': 'hhu', - 'pipeline.openshift.io/runtime': 'node', - }, - name: 'pipelinerun-with-scanner-task', - namespace: 'deb-test', - resourceVersion: '117337', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a9b14', - creationTimestamp: new Date('2023-04-11T12:31:56Z'), - }, - spec: { - pipelineRef: { - name: 'pipeline-test', - }, - serviceAccountName: 'pipeline', - workspaces: [], - }, - status: { - completionTime: '2023-04-11T06:49:05Z', - conditions: [ - { - lastTransitionTime: '2023-03-30T07:05:13Z', - message: 'Tasks Completed: 3 (Failed: 0, Cancelled 0), Skipped: 0', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - pipelineSpec: { - tasks: [ - { - name: 'scan-task', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'scan-task', - }, - workspaces: [], - }, - ], - workspaces: [], - startTime: '2023-04-11T06:48:50Z', - }, - results: [ - { - name: 'SCAN_OUTPUT', - value: - '{"vulnerabilities":{\n"critical": 13,\n"high": 29,\n"medium": 32,\n"low": 3,\n"unknown": 0},\n"unpatched_vulnerabilities": {\n"critical": 0,\n"high": 1,\n"medium": 0,\n"low":1}\n}\n', - }, - ], - startTime: '2023-04-11T05:49:05Z', - }, - }, - { - apiVersion: 'tekton.dev/v1', - kind: 'PipelineRun', - metadata: { - annotations: { - 'pipeline.openshift.io/started-by': 'kube-admin', - 'chains.tekton.dev/signed': 'false', - }, - labels: { - 'backstage.io/kubernetes-id': 'test-backstage', - 'tekton.dev/pipeline': 'pipeline-test', - 'app.kubernetes.io/instance': 'abs', - 'app.kubernetes.io/name': 'ghg', - 'operator.tekton.dev/operand-name': 'ytui', - 'pipeline.openshift.io/runtime-version': 'hjkhk', - 'pipeline.openshift.io/type': 'hhu', - 'pipeline.openshift.io/runtime': 'node', - }, - name: 'pipelinerun-with-sbom-task', - namespace: 'deb-test', - resourceVersion: '117337', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a8b24', - creationTimestamp: new Date('2023-04-11T12:31:56Z'), - }, - spec: { - pipelineRef: { - name: 'pipeline-test', - }, - serviceAccountName: 'pipeline', - workspaces: [], - }, - status: { - completionTime: '2023-04-11T06:49:05Z', - conditions: [ - { - lastTransitionTime: '2023-03-30T07:05:13Z', - message: 'Tasks Completed: 3 (Failed: 0, Cancelled 0), Skipped: 0', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - pipelineSpec: { - tasks: [ - { - name: 'sbom-task', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'sbom-task', - }, - workspaces: [], - }, - ], - workspaces: [], - startTime: '2023-04-11T06:48:50Z', - }, - startTime: '2023-04-11T05:49:05Z', - }, - }, - { - apiVersion: 'tekton.dev/v1', - kind: 'PipelineRun', - metadata: { - annotations: { - 'pipeline.openshift.io/started-by': 'kube-admin', - 'chains.tekton.dev/signed': 'false', - }, - labels: { - 'backstage.io/kubernetes-id': 'test-backstage', - 'tekton.dev/pipeline': 'pipeline-test', - 'app.kubernetes.io/instance': 'abs', - 'app.kubernetes.io/name': 'ghg', - 'operator.tekton.dev/operand-name': 'ytui', - 'pipeline.openshift.io/runtime-version': 'hjkhk', - 'pipeline.openshift.io/type': 'hhu', - 'pipeline.openshift.io/runtime': 'node', - }, - name: 'pipelinerun-with-external-sbom-task', - namespace: 'deb-test', - resourceVersion: '117337', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a9b26', - creationTimestamp: new Date('2023-04-11T12:31:56Z'), - }, - spec: { - pipelineRef: { - name: 'pipeline-test', - }, - serviceAccountName: 'pipeline', - workspaces: [], - }, - status: { - completionTime: '2023-04-11T06:49:05Z', - conditions: [ - { - lastTransitionTime: '2023-03-30T07:05:13Z', - message: 'Tasks Completed: 3 (Failed: 0, Cancelled 0), Skipped: 0', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - pipelineSpec: { - tasks: [ - { - name: 'sbom-task-with-external-link', - params: [], - taskRef: { - kind: 'ClusterTask', - name: 'sbom-task-with-external-link', - }, - workspaces: [], - }, - ], - workspaces: [], - startTime: '2023-04-11T06:48:50Z', - }, - pipelineResults: [ - { - name: 'MY_SCAN_OUTPUT', - value: - '{"vulnerabilities":{\n"critical": 1,\n"high": 9,\n"medium": 20,\n"low": 1,\n"unknown": 0},\n"unpatched_vulnerabilities": {\n"critical": 0,\n"high": 1,\n"medium": 0,\n"low":1}\n}\n', - }, - ], - startTime: '2023-04-11T05:49:05Z', - }, - }, - ], - taskruns: [ - { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - annotations: { - 'operator.tekton.dev/last-applied-hash': - '63911846cb698608618c9a280f25b886ea3ee59f84a4ef6da15738a699e09f0c', - 'pipeline.openshift.io/started-by': 'kube:admin', - 'pipeline.tekton.dev/release': '9ec444e', - 'tekton.dev/displayName': 's2i ruby', - 'tekton.dev/pipelines.minVersion': '0.19', - 'tekton.dev/tags': 's2i, ruby, workspace', - }, - creationTimestamp: new Date('2023-03-30T07:03:20Z'), - generation: 1, - labels: { - 'app.kubernetes.io/instance': 'ruby-ex-git', - 'app.kubernetes.io/managed-by': 'tekton-pipelines', - 'app.kubernetes.io/name': 'ruby-ex-git', - 'app.kubernetes.io/version': '0.1', - 'backstage.io/kubernetes-id': 'backstage', - 'operator.tekton.dev/operand-name': 'openshift-pipelines-addons', - 'operator.tekton.dev/provider-type': 'redhat', - 'pipeline.openshift.io/runtime': 'ruby', - 'pipeline.openshift.io/runtime-version': '3.0-ubi7', - 'pipeline.openshift.io/type': 'kubernetes', - 'tekton.dev/clusterTask': 's2i-ruby', - 'tekton.dev/memberOf': 'tasks', - 'tekton.dev/pipeline': 'ruby-ex-git', - 'tekton.dev/pipelineRun': 'ruby-ex-git-xf45fo', - 'tekton.dev/pipelineTask': 'build', - }, - name: 'ruby-ex-git-xf45fo-build', - namespace: 'jai-test', - ownerReferences: [ - { - apiVersion: 'tekton.dev/v1', - blockOwnerDeletion: true, - controller: true, - kind: 'PipelineRun', - name: 'ruby-ex-git-xf45fo', - uid: 'b7584993-146c-4d4d-ba39-8619237e940b', - }, - ], - resourceVersion: '87287', - uid: 'e8d42c4a-b9c7-4f56-9482-d17f2c861804', - }, - spec: { - params: [], - resources: [], - serviceAccountName: 'pipeline', - taskRef: { - kind: 'ClusterTask', - name: 's2i-ruby', - }, - timeout: '1h0m0s', - workspaces: [ - { - name: 'source', - persistentVolumeClaim: { - claimName: 'pvc-f7934bb0ae', - }, - }, - ], - }, - status: { - completionTime: '2023-03-30T07:04:55Z', - conditions: [ - { - lastTransitionTime: '2023-03-30T07:04:55Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'Unknown', - type: 'Succeeded', - }, - ], - podName: 'ruby-ex-git-xf45fo-build-pod', - startTime: '2023-03-30T07:03:20Z', - steps: [ - { - container: 'step-generate', - imageID: - 'registry.redhat.io/ocp-tools-4-tech-preview/source-to-image-rhel8@sha256:98d8cb3a255641ca6a1bce854e5e2460c20de9fb9b28e3cc67eb459f122873dd', - name: 'generate', - terminated: { - containerID: - 'cri-o://3b490fe8f5ed9310fa7b322961e2069b3548a6a8134693ef78c12c8c0760ea0c', - exitCode: 0, - finishedAt: '2023-03-30T07:03:30Z', - reason: 'Completed', - startedAt: '2023-03-30T07:03:30Z', - }, - }, - { - container: 'step-build-and-push', - imageID: - 'registry.redhat.io/rhel8/buildah@sha256:7678ad61e06e442b0093ab73faa73ce536721ae523015dd942f9196c4699a31d', - name: 'build-and-push', - terminated: { - containerID: - 'cri-o://90521ea2114ca3fc6b54216fe8cff26b679788d1c87dee40b98caa90f71e140e', - exitCode: 0, - finishedAt: '2023-03-30T07:04:54Z', - message: - '[{"key":"IMAGE_DIGEST","value":"sha256:14e0715ec241926c081124345cd45d325a44d914261cfd642b3b0969a49ffe02","type":1}]', - reason: 'Completed', - startedAt: '2023-03-30T07:03:30Z', - }, - }, - ], - taskResults: [ - { - name: 'IMAGE_DIGEST', - type: 'string', - value: - 'sha256:14e0715ec241926c081124345cd45d325a44d914261cfd642b3b0969a49ffe02', - }, - ], - taskSpec: { - description: - 's2i-ruby task clones a Git repository and builds and pushes a container image using S2I and a Ruby builder image.', - params: [], - results: [ - { - description: 'Digest of the image just built.', - name: 'IMAGE_DIGEST', - type: 'string', - }, - ], - steps: [ - { - env: [], - image: - 'registry.redhat.io/ocp-tools-4-tech-preview/source-to-image-rhel8@sha256:98d8cb3a255641ca6a1bce854e5e2460c20de9fb9b28e3cc67eb459f122873dd', - name: 'generate', - resources: {}, - script: 'echo', - volumeMounts: [ - { - mountPath: '/gen-source', - name: 'gen-source', - }, - { - mountPath: '/env-vars', - name: 'env-vars', - }, - ], - workingDir: '/workspace/source', - }, - { - image: - 'registry.redhat.io/rhel8/buildah@sha256:ac0b8714cc260c94435cab46fe41b3de0ccbc3d93e38c395fa9d52ac49e521fe', - name: 'build-and-push', - resources: {}, - script: 'echo', - securityContext: { - capabilities: { - add: ['SETFCAP'], - }, - }, - volumeMounts: [ - { - mountPath: '/var/lib/containers', - name: 'varlibcontainers', - }, - { - mountPath: '/gen-source', - name: 'gen-source', - }, - ], - workingDir: '/gen-source', - }, - ], - volumes: [ - { - emptyDir: {}, - name: 'varlibcontainers', - }, - { - emptyDir: {}, - name: 'gen-source', - }, - { - emptyDir: {}, - name: 'env-vars', - }, - ], - workspaces: [], - }, - }, - }, - { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - annotations: { - 'operator.tekton.dev/last-applied-hash': 'undefined', - 'pipeline.openshift.io/started-by': 'undefined', - 'pipeline.tekton.dev/release': 'undefined', - 'tekton.dev/displayName': 'undefined', - 'tekton.dev/pipelines.minVersion': 'undefined', - 'tekton.dev/tags': 'undefined', - }, - creationTimestamp: new Date('2023-04-11T06:48:50Z'), - generation: 1, - labels: { - 'app.kubernetes.io/managed-by': 'tekton-pipelines', - 'app.kubernetes.io/version': '0.4', - 'backstage.io/kubernetes-id': 'test-backstage', - 'operator.tekton.dev/operand-name': 'openshift-pipelines-addons', - 'operator.tekton.dev/provider-type': 'redhat', - 'tekton.dev/clusterTask': 'scan-task', - 'tekton.dev/memberOf': 'tasks', - 'tekton.dev/pipeline': 'pipeline-test', - 'tekton.dev/pipelineRun': 'pipelinerun-with-scanner-task', - 'tekton.dev/pipelineTask': 'scan-task', - 'app.kubernetes.io/instance': 'xyz', - 'app.kubernetes.io/name': 'xyz', - 'pipeline.openshift.io/runtime': 'node', - 'pipeline.openshift.io/runtime-version': 'gh', - 'pipeline.openshift.io/type': 'abc', - }, - name: 'pipeline-test-wbvtlk-scan-task', - namespace: 'deb-test', - ownerReferences: [ - { - apiVersion: 'tekton.dev/v1', - blockOwnerDeletion: true, - controller: true, - kind: 'PipelineRun', - name: 'pipelinerun-with-scanner-task', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a9t24', - }, - ], - resourceVersion: '117189', - uid: 'cb08cb7d-71fc-48a7-888f-4ad14a7277b9', - }, - spec: { - params: [], - resources: [], - serviceAccountName: 'pipeline', - taskRef: { - kind: 'ClusterTask', - name: 'scan-task', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-04-11T06:48:56Z', - conditions: [ - { - lastTransitionTime: '2023-04-11T06:48:56Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipelineRun-ec-task-t237ev-pod', - startTime: '2023-04-11T06:48:50Z', - steps: [ - { - container: 'step-tkn', - imageID: - 'registry.redhat.io/openshift-pipelines/pipelines-cli-tkn-rhel8@sha256:c73cefdd22522b2309f02dfa9858ed9079f1d5c94a3cd850f3f96dfbeafebc64', - name: 'tkn', - terminated: { - containerID: - 'cri-o://53fbddbb25c08e97d0061a3dd79021e8d411485bbc3f18cfcffd41ae3448c0d2', - exitCode: 0, - finishedAt: '2023-04-11T06:48:56Z', - reason: 'Completed', - startedAt: '2023-04-11T06:48:56Z', - }, - }, - ], - taskSpec: { - description: - 'This task performs operations on Tekton resources using tkn', - params: [], - steps: [ - { - args: ['--help'], - env: [], - image: - 'registry.redhat.io/openshift-pipelines/pipelines-cli-tkn-rhel8@sha256:c73cefdd22522b2309f02dfa9858ed9079f1d5c94a3cd850f3f96dfbeafebc64', - name: 'tkn', - resources: {}, - script: - 'if [ "false" = "true" ] && [ -e /kubeconfig ]; then\n export KUBECONFIG=""/kubeconfig\nfi\n\neval "tkn $@"\n', - securityContext: { - runAsNonRoot: true, - runAsUser: 65532, - }, - }, - ], - workspaces: [], - }, - }, - }, - { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - annotations: { - 'operator.tekton.dev/last-applied-hash': 'undefined', - 'pipeline.openshift.io/started-by': 'undefined', - 'pipeline.tekton.dev/release': 'undefined', - 'tekton.dev/displayName': 'undefined', - 'tekton.dev/pipelines.minVersion': 'undefined', - 'tekton.dev/tags': 'undefined', - }, - creationTimestamp: new Date('2023-04-11T06:48:50Z'), - generation: 1, - labels: { - 'app.kubernetes.io/managed-by': 'tekton-pipelines', - 'app.kubernetes.io/version': '0.4', - 'backstage.io/kubernetes-id': 'test-backstage', - 'operator.tekton.dev/operand-name': 'openshift-pipelines-addons', - 'operator.tekton.dev/provider-type': 'redhat', - 'tekton.dev/clusterTask': 'tkn', - 'tekton.dev/memberOf': 'tasks', - 'tekton.dev/pipeline': 'pipeline-test', - 'tekton.dev/pipelineRun': 'pipeline-test-wbvtlk', - 'tekton.dev/pipelineTask': 'tkn', - 'app.kubernetes.io/instance': 'xyz', - 'app.kubernetes.io/name': 'xyz', - 'pipeline.openshift.io/runtime': 'node', - 'pipeline.openshift.io/runtime-version': 'gh', - 'pipeline.openshift.io/type': 'abc', - }, - name: 'pipeline-test-wbvtlk-tkn', - namespace: 'deb-test', - ownerReferences: [ - { - apiVersion: 'tekton.dev/v1', - blockOwnerDeletion: true, - controller: true, - kind: 'PipelineRun', - name: 'pipeline-test-wbvtlk', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a9b24', - }, - ], - resourceVersion: '117189', - uid: 'cb08cb7d-71fc-48a7-888f-4ad14a7277b9', - }, - spec: { - params: [], - resources: [], - serviceAccountName: 'pipeline', - taskRef: { - kind: 'ClusterTask', - name: 'tkn', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-04-11T06:48:56Z', - conditions: [ - { - lastTransitionTime: '2023-04-11T06:48:56Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipeline-test-wbvtlk-tkn-pod', - startTime: '2023-04-11T06:48:50Z', - steps: [ - { - container: 'step-tkn', - imageID: - 'registry.redhat.io/openshift-pipelines/pipelines-cli-tkn-rhel8@sha256:c73cefdd22522b2309f02dfa9858ed9079f1d5c94a3cd850f3f96dfbeafebc64', - name: 'tkn', - terminated: { - containerID: - 'cri-o://53fbddbb25c08e97d0061a3dd79021e8d411485bbc3f18cfcffd41ae3448c0d2', - exitCode: 0, - finishedAt: '2023-04-11T06:48:56Z', - reason: 'Completed', - startedAt: '2023-04-11T06:48:56Z', - }, - }, - ], - taskSpec: { - description: - 'This task performs operations on Tekton resources using tkn', - params: [], - steps: [ - { - args: ['--help'], - env: [], - image: - 'registry.redhat.io/openshift-pipelines/pipelines-cli-tkn-rhel8@sha256:c73cefdd22522b2309f02dfa9858ed9079f1d5c94a3cd850f3f96dfbeafebc64', - name: 'tkn', - resources: {}, - script: - 'if [ "false" = "true" ] && [ -e /kubeconfig ]; then\n export KUBECONFIG=""/kubeconfig\nfi\n\neval "tkn $@"\n', - securityContext: { - runAsNonRoot: true, - runAsUser: 65532, - }, - }, - ], - workspaces: [], - }, - }, - }, - taskRunWithSBOMResult, - taskRunWithSBOMResultExternalLink, - enterpriseContractTaskRun, - acsImageScanTaskRun, - acsImageCheckTaskRun, - acsDeploymentCheckTaskRun, - ], -}; diff --git a/plugins/tekton/src/__fixtures__/advancedClusterSecurityData.ts b/plugins/tekton/src/__fixtures__/advancedClusterSecurityData.ts deleted file mode 100644 index 3b20b544a4..0000000000 --- a/plugins/tekton/src/__fixtures__/advancedClusterSecurityData.ts +++ /dev/null @@ -1,207 +0,0 @@ -import { - ACSCheckResults, - ACSImageScanResult, -} from '@aonic-ui/pipelines/dist/esm/types/components/Output/types'; - -export const acsImageScanResult: ACSImageScanResult = { - result: { - summary: { - CRITICAL: 0, - IMPORTANT: 1, - LOW: 4, - MODERATE: 4, - 'TOTAL-COMPONENTS': 6, - 'TOTAL-VULNERABILITIES': 9, - }, - vulnerabilities: [ - { - cveId: 'CVE-2005-2945', - cveSeverity: 'LOW', - cveInfo: 'https://nvd.nist.gov/vuln/detail/CVE-2005-2945', - componentName: 'arc', - componentVersion: '3.5.0', - componentFixedVersion: '2.3.1', - }, - { - cveId: 'CVE-2005-2992', - cveSeverity: 'LOW', - cveInfo: 'https://nvd.nist.gov/vuln/detail/CVE-2005-2992', - componentName: 'arc', - componentVersion: '3.5.0', - componentFixedVersion: '1.7.1', - }, - { - cveId: 'CVE-2021-3468', - cveSeverity: 'MODERATE', - cveInfo: 'https://access.redhat.com/security/cve/CVE-2021-3468', - componentName: 'avahi-libs', - componentVersion: '0.7-20.el8.aarch64', - componentFixedVersion: '', - }, - - { - cveId: 'RHSA-2023:7029', - cveSeverity: 'MODERATE', - cveInfo: 'https://access.redhat.com/errata/RHSA-2023:7029', - componentName: 'libX11', - componentVersion: '1.6.8-5.el8.aarch64', - componentFixedVersion: '0:1.6.8-6.el8', - }, - { - cveId: 'CVE-2022-3555', - cveSeverity: 'LOW', - cveInfo: 'https://access.redhat.com/security/cve/CVE-2022-3555', - componentName: 'libX11', - componentVersion: '1.6.8-5.el8.aarch64', - componentFixedVersion: '', - }, - { - cveId: 'CVE-2022-3554', - cveSeverity: 'MODERATE', - cveInfo: 'https://access.redhat.com/security/cve/CVE-2022-3554', - componentName: 'libX11-common', - componentVersion: '1.6.8-5.el8.noarch', - componentFixedVersion: '', - }, - { - cveId: 'CVE-2023-43785', - cveSeverity: 'MODERATE', - cveInfo: 'https://access.redhat.com/security/cve/CVE-2023-43785', - componentName: 'libX11-common', - componentVersion: '1.6.8-5.el8.noarch', - componentFixedVersion: '', - }, - { - cveId: 'CVE-2019-9923', - cveSeverity: 'LOW', - cveInfo: 'https://access.redhat.com/security/cve/CVE-2019-9923', - componentName: 'tar', - componentVersion: '2:1.30-9.el8.aarch64', - componentFixedVersion: '', - }, - { - cveId: 'CVE-2023-4586', - cveSeverity: 'IMPORTANT', - cveInfo: 'https://nvd.nist.gov/vuln/detail/CVE-2023-4586', - componentName: 'netty', - componentVersion: '4.1.100.final', - componentFixedVersion: '5.0.0', - }, - ], - }, -}; - -export const acsImageCheckResults: ACSCheckResults = { - results: [ - { - metadata: { - id: 'quay.io/bsutter/quarkus-demo:v2', - additionalInfo: { - name: 'quay.io/bsutter/quarkus-demo:v2', - type: 'image', - }, - }, - summary: { - CRITICAL: 0, - HIGH: 1, - LOW: 1, - MEDIUM: 0, - TOTAL: 2, - }, - violatedPolicies: [ - { - name: 'Fixable Severity at least Important', - severity: 'HIGH', - description: - 'Alert on deployments with fixable vulnerabilities with a Severity Rating at least Important', - violation: [ - "Fixable CVE-2023-6394 (CVSS 9.1) (severity Critical) found in component 'quarkus' (version 3.5.0), resolved by version 3.6.0", - ], - remediation: - 'Use your package manager to update to a fixed version in future builds or speak with your security team to mitigate the vulnerabilities.', - failingCheck: true, - }, - { - name: 'Red Hat Package Manager in Image', - severity: 'LOW', - description: - 'Alert on deployments with components of the Red Hat/Fedora/CentOS package management system.', - violation: [ - "Image includes component 'microdnf' (version 3.8.0-2.el8.aarch64)", - "Image includes component 'rpm' (version 4.14.3-26.el8.aarch64)", - ], - remediation: - "Run `rpm -e --nodeps $(rpm -qa '*rpm*' '*dnf*' '*libsolv*' '*hawkey*' 'yum*')` in the image build for production containers.", - failingCheck: false, - }, - ], - }, - ], - summary: { - CRITICAL: 0, - HIGH: 1, - LOW: 1, - MEDIUM: 0, - TOTAL: 2, - }, -}; - -export const acsDeploymentCheck: ACSCheckResults = { - results: [ - { - metadata: { - id: '2c4150a8-b7bf-46bb-89fc-84d09b345b2f', - additionalInfo: { - name: 'nodejs-ex', - namespace: 'test-namespace', - type: 'Deployment', - }, - }, - summary: { - CRITICAL: 0, - HIGH: 0, - LOW: 0, - MEDIUM: 2, - TOTAL: 2, - }, - violatedPolicies: [ - { - name: 'No resource requests or limits specified', - severity: 'MEDIUM', - description: - 'Alert on deployments that have containers without resource requests and limits', - violation: [ - "CPU limit set to 0 cores for container 'nodejs-ex'", - "CPU request set to 0 cores for container 'nodejs-ex'", - "Memory limit set to 0 MB for container 'nodejs-ex'", - "Memory request set to 0 MB for container 'nodejs-ex'", - ], - remediation: - 'Specify the requests and limits of CPU and Memory for your deployment.', - failingCheck: true, - }, - { - name: 'Pod Service Account Token Automatically Mounted', - severity: 'MEDIUM', - description: - 'Protect pod default service account tokens from compromise by minimizing the mounting of the default service account token to only those pods whose application requires interaction with the Kubernetes API.', - violation: [ - 'Deployment mounts the service account tokens.', - "Namespace has name 'prabhu'", - "Service Account is set to 'default'", - ], - remediation: - "Add `automountServiceAccountToken: false` or a value distinct from 'default' for the `serviceAccountName` key to the deployment's Pod configuration.", - failingCheck: false, - }, - ], - }, - ], - summary: { - CRITICAL: 0, - HIGH: 0, - LOW: 0, - MEDIUM: 2, - TOTAL: 2, - }, -}; diff --git a/plugins/tekton/src/__fixtures__/enterpriseContractData.ts b/plugins/tekton/src/__fixtures__/enterpriseContractData.ts deleted file mode 100644 index 7c8a57af5a..0000000000 --- a/plugins/tekton/src/__fixtures__/enterpriseContractData.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { EnterpriseContractResult } from '@aonic-ui/pipelines'; - -export const enterpriseContractResult: EnterpriseContractResult = { - success: false, - components: [ - { - name: 'Unnamed', - containerImage: - 'quay-q8tg2.apps.cluster-q8tg2.sandbox1329.opentlc.com/quayadmin/sbtestapp@sha256:bb1fcefb952b9f0b6c0c6fe9e84ea8a20fd828a2744dfbd1a9cb164d85507e12', - violations: [ - { - msg: - 'No image attestations found matching the given public key. Verify the correct public key was provided, and one or more attestations were created. Error: no matching attestations: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY\n' + - ' no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY', - metadata: { - collections: [], - code: 'builtin.attestation.signature_check', - description: - 'The attestation signature matches available signing materials.', - title: 'Attestation signature check passed', - }, - }, - - { - msg: 'No image signatures found matching the given public key. Verify the correct public key was provided, and a signature was created. Error: no matching signatures: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY', - metadata: { - collections: [], - code: 'builtin.image.signature_check', - description: - 'The image signature matches available signing materials.', - title: 'Image signature check passed', - }, - }, - ], - warnings: [ - { - msg: - 'No image attestations found matching the given public key. Verify the correct public key was provided, and one or more attestations were created. Error: no matching attestations: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY\n' + - ' no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY', - metadata: { - collections: [], - code: 'builtin.attestation.signature_check', - description: - 'The attestation signature matches available signing materials.', - title: 'Attestation signature check passed', - }, - }, - ], - successes: [ - { - msg: - 'No image attestations found matching the given public key. Verify the correct public key was provided, and one or more attestations were created. Error: no matching attestations: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY\n' + - ' no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY', - metadata: { - collections: [], - code: 'builtin.attestation.signature_check', - description: - 'The attestation signature matches available signing materials.', - title: 'Attestation signature check passed', - }, - }, - ], - success: false, - }, - ], - - key: - '-----BEGIN PUBLIC KEY-----\n' + - 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEufoDqiDhIyBmgFLdbgZugfk0qJSx\n' + - 'mF3EqQuuhU1gMlQiAs2kWVHEc/SKyp4/ktaG3ktLgAhids7RfqDm7iAgGg==\n' + - '-----END PUBLIC KEY-----\n' + - '', - policy: { - configuration: { - collections: [], - exclude: [], - }, - description: - 'Includes rules for levels 1, 2 & 3 of SLSA v0.1. This is the default config used for new RHTAP applications. Available collections are defined in https://redhat-appstudio.github.io/docs.stonesoup.io/ec-policies/release_policy.html#_available_rule_collections. If a different policy configuration is desired, this resource can serve as a starting point. See the docs on how to include and exclude rules https://redhat-appstudio.github.io/docs.stonesoup.io/ec-policies/policy_configuration.html#_including_and_excluding_rules.', - sources: [ - { - name: 'Default', - policy: [ - 'github.com/enterprise-contract/ec-policies//policy/lib', - 'github.com/enterprise-contract/ec-policies//policy/release', - ], - data: [ - 'oci::quay.io/redhat-appstudio-tekton-catalog/data-acceptable-bundles:latest', - 'github.com/release-engineering/rhtap-ec-policy//data', - ], - }, - ], - publicKey: '/workspace/cosign.pub', - }, -}; diff --git a/plugins/tekton/src/__fixtures__/kubernetesObject.ts b/plugins/tekton/src/__fixtures__/kubernetesObject.ts deleted file mode 100644 index 1891dcf9d3..0000000000 --- a/plugins/tekton/src/__fixtures__/kubernetesObject.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common'; - -import { mockKubernetesPlrResponse } from './1-pipelinesData'; - -export const kubernetesObjects: ObjectsByEntityResponse = { - items: [ - { - cluster: { - name: 'minikube', - }, - podMetrics: [], - resources: [ - { - type: 'pods', - resources: mockKubernetesPlrResponse.pods as any, - }, - { - type: 'customresources', - resources: mockKubernetesPlrResponse.pipelineruns, - }, - { - type: 'customresources', - resources: [], - }, - ], - errors: [], - }, - { - cluster: { - name: 'ocp', - }, - podMetrics: [], - resources: [ - { - type: 'customresources', - resources: [], - }, - { - type: 'customresources', - resources: [], - }, - ], - errors: [], - }, - ], -}; diff --git a/plugins/tekton/src/__fixtures__/kubernetesObjects.ts b/plugins/tekton/src/__fixtures__/kubernetesObjects.ts deleted file mode 100644 index 3a540bde50..0000000000 --- a/plugins/tekton/src/__fixtures__/kubernetesObjects.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common'; - -import { mockKubernetesPlrResponse } from './1-pipelinesData'; - -export const kubernetesObjects: ObjectsByEntityResponse = { - items: [ - { - cluster: { - name: 'minikube', - }, - podMetrics: [], - resources: [ - { - type: 'customresources', - resources: mockKubernetesPlrResponse.pipelineruns, - }, - { - type: 'customresources', - resources: [], - }, - ], - errors: [], - }, - { - cluster: { - name: 'ocp', - }, - podMetrics: [], - resources: [ - { - type: 'customresources', - resources: [], - }, - { - type: 'customresources', - resources: [], - }, - ], - errors: [], - }, - ], -}; diff --git a/plugins/tekton/src/__fixtures__/pods-data.ts b/plugins/tekton/src/__fixtures__/pods-data.ts deleted file mode 100644 index 0160681212..0000000000 --- a/plugins/tekton/src/__fixtures__/pods-data.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { V1Pod } from '@kubernetes/client-node'; - -import { PipelineRunKind } from '@janus-idp/shared-react'; - -export const testPipelineRun: PipelineRunKind = { - apiVersion: 'tekton.dev/v1', - kind: 'PipelineRun', - metadata: { - name: 'test-pipeline-8e09zm', - uid: '17080e46-1ff6-4f15-99e9-e32f603d7cc8', - creationTimestamp: new Date('2023-12-12T06:38:29Z'), - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/build-namespace': 'karthik', - 'tekton.dev/pipeline': 'new-pipeline', - }, - }, - spec: { - pipelineRef: { - name: 'new-pipeline', - }, - }, - status: { - completionTime: '2023-12-12T06:39:12Z', - pipelineSpec: { tasks: [] }, - conditions: [ - { - lastTransitionTime: '2023-12-12T06:39:12Z', - message: 'Tasks Completed: 3 (Failed: 0, Cancelled 0), Skipped: 0', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - startTime: '2023-12-12T06:38:29Z', - }, -}; - -export const testPods: V1Pod[] = [ - { - metadata: { - name: 'test-pipeline-8e09zm-task1-pod', - namespace: 'karthik', - uid: 'bd868fde-1b37-4168-a780-f1772c5924e3', - resourceVersion: '379524', - labels: { - 'app.kubernetes.io/managed-by': 'tekton-pipelines', - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/clusterTask': 'tkn', - 'tekton.dev/memberOf': 'tasks', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-8e09zm', - 'tekton.dev/pipelineTask': 'task1', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-task1', - }, - }, - spec: { - volumes: [ - { - name: 'tekton-internal-workspace', - emptyDir: {}, - }, - ], - containers: [ - { - name: 'step-tkn', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - startTime: new Date('2023-12-08T12:19:29Z'), - }, - }, - { - metadata: { - name: 'test-pipeline-8e09zm-sbom-task-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-8e09zm', - 'tekton.dev/pipelineTask': 'sbom-task', - 'tekton.dev/task': 'sbom-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-print-sbom-results', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, - { - metadata: { - name: 'pipelineRun-image-scan-task-t237ev-pod', - namespace: 'karthik', - uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578', - resourceVersion: '379623', - labels: { - 'backstage.io/kubernetes-id': 'developer-portal', - 'janus-idp.io/tekton': 'developer-portal', - 'tekton.dev/pipeline': 'test-pipeline', - 'tekton.dev/pipelineRun': 'test-pipeline-8e09zm', - 'tekton.dev/pipelineTask': 'sbom-task', - 'tekton.dev/task': 'sbom-task', - 'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task', - }, - }, - spec: { - containers: [ - { - name: 'step-print-scan-results', - }, - ], - }, - status: { - phase: 'Succeeded', - conditions: [], - - startTime: new Date('2023-12-08T12:19:38Z'), - }, - }, -]; - -export const testPipelineRunPods: { - pipelineRun: PipelineRunKind; - pods: V1Pod[]; -} = { - pipelineRun: testPipelineRun, - pods: testPods, -}; diff --git a/plugins/tekton/src/__fixtures__/taskRunData.ts b/plugins/tekton/src/__fixtures__/taskRunData.ts deleted file mode 100644 index 5a557a6297..0000000000 --- a/plugins/tekton/src/__fixtures__/taskRunData.ts +++ /dev/null @@ -1,368 +0,0 @@ -import { TaskRunKind } from '@janus-idp/shared-react'; - -import { TEKTON_PIPELINE_RUN } from '../consts/tekton-const'; - -export const taskRunWithResults: TaskRunKind = { - apiVersion: 'tekton.dev/v1beta1', - kind: 'TaskRun', - metadata: { - name: 'test-tr', - namespace: 'test-ns', - labels: { - 'tekton.dev/pipelineRun': 'test-plr', - }, - }, - spec: { - params: [ - { - name: 'first', - value: '20', - }, - { - name: 'second', - value: '10', - }, - ], - serviceAccountName: 'pipeline', - taskRef: { - kind: 'Task', - name: 'add-task', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: 'Mon Mar 27 2023 18:09:11', - startTime: 'Mon Mar 27 2023 18:08:19', - podName: 'sum-three-pipeline-run-second-add-al6kxl-deploy-pod', - conditions: [ - { - lastTransitionTime: '2021-02-09T09:57:03Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - taskResults: [ - { - name: 'sum', - value: '30', - }, - { - name: 'difference', - value: '10', - }, - { - name: 'multiply', - value: '200', - }, - { - name: 'divide', - value: '2', - }, - ], - }, -}; - -export const taskRunWithSBOMResult = { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - annotations: { - 'chains.tekton.dev/signed': 'true', - 'pipeline.openshift.io/preferredName': 'pipelinerun-with-sbom-task', - 'pipeline.openshift.io/started-by': 'kube:admin', - 'task.output.location': 'results', - 'task.results.format': 'application/text', - 'task.results.key': 'LINK_TO_SBOM', - }, - labels: { - [TEKTON_PIPELINE_RUN]: 'pipelinerun-with-sbom-task', - 'tekton.dev/pipelineTask': 'sbom-task', - }, - ownerReferences: [ - { - apiVersion: 'tekton.dev/v1', - blockOwnerDeletion: true, - controller: true, - kind: 'PipelineRun', - name: 'pipelinerun-with-sbom-task', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a9b24', - }, - ], - name: 'pipelinerun-with-sbom-task-t237ev-sbom-task', - uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c', - }, - spec: { - serviceAccountName: 'pipeline', - taskRef: { - kind: 'ClusterTask', - name: 'sbom-task', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-11-08T08:18:25Z', - conditions: [ - { - lastTransitionTime: '2023-11-08T08:18:25Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipelinerun-with-sbom-task-t237ev-sbom-task-pod', - results: [ - { - name: 'LINK_TO_SBOM', - type: 'string', - value: 'quay.io/test/image:build-8e536-1692702836', - }, - ], - }, -}; - -export const taskRunWithSBOMResultExternalLink: TaskRunKind = { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - annotations: { - 'chains.tekton.dev/signed': 'true', - 'pipeline.openshift.io/preferredName': 'pipelinerun-with-sbom-task', - 'pipeline.openshift.io/started-by': 'kube:admin', - 'pipeline.tekton.dev/release': 'a2f17f6', - 'task.output.location': 'results', - 'task.results.format': 'application/text', - 'task.results.type': 'external-link', - 'task.results.key': 'LINK_TO_SBOM', - }, - labels: { - [TEKTON_PIPELINE_RUN]: 'pipelinerun-with-external-sbom-task', - 'tekton.dev/pipelineTask': 'sbom-task-with-external-link', - }, - ownerReferences: [ - { - apiVersion: 'tekton.dev/v1', - blockOwnerDeletion: true, - controller: true, - kind: 'PipelineRun', - name: 'pipelinerun-with-external-sbom-task', - uid: '0a091bbf-3813-48d3-a6ce-fc43644a9b24', - }, - ], - resourceVersion: '197373', - name: 'pipelinerun-with-sbom-task-t237ev-sbom-task', - uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c', - generation: 1, - }, - spec: { - serviceAccountName: 'pipeline', - taskRef: { - kind: 'ClusterTask', - name: 'sbom-task-with-external-link', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-11-08T08:18:25Z', - conditions: [ - { - lastTransitionTime: '2023-11-08T08:18:25Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipelinerun-with-sbom-task-with-external-pod', - results: [ - { - name: 'LINK_TO_SBOM', - type: 'string', - value: - 'https://quay.io/repository/janus-idp/backstage-showcase?tab=tags', - }, - ], - }, -}; - -export const enterpriseContractTaskRun: TaskRunKind = { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - name: 'ec-taskrun', - labels: { - 'tekton.dev/pipelineRun': 'pipelinerun-with-scanner-task', - 'tekton.dev/pipelineTask': 'ec-task', - }, - annotations: { - 'chains.tekton.dev/signed': 'true', - 'pipeline.openshift.io/preferredName': 'pipelineRun-ec-task', - 'pipeline.openshift.io/started-by': 'kube:admin', - 'pipeline.tekton.dev/release': 'a2f17f6', - 'task.results.format': 'application/json', - 'task.output.location': 'logs', - 'task.results.type': 'ec', - name: 'pipelineRun-ec-task-t237ev', - uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c', - }, - }, - spec: { - serviceAccountName: 'pipeline', - taskRef: { - kind: 'Task', - name: 'ec-task', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-11-08T08:18:25Z', - conditions: [ - { - lastTransitionTime: '2023-11-08T08:18:25Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipelineRun-ec-task-t237ev-pod', - }, -}; - -export const acsImageScanTaskRun: TaskRunKind = { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - name: 'image-scan-taskrun', - labels: { - 'tekton.dev/pipelineRun': 'pipelinerun-with-scanner-task', - 'tekton.dev/pipelineTask': 'image-scan-task', - }, - annotations: { - 'chains.tekton.dev/signed': 'true', - 'pipeline.openshift.io/preferredName': 'pipelineRun-image-scan-task', - 'pipeline.openshift.io/started-by': 'kube:admin', - 'pipeline.tekton.dev/release': 'a2f17f6', - 'task.results.format': 'application/json', - 'task.output.location': 'logs', - 'task.results.type': 'roxctl-image-scan', - 'task.results.key': 'SCAN_OUTPUT', - name: 'pipelineRun-image-scan-task-t237ev', - uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c', - }, - }, - spec: { - serviceAccountName: 'pipeline', - taskRef: { - kind: 'Task', - name: 'image-scan-task', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-11-08T08:18:25Z', - conditions: [ - { - lastTransitionTime: '2023-11-08T08:18:25Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipelineRun-image-scan-task-t237ev-pod', - }, -}; - -export const acsImageCheckTaskRun: TaskRunKind = { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - name: 'image-check-taskrun', - labels: { - 'tekton.dev/pipelineRun': 'pipelinerun-with-scanner-task', - 'tekton.dev/pipelineTask': 'image-check-task', - }, - annotations: { - 'chains.tekton.dev/signed': 'true', - 'pipeline.openshift.io/preferredName': 'pipelineRun-image-check-task', - 'pipeline.openshift.io/started-by': 'kube:admin', - 'pipeline.tekton.dev/release': 'a2f17f6', - 'task.results.format': 'application/json', - 'task.output.location': 'logs', - 'task.results.type': 'roxctl-image-check', - 'task.results.key': 'SCAN_OUTPUT', - name: 'pipelineRun-image-check-task-t237ev', - uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c', - }, - }, - spec: { - serviceAccountName: 'pipeline', - taskRef: { - kind: 'Task', - name: 'image-check-task', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-11-08T08:18:25Z', - conditions: [ - { - lastTransitionTime: '2023-11-08T08:18:25Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipelineRun-image-check-task-t237ev-pod', - }, -}; - -export const acsDeploymentCheckTaskRun: TaskRunKind = { - apiVersion: 'tekton.dev/v1', - kind: 'TaskRun', - metadata: { - name: 'deployment-check-taskrun', - labels: { - 'tekton.dev/pipelineRun': 'pipelinerun-with-scanner-task', - 'tekton.dev/pipelineTask': 'deployment-check-task', - }, - annotations: { - 'chains.tekton.dev/signed': 'true', - 'pipeline.openshift.io/preferredName': - 'pipelineRun-deployment-check-task', - 'pipeline.openshift.io/started-by': 'kube:admin', - 'pipeline.tekton.dev/release': 'a2f17f6', - 'task.results.format': 'application/json', - 'task.output.location': 'logs', - 'task.results.type': 'roxctl-deployment-check', - 'task.results.key': 'SCAN_OUTPUT', - name: 'pipelineRun-deployment-check-task-t237ev', - uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c', - }, - }, - spec: { - serviceAccountName: 'pipeline', - taskRef: { - kind: 'Task', - name: 'deployment-check-task', - }, - timeout: '1h0m0s', - }, - status: { - completionTime: '2023-11-08T08:18:25Z', - conditions: [ - { - lastTransitionTime: '2023-11-08T08:18:25Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'pipelineRun-deployment-check-task-t237ev-pod', - }, -}; diff --git a/plugins/tekton/src/components/Charts/PipelineBars.test.tsx b/plugins/tekton/src/components/Charts/PipelineBars.test.tsx deleted file mode 100644 index d444508f40..0000000000 --- a/plugins/tekton/src/components/Charts/PipelineBars.test.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; - -import { render } from '@testing-library/react'; - -import { mockKubernetesPlrResponse } from '../../__fixtures__/1-pipelinesData'; -import PipelineBars from './PipelineBars'; - -jest.mock('react', () => ({ - ...jest.requireActual('react'), - useContext: jest.fn(), -})); - -jest.mock('@material-ui/core', () => ({ - ...jest.requireActual('@material-ui/core'), - makeStyles: () => () => { - return { - titleContainer: 'title', - closeButton: 'close', - }; - }, - Dialog: () =>
, -})); - -describe('PipelineBars', () => { - it('should show PipelineBars & Dialog', () => { - (React.useContext as jest.Mock).mockReturnValue({ - clusters: ['OCP'], - selectedCluster: [0], - watchResourcesData: { - pods: { data: mockKubernetesPlrResponse.pods }, - taskruns: { data: mockKubernetesPlrResponse.taskruns }, - }, - }); - const pipelineRun = mockKubernetesPlrResponse.pipelineruns[0]; - const { queryByTestId } = render( - , - ); - expect( - queryByTestId(`horizontal-stacked-bars-${pipelineRun.metadata.name}`), - ).toBeInTheDocument(); - expect(queryByTestId('dialog')).toBeInTheDocument(); - }); -}); diff --git a/plugins/tekton/src/components/Charts/PipelineBars.tsx b/plugins/tekton/src/components/Charts/PipelineBars.tsx deleted file mode 100644 index 5b9ffffa56..0000000000 --- a/plugins/tekton/src/components/Charts/PipelineBars.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import React from 'react'; - -import { Tooltip } from '@patternfly/react-core'; - -import { - ComputedStatus, - getRunStatusColor, - getTaskRunsForPipelineRun, - HorizontalStackedBars, - PipelineRunKind, - TaskStatusTooltip, - TaskStatusTypes, -} from '@janus-idp/shared-react'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { getTaskStatusOfPLR } from '../../utils/tekton-utils'; -import PipelineRunLogDialog from '../PipelineRunLogs/PipelineRunLogDialog'; - -type PipelineBarProps = { pipelineRun: PipelineRunKind }; - -const PipelineBars = ({ pipelineRun }: PipelineBarProps) => { - const { watchResourcesData } = React.useContext(TektonResourcesContext); - const [open, setOpen] = React.useState(false); - const pods = watchResourcesData?.pods?.data || []; - const taskRuns = watchResourcesData?.taskruns?.data || []; - const plrTasks = getTaskRunsForPipelineRun(pipelineRun, taskRuns); - const taskStatus = getTaskStatusOfPLR(pipelineRun, plrTasks); - - const openDialog = () => { - setOpen(true); - }; - - const closeDialog = () => { - setOpen(false); - }; - - return ( - <> - - }> - ({ - color: getRunStatusColor( - ComputedStatus[status as keyof typeof ComputedStatus], - ).color, - name: status, - size: taskStatus[ - ComputedStatus[ - status as keyof typeof ComputedStatus - ] as keyof TaskStatusTypes - ], - }))} - /> - - - ); -}; - -export default PipelineBars; diff --git a/plugins/tekton/src/components/Icons/CriticalRiskIcon.tsx b/plugins/tekton/src/components/Icons/CriticalRiskIcon.tsx deleted file mode 100644 index 33e07ee32b..0000000000 --- a/plugins/tekton/src/components/Icons/CriticalRiskIcon.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from 'react'; - -import { global_palette_red_200 as criticalColor } from '@patternfly/react-tokens/dist/js/global_palette_red_200'; - -const CriticalRiskIcon = ({ - className, - title, -}: { - className: string; - title?: string; -}): React.ReactElement => { - return ( - - {title && {title}} - - - ); -}; - -export default CriticalRiskIcon; diff --git a/plugins/tekton/src/components/Icons/EqualsIcon.tsx b/plugins/tekton/src/components/Icons/EqualsIcon.tsx deleted file mode 100644 index 10c564d3d4..0000000000 --- a/plugins/tekton/src/components/Icons/EqualsIcon.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from 'react'; - -import { global_palette_gold_400 as mediumColor } from '@patternfly/react-tokens/dist/js/global_palette_gold_400'; - -const EqualsIcon = ({ - className, - title, -}: { - className: string; - title?: string; -}): React.ReactElement => { - return ( - - {title && {title}} - - - ); -}; - -export default EqualsIcon; diff --git a/plugins/tekton/src/components/Icons/LinkToSbomIcon.tsx b/plugins/tekton/src/components/Icons/LinkToSbomIcon.tsx deleted file mode 100644 index 3dcc50b0f5..0000000000 --- a/plugins/tekton/src/components/Icons/LinkToSbomIcon.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import * as React from 'react'; - -import { createStyles, makeStyles, Theme } from '@material-ui/core'; -import classNames from 'classnames'; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - icon: { - fill: 'var(--pf-v5-global--Color--100)', - }, - disabledButton: { - fill: theme.palette.grey[600], - }, - }), -); - -const LinkToSBomIcon = ({ - disabled, - dataTestId, -}: { - dataTestId: string; - disabled?: boolean; -}): React.ReactElement => { - const classes = useStyles(); - return ( - - - - ); -}; - -export default LinkToSBomIcon; diff --git a/plugins/tekton/src/components/Icons/OutputIcon.tsx b/plugins/tekton/src/components/Icons/OutputIcon.tsx deleted file mode 100644 index e1fb574f19..0000000000 --- a/plugins/tekton/src/components/Icons/OutputIcon.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import * as React from 'react'; - -import { createStyles, makeStyles, Theme } from '@material-ui/core'; -import classNames from 'classnames'; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - icon: { - fill: 'var(--pf-v5-global--Color--100)', - }, - disabledButton: { - fill: theme.palette.grey[600], - }, - }), -); - -const OutputIcon = ({ - disabled, -}: { - disabled?: boolean; -}): React.ReactElement => { - const classes = useStyles(); - return ( - - - - ); -}; - -export default OutputIcon; diff --git a/plugins/tekton/src/components/Icons/SignedBadge.tsx b/plugins/tekton/src/components/Icons/SignedBadge.tsx deleted file mode 100644 index 2199a40fd5..0000000000 --- a/plugins/tekton/src/components/Icons/SignedBadge.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from 'react'; - -const SignedBadgeIcon: React.FC> = ({ - style, -}): React.ReactElement => { - return ( - - - - - - ); -}; - -export default SignedBadgeIcon; diff --git a/plugins/tekton/src/components/Icons/ViewLogsIcon.tsx b/plugins/tekton/src/components/Icons/ViewLogsIcon.tsx deleted file mode 100644 index a6ec1e08da..0000000000 --- a/plugins/tekton/src/components/Icons/ViewLogsIcon.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import * as React from 'react'; - -import { createStyles, makeStyles, Theme } from '@material-ui/core'; -import classNames from 'classnames'; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - icon: { - fill: 'var(--pf-v5-global--Color--100)', - }, - disabledButton: { - fill: theme.palette.grey[600], - }, - }), -); - -const ViewLogsIcon = ({ - disabled, -}: { - disabled?: boolean; -}): React.ReactElement => { - const classes = useStyles(); - return ( - - - - ); -}; - -export default ViewLogsIcon; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunColumnHeader.ts b/plugins/tekton/src/components/PipelineRunList/PipelineRunColumnHeader.ts deleted file mode 100644 index 6d53fae99c..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunColumnHeader.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { TableColumn } from '@backstage/core-components'; - -export const PipelineRunColumnHeader: TableColumn[] = [ - { - id: 'expander', - }, - { - id: 'name', - title: 'NAME', - field: 'metadata.name', - }, - { - id: 'vulnerabilities', - title: 'VULNERABILITIES', - field: 'status.results', - }, - { - id: 'status', - title: 'STATUS', - field: 'status.conditions[0].reason', - }, - { - id: 'task-status', - title: 'TASK STATUS', - field: 'status.conditions[0].reason', - }, - { - id: 'start-time', - title: 'STARTED', - field: 'status.startTime', - defaultSort: 'desc', - }, - { - id: 'duration', - title: 'DURATION', - field: 'status.completionTime', - }, - { - id: 'actions', - title: 'ACTIONS', - }, -]; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunList.test.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunList.test.tsx deleted file mode 100644 index 94e912d0c0..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunList.test.tsx +++ /dev/null @@ -1,247 +0,0 @@ -import React from 'react'; -import { BrowserRouter } from 'react-router-dom'; - -import { usePermission } from '@backstage/plugin-permission-react'; - -import { render } from '@testing-library/react'; - -import { ComputedStatus } from '@janus-idp/shared-react'; - -import { mockKubernetesPlrResponse } from '../../__fixtures__/1-pipelinesData'; -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import PipelineRunList from './PipelineRunList'; - -jest.mock('@backstage/plugin-catalog-react', () => ({ - useEntity: () => ({ - entity: { - metadata: { - name: 'test', - }, - }, - }), -})); - -jest.mock('@backstage/plugin-permission-react', () => ({ - usePermission: jest.fn(), -})); - -const mockUsePermission = usePermission as jest.MockedFunction< - typeof usePermission ->; - -jest.mock('@material-ui/styles', () => ({ - ...jest.requireActual('@material-ui/styles'), - makeStyles: () => (_theme: any) => { - return { - ok: 'ok', - }; - }, -})); - -describe('PipelineRunList', () => { - beforeEach(() => { - mockUsePermission.mockReturnValue({ loading: false, allowed: true }); - }); - - it('should render PipelineRunList if available', () => { - const mockContextData = { - watchResourcesData: { - pipelineruns: { - data: mockKubernetesPlrResponse.pipelineruns, - }, - taskruns: { - data: mockKubernetesPlrResponse.taskruns, - }, - }, - loaded: true, - responseError: '', - selectedClusterErrors: [], - clusters: ['ocp'], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.All, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - - const { queryByText } = render( - - - - - , - ); - - expect(queryByText(/No Pipeline Runs found/i)).toBeNull(); - }); - - it('should render loading if data has not been loaded', () => { - const mockContextData = { - watchResourcesData: {}, - loaded: false, - responseError: '', - selectedClusterErrors: [], - clusters: [], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.All, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - - const { getByTestId } = render( - - - , - ); - expect(getByTestId('tekton-progress')).not.toBeNull(); - }); - - it('should show empty state if no data is available', () => { - const mockContextData = { - watchResourcesData: { - pipelineruns: { - data: [], - }, - taskruns: { - data: [], - }, - }, - loaded: true, - responseError: '', - selectedClusterErrors: [], - clusters: [], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.All, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - - const { getByText } = render( - - - , - ); - expect(getByText(/No Pipeline Runs found/i)).not.toBeNull(); - }); - - it('should show empty state with no cluster selector if there are error in fetching resources and no clusters', () => { - const mockContextData = { - watchResourcesData: { - pipelineruns: { - data: [], - }, - taskruns: { - data: [], - }, - }, - loaded: true, - responseError: - 'getaddrinfo ENOTFOUND api.rhoms-4.13-052404.dev.openshiftappsvc.org', - selectedClusterErrors: [], - clusters: [], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.All, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - - const { getByText, queryByText } = render( - - - , - ); - getByText(/No Pipeline Runs found/i); - expect(queryByText(/Cluster/)).toBeNull(); - }); - - it('should show empty state with cluster selector if there are error in fetching resources and cluster(s) are fetched', () => { - const mockContextData = { - watchResourcesData: { - pipelineruns: { - data: [], - }, - taskruns: { - data: [], - }, - }, - loaded: true, - responseError: - 'getaddrinfo ENOTFOUND api.rhoms-4.13-052404.dev.openshiftappsvc.org', - selectedClusterErrors: [{ message: '403 - forbidden' }], - clusters: ['ocp'], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.All, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - - const { getByText, queryByText } = render( - - - , - ); - getByText(/No Pipeline Runs found/i); - expect(queryByText(/Cluster/)).not.toBeNull(); - }); - - it('should render filtered PipelineRunList based on selected status', () => { - const mockContextData = { - watchResourcesData: { - pipelineruns: { - data: mockKubernetesPlrResponse.pipelineruns, - }, - taskruns: { - data: mockKubernetesPlrResponse.taskruns, - }, - }, - loaded: true, - responseError: '', - selectedClusterErrors: [], - clusters: ['ocp'], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.Succeeded, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - - const { queryByText } = render( - - - - - , - ); - - expect(queryByText('pipelinerun-with-scanner-task')).not.toBeNull(); - }); - - it('should show empty state if no PipelineRuns matches selected status', () => { - const mockContextData = { - watchResourcesData: { - pipelineruns: { - data: mockKubernetesPlrResponse.pipelineruns, - }, - taskruns: { - data: mockKubernetesPlrResponse.taskruns, - }, - }, - loaded: true, - responseError: '', - selectedClusterErrors: [], - clusters: ['ocp'], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.Cancelled, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - - const { queryByText } = render( - - - - - , - ); - - expect(queryByText(/No Pipeline Runs found/i)).not.toBeNull(); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunList.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunList.tsx deleted file mode 100644 index c0848bc681..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunList.tsx +++ /dev/null @@ -1,265 +0,0 @@ -import React from 'react'; - -import { InfoCard, Progress } from '@backstage/core-components'; - -import { - Box, - makeStyles, - Paper, - Table, - TableBody, - TableCell, - TablePagination, - TableRow, - Toolbar, - Typography, -} from '@material-ui/core'; - -import { - ComputedStatus, - PipelineRunKind, - pipelineRunStatus, -} from '@janus-idp/shared-react'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { ClusterErrors, Order } from '../../types/types'; -import { getComparator } from '../../utils/tekton-utils'; -import { ClusterSelector, ErrorPanel } from '../common'; -import { StatusSelector } from '../common/StatusSelector'; -import { TableExpandCollapse } from '../common/TableExpandCollapse'; -import { PipelineRunColumnHeader } from './PipelineRunColumnHeader'; -import { PipelineRunListSearchBar } from './PipelineRunListSearchBar'; -import { PipelineRunTableBody } from './PipelineRunTableBody'; -import { EnhancedTableHead } from './PipelineTableHeader'; - -type WrapperInfoCardProps = { - allErrors?: ClusterErrors; - showClusterSelector?: boolean; - titleClassName?: string; -}; - -const useStyles = makeStyles(theme => ({ - root: { - alignItems: 'start', - padding: theme.spacing(3, 0, 2.5, 2.5), - }, - empty: { - padding: theme.spacing(2), - display: 'flex', - justifyContent: 'center', - }, - title: { - display: 'flex', - gap: '20px', - alignItems: 'center', - }, - footer: { - '&:nth-of-type(odd)': { - backgroundColor: `${theme.palette.background.paper}`, - }, - }, -})); - -const WrapperInfoCard = ({ - children, - allErrors, - showClusterSelector = true, - titleClassName, -}: React.PropsWithChildren) => ( - <> - {allErrors && allErrors.length > 0 && } - - - - -
- ), - })} - > - {children} - - -); - -const PipelineRunList = () => { - const { - loaded, - responseError, - watchResourcesData, - selectedClusterErrors, - clusters, - selectedCluster, - selectedStatus, - } = React.useContext(TektonResourcesContext); - const [search, setSearch] = React.useState(''); - const [order, setOrder] = React.useState('desc'); - const [orderBy, setOrderBy] = React.useState('status.startTime'); - const [orderById, setOrderById] = React.useState('startTime'); // 2 columns have the same field - const [page, setPage] = React.useState(0); - const [rowsPerPage, setRowsPerPage] = React.useState(5); - - // Jump to first page when cluster, status and search filter changed - const updateStateOnFilterChanges = React.useRef(false); - React.useEffect(() => { - if (updateStateOnFilterChanges.current) { - setPage(0); - } else { - updateStateOnFilterChanges.current = true; - } - }, [selectedCluster, selectedStatus, search]); - - const allPipelineRuns = React.useMemo(() => { - const plrs = - watchResourcesData?.pipelineruns?.data?.map(d => ({ - ...d, - id: d.metadata.uid, - })) ?? []; - return plrs as PipelineRunKind[]; - }, [watchResourcesData]); - - const filteredPipelineRuns = React.useMemo(() => { - let plrs = allPipelineRuns; - - if (selectedStatus && selectedStatus !== ComputedStatus.All) { - plrs = plrs.filter(plr => pipelineRunStatus(plr) === selectedStatus); - } - - if (search) { - const f = search.toUpperCase(); - plrs = plrs.filter((plr: PipelineRunKind) => { - const n = plr.metadata?.name?.toUpperCase(); - return n?.includes(f); - }); - } - - plrs = plrs.sort(getComparator(order, orderBy, orderById)); - - return plrs; - }, [allPipelineRuns, selectedStatus, search, order, orderBy, orderById]); - - const visibleRows = React.useMemo(() => { - return filteredPipelineRuns.slice( - page * rowsPerPage, - page * rowsPerPage + rowsPerPage, - ); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [filteredPipelineRuns, page, rowsPerPage, order, orderById]); - - const handleRequestSort = React.useCallback( - (_event: React.MouseEvent, property: string, id: string) => { - const isAsc = orderBy === property && order === 'asc'; - setOrder(isAsc ? 'desc' : 'asc'); - setOrderBy(property); - setOrderById(id); - }, - [order, orderBy], - ); - - const handleChangePage = (_event: unknown, newPage: number) => { - setPage(newPage); - }; - - const handleChangeRowsPerPage = ( - event: React.ChangeEvent, - ) => { - setRowsPerPage(parseInt(event.target.value, 10)); - setPage(0); - }; - - // Avoid a layout jump when reaching the last page with empty rows. - const emptyRows = - page > 0 - ? Math.max( - 0, - (1 + page) * rowsPerPage - (filteredPipelineRuns.length ?? 0), - ) - : 0; - - const classes = useStyles(); - - const allErrors: ClusterErrors = [ - ...(responseError ? [{ message: responseError }] : []), - ...(selectedClusterErrors ?? []), - ]; - - if (!loaded && !responseError) - return ( -
- -
- ); - - return ( - 0} - titleClassName={classes.title} - > - - - - - Pipeline Runs - - - -
- - {visibleRows?.length > 0 ? ( - - - {emptyRows > 0 && ( - - - - )} - - - - - ) : ( - - - - - - )} -
-
- No Pipeline Runs found -
-
- - - - ); -}; - -export default React.memo(PipelineRunList); diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunListSearchBar.test.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunListSearchBar.test.tsx deleted file mode 100644 index d6d7fb1b84..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunListSearchBar.test.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; - -import { fireEvent, render, screen } from '@testing-library/react'; - -import { PipelineRunListSearchBar } from './PipelineRunListSearchBar'; - -describe('PipelineRunListSearchBar', () => { - test('renders PipelineRunListSearchBar component', () => { - const { getByPlaceholderText } = render( - {}} />, - ); - - screen.logTestingPlaygroundURL(); - - expect(getByPlaceholderText('Search')).toBeInTheDocument(); - }); - - test('handles search input change', () => { - const onChange = jest.fn(); - const { getByPlaceholderText, getByTestId } = render( - , - ); - const searchInput = getByPlaceholderText('Search'); - const clearButton = getByTestId('clear-search'); - expect(clearButton.getAttribute('disabled')).toBe(''); // disabled - - fireEvent.change(searchInput, { target: { value: 'example' } }); - - expect(onChange).toHaveBeenCalledWith('example'); - }); - - test('clears search input', () => { - const onChange = jest.fn(); - const { getByTestId } = render( - , - ); - const clearButton = getByTestId('clear-search'); - expect(clearButton.getAttribute('disabled')).toBe(null); // not disabled - - fireEvent.click(getByTestId('clear-search')); - - expect(onChange).toHaveBeenCalledWith(''); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunListSearchBar.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunListSearchBar.tsx deleted file mode 100644 index 826d82b575..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunListSearchBar.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react'; - -import { - FormControl, - IconButton, - Input, - InputAdornment, - makeStyles, -} from '@material-ui/core'; -import Clear from '@material-ui/icons/Clear'; -import Search from '@material-ui/icons/Search'; - -type PipelineRunListSearchBarProps = { - value: string; - onChange: (filter: string) => void; -}; - -const useStyles = makeStyles({ - formControl: { - alignItems: 'flex-end', - flexGrow: 1, - }, -}); - -export const PipelineRunListSearchBar = ({ - value, - onChange, -}: PipelineRunListSearchBarProps) => { - const classes = useStyles(); - - return ( - - onChange(event.target.value)} - value={value} - startAdornment={ - - - - } - endAdornment={ - - onChange('')} - edge="end" - disabled={!value} - data-testid="clear-search" - > - - - - } - /> - - ); -}; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunOutput.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunOutput.tsx deleted file mode 100644 index ce56c9ba6b..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunOutput.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import React from 'react'; - -import { Progress } from '@backstage/core-components'; -import { useApi } from '@backstage/core-plugin-api'; - -import { - ACSCheckResults, - ACSImageScanResult, - Output, - PipelineRunKind as PipelineRunV1Kind, - TaskRunKind as TaskRunV1Kind, - usePipelineRunOutput, -} from '@aonic-ui/pipelines'; -import { Grid, Paper, Typography } from '@material-ui/core'; - -import { PipelineRunKind, TaskRunKind } from '@janus-idp/shared-react'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { - kubernetesProxyApiRef, - TektonResourcesContextData, -} from '../../types/types'; - -type PipelineRunOutputProps = { - pipelineRun: PipelineRunKind; - taskRuns: TaskRunKind[]; -}; - -const PipelineRunOutput: React.FC = ({ - pipelineRun, - taskRuns, -}) => { - const { clusters, selectedCluster } = - React.useContext(TektonResourcesContext); - const kubernetesProxyApi = useApi(kubernetesProxyApiRef); - - const currCluster = - (clusters.length > 0 && clusters[selectedCluster || 0]) || ''; - - const getLogs = React.useCallback( - async (podName: string, containerName: string): Promise => { - return await kubernetesProxyApi - .getPodLogs({ - podName: podName, - namespace: pipelineRun?.metadata?.namespace ?? '', - containerName: containerName, - clusterName: currCluster, - }) - .then(res => res?.text); - }, - [kubernetesProxyApi, currCluster, pipelineRun], - ); - - const outputGroup = usePipelineRunOutput( - pipelineRun as PipelineRunV1Kind, - taskRuns as TaskRunV1Kind[], - getLogs, - ); - - const stillLoading = - outputGroup?.ec?.loading && - (outputGroup?.acsImageScan?.loading || - outputGroup?.acsImageCheck?.loading || - outputGroup?.acsDeploymentCheck?.loading); - - const isEmpty = (data: ACSCheckResults | ACSImageScanResult) => - Object.keys(data).length === 0; - const noDataAvailable = - outputGroup?.ec?.data.length === 0 && - outputGroup.results.data.length === 0 && - isEmpty(outputGroup?.acsImageScan?.data) && - isEmpty(outputGroup?.acsImageScan?.data) && - isEmpty(outputGroup?.acsImageScan?.data); - - const renderOutput = () => { - if (stillLoading && noDataAvailable) { - return ; - } - - if (!stillLoading && noDataAvailable) { - return ( - - No output found - - ); - } - - const metadata = - outputGroup?.acsImageCheck?.data?.results?.[0]?.metadata?.additionalInfo; - if (metadata?.name?.includes('@')) { - metadata.name = metadata?.name.substr(0, metadata?.name.lastIndexOf('@')); - } - - return ( - - ); - }; - - return ( - -
- - {renderOutput()} - -
-
- ); -}; -export default PipelineRunOutput; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunRow.css b/plugins/tekton/src/components/PipelineRunList/PipelineRunRow.css deleted file mode 100644 index fb286eb838..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunRow.css +++ /dev/null @@ -1,3 +0,0 @@ -.bs-tkn-timestamp { - color: inherit; -} diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunRow.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunRow.tsx deleted file mode 100644 index 72d4f26eca..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunRow.tsx +++ /dev/null @@ -1,176 +0,0 @@ -import React from 'react'; - -import { - Box, - Collapse, - IconButton, - makeStyles, - TableCell, - TableRow, - Theme, -} from '@material-ui/core'; -import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; -import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight'; -import { Timestamp, Tooltip } from '@patternfly/react-core'; - -import { PipelineRunKind } from '@janus-idp/shared-react'; - -import { TEKTON_SIGNED_ANNOTATION } from '../../consts/tekton-const'; -import { OpenRowStatus, tektonGroupColor } from '../../types/types'; -import { pipelineRunDuration } from '../../utils/tekton-utils'; -import { PipelineRunVisualization } from '../pipeline-topology'; -import PipelineRunRowActions from './PipelineRunRowActions'; -import PipelineRunTaskStatus from './PipelineRunTaskStatus'; -import PipelineRunVulnerabilities from './PipelineRunVulnerabilities'; -import PlrStatus from './PlrStatus'; -import ResourceBadge from './ResourceBadge'; - -import './PipelineRunRow.css'; - -import classNames from 'classnames'; - -import SignedBadgeIcon from '../Icons/SignedBadge'; - -const useStyles = makeStyles((theme: Theme) => ({ - plrRow: { - '&:nth-of-type(odd)': { - backgroundColor: `${theme.palette.background.paper}`, - }, - }, - plrVisRow: { - borderBottom: `1px solid ${theme.palette.grey.A100}`, - }, - signedIndicator: { - display: 'inline-block', - width: theme.spacing(2.5), - position: 'relative', - top: theme.spacing(0.5), - }, -})); - -type PipelineRunRowProps = { - row: PipelineRunKind; - startTime: string; - isExpanded?: boolean; - open: boolean; - setOpen: React.Dispatch>; -}; - -type PipelineRunNameProps = { row: PipelineRunKind }; - -const PipelineRunName = ({ row }: PipelineRunNameProps) => { - const classes = useStyles(); - const name = row.metadata?.name; - const signed = - row?.metadata?.annotations?.[TEKTON_SIGNED_ANNOTATION] === 'true'; - - return ( -
- {name ? ( - -
- -
- - ) : null - } - /> - ) : ( - '-' - )} -
- ); -}; - -export const PipelineRunRow = ({ - row, - startTime, - isExpanded = false, - open, - setOpen, -}: PipelineRunRowProps) => { - const classes = useStyles(); - const uid = row.metadata?.uid; - - React.useEffect(() => { - return setOpen((val: OpenRowStatus) => { - return { - ...val, - ...(uid && { [uid]: isExpanded }), - }; - }); - }, [isExpanded, uid, setOpen]); - - const expandCollapseClickHandler = () => { - setOpen((val: OpenRowStatus) => { - return { - ...val, - ...(uid && { - [uid]: !val[uid], - }), - }; - }); - }; - - return ( - - - - - {open ? : } - - - - - - - - - - - - - - - - {startTime ? ( - - ) : ( - '-' - )} - - {pipelineRunDuration(row)} - - - - - - - - - - - - - - - ); -}; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunRowActions.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunRowActions.tsx deleted file mode 100644 index 1c106e3f9e..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunRowActions.tsx +++ /dev/null @@ -1,173 +0,0 @@ -import * as React from 'react'; - -import { kubernetesProxyPermission } from '@backstage/plugin-kubernetes-common'; -import { usePermission } from '@backstage/plugin-permission-react'; - -import { IconButton } from '@material-ui/core'; -import { Flex, FlexItem } from '@patternfly/react-core'; -import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip/Tooltip'; - -import { - ComputedStatus, - pipelineRunFilterReducer, - PipelineRunKind, - TaskRunKind, -} from '@janus-idp/shared-react'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { - getTaskrunsOutputGroup, - hasExternalLink, - isSbomTaskRun, -} from '../../utils/taskRun-utils'; -import OutputIcon from '../Icons/OutputIcon'; -import ViewLogsIcon from '../Icons/ViewLogsIcon'; -import PipelineRunLogDialog from '../PipelineRunLogs/PipelineRunLogDialog'; -import PipelineRunOutputDialog from '../PipelineRunOutput/PipelineRunOutputDialog'; -import PipelineRunSBOMLink from './PipelineRunSBOMLink'; - -const PipelineRunRowActions: React.FC<{ pipelineRun: PipelineRunKind }> = ({ - pipelineRun, -}) => { - const { watchResourcesData } = React.useContext(TektonResourcesContext); - const [open, setOpen] = React.useState(false); - - const [openOutput, setOpenOutput] = React.useState(false); - const [noActiveTask, setNoActiveTask] = React.useState(false); - const pods = watchResourcesData?.pods?.data || []; - const taskRuns = watchResourcesData?.taskruns?.data || []; - const { sbomTaskRun } = getTaskrunsOutputGroup( - pipelineRun?.metadata?.name, - taskRuns, - ); - const activeTaskName = sbomTaskRun?.metadata?.name; - - const hasKubernetesProxyAccess = usePermission({ - permission: kubernetesProxyPermission, - }); - - const openDialog = (viewLogs?: boolean) => { - if (viewLogs) setNoActiveTask(true); - setOpen(true); - }; - - const openOutputDialog = () => { - setOpenOutput(true); - }; - - const closeDialog = () => { - setNoActiveTask(false); - setOpen(false); - }; - - const { - acsImageScanTaskRun, - acsImageCheckTaskRun, - acsDeploymentCheckTaskRun, - ecTaskRun, - } = getTaskrunsOutputGroup(pipelineRun?.metadata?.name, taskRuns); - - const finishedTaskruns = [ - ...(acsImageScanTaskRun ? [acsImageScanTaskRun] : []), - ...(acsImageCheckTaskRun ? [acsImageCheckTaskRun] : []), - ...(acsDeploymentCheckTaskRun ? [acsDeploymentCheckTaskRun] : []), - ...(ecTaskRun ? [ecTaskRun] : []), - ].filter((taskRun: TaskRunKind) => - [ - ComputedStatus.Succeeded, - ComputedStatus.Failed, - ComputedStatus.Skipped, - ].includes(pipelineRunFilterReducer(taskRun)), - ); - - const results = - pipelineRun?.status?.pipelineResults || pipelineRun?.status?.results || []; - - const disabled = - results.length === 0 ? finishedTaskruns.length === 0 : results.length === 0; - - return ( - <> - - - { - setOpenOutput(false); - }} - /> - - - - openDialog(true)} - disabled={!hasKubernetesProxyAccess.allowed} - style={{ pointerEvents: 'auto', padding: 0 }} - > - - - - - - - - openDialog() : undefined - } - style={{ pointerEvents: 'auto', padding: 0 }} - > - - - - - - - openOutputDialog()} - style={{ pointerEvents: 'auto', padding: 0 }} - > - - - - - - - ); -}; -export default React.memo(PipelineRunRowActions); diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunSBOMLink.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunSBOMLink.tsx deleted file mode 100644 index 440b179ca5..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunSBOMLink.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import { Link } from 'react-router-dom'; - -import { TaskRunKind } from '@janus-idp/shared-react'; - -import { - getSbomLink, - hasExternalLink, - isSbomTaskRun, -} from '../../utils/taskRun-utils'; -import LinkToSBomIcon from '../Icons/LinkToSbomIcon'; - -const PipelineRunSBOMLink: React.FC<{ - sbomTaskRun: TaskRunKind | undefined; -}> = ({ sbomTaskRun }): React.ReactElement | null => { - const isSBOMTask = isSbomTaskRun(sbomTaskRun); - const isExternalLink: boolean = hasExternalLink(sbomTaskRun); - const linkToSbom = getSbomLink(sbomTaskRun); - - if ( - isSBOMTask && - isExternalLink && - (linkToSbom?.startsWith('http://') || linkToSbom?.startsWith('https://')) - ) { - // Link to external page - return ( - - - - ); - } else if (isSBOMTask && linkToSbom) { - // Link to internal taskrun page - return ; - } - - return ( - - ); -}; - -export default PipelineRunSBOMLink; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunTableBody.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunTableBody.tsx deleted file mode 100644 index 2374377366..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunTableBody.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import * as React from 'react'; - -import { PipelineRunKind } from '@janus-idp/shared-react'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { OpenRowStatus } from '../../types/types'; -import { PipelineRunRow } from './PipelineRunRow'; - -type PipelineRunTableBodyProps = { - rows: PipelineRunKind[]; -}; - -export const PipelineRunTableBody = ({ rows }: PipelineRunTableBodyProps) => { - const { isExpanded } = React.useContext(TektonResourcesContext); - const [open, setOpen] = React.useState( - rows.reduce((acc, row) => { - if (row.metadata?.uid) { - acc[row.metadata?.uid] = isExpanded ?? false; - } - return acc; - }, {} as OpenRowStatus), - ); - - return ( - <> - {rows.map((row: PipelineRunKind) => { - const startTime = row.status?.startTime || ''; - - return ( - - ); - })} - - ); -}; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunTaskStatus.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunTaskStatus.tsx deleted file mode 100644 index 0f60bb92d3..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunTaskStatus.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; - -import { PipelineRunKind } from '@janus-idp/shared-react'; - -import PipelineBars from '../Charts/PipelineBars'; - -const PipelineRunTaskStatus = ({ - pipelineRun, -}: { - pipelineRun: PipelineRunKind; -}) => { - return pipelineRun?.metadata?.name ? ( - - ) : null; -}; - -export default PipelineRunTaskStatus; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineRunVulnerabilities.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineRunVulnerabilities.tsx deleted file mode 100644 index e216591a5d..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineRunVulnerabilities.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import * as React from 'react'; - -import { makeStyles, Theme } from '@material-ui/core'; -import AngleDoubleDownIcon from '@mui/icons-material/KeyboardDoubleArrowDownOutlined'; -import AngleDoubleUpIcon from '@mui/icons-material/KeyboardDoubleArrowUpOutlined'; -import { Tooltip } from '@patternfly/react-core'; -import { global_palette_gold_400 as mediumColor } from '@patternfly/react-tokens/dist/js/global_palette_gold_400'; -import { global_palette_orange_300 as highColor } from '@patternfly/react-tokens/dist/js/global_palette_orange_300'; -import classNames from 'classnames'; - -import { PipelineRunKind } from '@janus-idp/shared-react'; - -import { usePipelineRunScanResults } from '../../hooks/usePipelineRunScanResults'; -import CriticalRiskIcon from '../Icons/CriticalRiskIcon'; -import EqualsIcon from '../Icons/EqualsIcon'; - -const useVStyles = makeStyles((theme: Theme) => ({ - pipelineVulnerabilities: { - display: 'flex', - flexWrap: 'wrap', - gap: theme.spacing(1), - }, - severityContainer: { - alignItems: 'center', - display: 'flex', - flexWrap: 'nowrap', - gap: theme.spacing(0.5), - }, - severityStatus: { - alignItems: 'center', - display: 'flex', - flexWrap: 'nowrap', - gap: theme.spacing(0.5), - }, - severityCount: { - fontWeight: 'bold', - }, - criticalStatus: { - height: '1em', - width: '1em', - }, - highStatus: { - color: highColor.value, - height: '0.8em', - width: '0.8em', - }, - mediumStatus: { - color: mediumColor.value, - height: '1.3em', - width: '1.3em', - }, - lowStatus: { - height: '0.8em', - width: '0.8em', - }, -})); - -type PipelineRunVulnerabilitiesProps = { - pipelineRun: PipelineRunKind; - condensed?: boolean; -}; - -const PipelineRunVulnerabilities: React.FC = ({ - pipelineRun, - condensed, -}) => { - const classes = useVStyles(); - const scanResults = usePipelineRunScanResults(pipelineRun); - - return ( -
- {scanResults?.vulnerabilities ? ( - <> -
- - - - - {!condensed ? 'Critical' : null} - - - {scanResults.vulnerabilities.critical || 0} - -
-
- - - - - {!condensed ? 'High' : null} - - - {scanResults.vulnerabilities.high || 0} - -
-
- - - - - {!condensed ? 'Medium' : null} - - - {scanResults.vulnerabilities.medium || 0} - -
-
- - - - - {!condensed ? 'Low' : null} - - - {scanResults.vulnerabilities.low || 0} - -
- - ) : ( - '-' - )} -
- ); -}; - -export default PipelineRunVulnerabilities; diff --git a/plugins/tekton/src/components/PipelineRunList/PipelineTableHeader.tsx b/plugins/tekton/src/components/PipelineRunList/PipelineTableHeader.tsx deleted file mode 100644 index dac973c615..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PipelineTableHeader.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import * as React from 'react'; - -import { - makeStyles, - TableCell, - TableHead, - TableRow, - TableSortLabel, -} from '@material-ui/core'; - -import { Order } from '../../types/types'; -import { PipelineRunColumnHeader } from './PipelineRunColumnHeader'; - -type EnhancedTableProps = { - onRequestSort: ( - event: React.MouseEvent, - property: string, - id: string, - ) => void; - order: Order; - orderBy: string; - orderById: string; -}; - -const useStyles = makeStyles(theme => ({ - header: { - padding: theme.spacing(1, 2, 1, 2.5), - borderTop: `1px solid ${theme.palette.grey.A100}`, - borderBottom: `1px solid ${theme.palette.grey.A100}`, - // withStyles hasn't a generic overload for theme - fontWeight: 'bold', - position: 'static', - wordBreak: 'normal', - }, -})); - -export const EnhancedTableHead = ({ - order, - orderBy, - orderById, - onRequestSort, -}: EnhancedTableProps) => { - const createSortHandler = - (property: string, id: string) => (event: React.MouseEvent) => { - onRequestSort(event, property, id); - }; - const classes = useStyles(); - - return ( - - - {PipelineRunColumnHeader.map(headCell => { - return ( - - {headCell.field ? ( - - {headCell.title} - - ) : ( - <> {headCell.title} - )} - - ); - })} - - - ); -}; diff --git a/plugins/tekton/src/components/PipelineRunList/PlrStatus.tsx b/plugins/tekton/src/components/PipelineRunList/PlrStatus.tsx deleted file mode 100644 index 3fead7651e..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/PlrStatus.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; - -import { - pipelineRunFilterReducer, - PipelineRunKind, - Status, -} from '@janus-idp/shared-react'; - -type PlrStatusProps = { obj: PipelineRunKind }; - -const PlrStatus = ({ obj }: PlrStatusProps) => { - const plrStatus = pipelineRunFilterReducer(obj); - return ; -}; - -export default PlrStatus; diff --git a/plugins/tekton/src/components/PipelineRunList/ResourceBadge.css b/plugins/tekton/src/components/PipelineRunList/ResourceBadge.css deleted file mode 100644 index 3b99745ae4..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/ResourceBadge.css +++ /dev/null @@ -1,17 +0,0 @@ -.bs-tkn-pipeline-visualization__label { - align-items: baseline; -} - -.bs-tkn-pipeline-visualization__label .badge { - font-size: 12px; - line-height: 20px; - margin-right: 4px; - min-width: 24px; - padding: 0 7px; - border-radius: 20px; - color: var(--pf-v5-global--palette--white); - display: inline-block; - text-align: center; - white-space: nowrap; - width: 100%; -} diff --git a/plugins/tekton/src/components/PipelineRunList/ResourceBadge.tsx b/plugins/tekton/src/components/PipelineRunList/ResourceBadge.tsx deleted file mode 100644 index 427db67d9c..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/ResourceBadge.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react'; - -import { Split, SplitItem } from '@patternfly/react-core'; - -import './ResourceBadge.css'; - -const ResourceBadge = ({ - color, - abbr, - name, - suffix, -}: { - color: string; - abbr: string; - name: string; - suffix?: React.ReactNode; -}) => { - return ( - - - - {abbr} - - - - {name} - - {suffix ? ( - - {suffix} - - ) : null} - - ); -}; - -export default ResourceBadge; diff --git a/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunOutput.test.tsx b/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunOutput.test.tsx deleted file mode 100644 index 13293eb212..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunOutput.test.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import React from 'react'; - -import '@testing-library/jest-dom'; - -import { useApi } from '@backstage/core-plugin-api'; - -import { render, screen, waitFor } from '@testing-library/react'; - -import { mockKubernetesPlrResponse } from '../../../__fixtures__/1-pipelinesData'; -import { acsImageCheckResults } from '../../../__fixtures__/advancedClusterSecurityData'; -import { enterpriseContractResult } from '../../../__fixtures__/enterpriseContractData'; -import PipelineRunOutput from '../PipelineRunOutput'; - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useApi: jest.fn(), -})); - -describe('PipelineRunOutput', () => { - beforeEach(() => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockResolvedValue({ text: 'data' }), - }); - }); - - it('should render the progress bar', async () => { - render( - , - ); - - await waitFor(() => { - expect(screen.queryByTestId('progress')).toBeInTheDocument(); - }); - }); - - it('should render the results table', async () => { - render( - , - ); - - await waitFor(() => { - expect(screen.queryByTestId('results-table')).toBeInTheDocument(); - expect(screen.queryByText('MY_SCAN_OUTPUT')).toBeInTheDocument(); - }); - }); - - it('should render the results table and ACS section', async () => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockImplementation(({ podName }) => { - if (podName.includes('image-check')) { - return Promise.resolve({ - text: JSON.stringify(acsImageCheckResults), - }); - } - return Promise.resolve({ text: 'data' }); - }), - }); - render( - , - ); - - await waitFor(() => { - expect( - screen.queryByText('Advanced Cluster Security'), - ).toBeInTheDocument(); - expect(screen.queryByText('Others')).toBeInTheDocument(); - }); - }); - - it('should render the EC and Others reports section', async () => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockImplementation(({ podName }) => { - if (podName.includes('ec-task')) { - return Promise.resolve({ - text: JSON.stringify(enterpriseContractResult), - }); - } - return Promise.resolve({ text: 'data' }); - }), - }); - render( - , - ); - - await waitFor(() => { - expect(screen.queryByText('Enterprise Contract')).toBeInTheDocument(); - expect(screen.queryByText('Others')).toBeInTheDocument(); - }); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunRowActions.test.tsx b/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunRowActions.test.tsx deleted file mode 100644 index 15b25bf2f8..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunRowActions.test.tsx +++ /dev/null @@ -1,214 +0,0 @@ -import React from 'react'; - -import '@testing-library/jest-dom'; - -import { BrowserRouter } from 'react-router-dom'; - -import { LinkProps } from '@backstage/core-components'; -import { usePermission } from '@backstage/plugin-permission-react'; - -import { - act, - fireEvent, - render, - screen, - waitFor, - within, -} from '@testing-library/react'; - -import { ComputedStatus, PipelineRunKind } from '@janus-idp/shared-react'; - -import { mockKubernetesPlrResponse } from '../../../__fixtures__/1-pipelinesData'; -import { TektonResourcesContext } from '../../../hooks/TektonResourcesContext'; -import { TektonResourcesContextData } from '../../../types/types'; -import PipelineRunRowActions from '../PipelineRunRowActions'; - -jest.mock('@backstage/plugin-permission-react', () => ({ - usePermission: jest.fn(), -})); - -const mockUsePermission = usePermission as jest.MockedFunction< - typeof usePermission ->; - -jest.mock('@material-ui/core', () => ({ - ...jest.requireActual('@material-ui/core'), - makeStyles: () => () => { - return { - titleContainer: 'title', - closeButton: 'close', - }; - }, - Dialog: (props: any) => ( -
- {props.open && Logs modal content} -
- ), -})); - -jest.mock('react-router-dom', () => { - const actual = jest.requireActual('react-router-dom'); - return { - ...actual, - Link: (props: LinkProps) => ( - - {props.children} - - ), - }; -}); - -const tektonResourceContextData: TektonResourcesContextData = { - watchResourcesData: { - pipelineruns: { - data: mockKubernetesPlrResponse.pipelineruns, - }, - taskruns: { - data: mockKubernetesPlrResponse.taskruns, - }, - pods: { - data: mockKubernetesPlrResponse.pods, - }, - }, - loaded: true, - responseError: '', - selectedClusterErrors: [], - clusters: ['ocp'], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.Other, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, -}; - -const TestPipelineRunRowActions = ({ - pipelineRun, -}: { - pipelineRun: PipelineRunKind; -}) => ( - - - - - -); - -describe('PipelineRunRowActions', () => { - beforeEach(() => { - mockUsePermission.mockReturnValue({ loading: false, allowed: true }); - }); - - it('should render the icon space holder', () => { - render( - , - ); - - expect(screen.queryByTestId('icon-space-holder')).toBeInTheDocument(); - }); - - it('should render the internal sbom link', () => { - render( - , - ); - - expect(screen.queryByTestId('internal-sbom-link')).toBeInTheDocument(); - }); - - it('should open sbom logs modal when the view SBOM link is clicked', async () => { - render( - , - ); - - expect(screen.queryByTestId('internal-sbom-link')).toBeInTheDocument(); - - act(() => { - fireEvent.click(screen.queryByTestId('view-sbom-icon') as HTMLElement); - }); - - await waitFor(() => { - within( - screen.getByTestId('pipelinerun-logs-dialog') as HTMLElement, - ).getByText('Logs modal content'); - }); - }); - - it('should render the external sbom link', () => { - render( - , - ); - - expect(screen.queryByTestId('external-sbom-link')).toBeInTheDocument(); - }); - - it('should disable the view logs action if the user does not have enough permission', () => { - mockUsePermission.mockReturnValue({ loading: false, allowed: false }); - - render( - , - ); - - expect(screen.queryByTestId('view-logs-icon')).toBeInTheDocument(); - expect( - screen.queryByTestId('view-logs-icon')?.getAttribute('disabled'), - ).not.toBeNull(); - }); - - it('should not open sbom logs modal when the view external SBOM link is clicked', async () => { - render( - , - ); - - expect(screen.queryByTestId('external-sbom-link')).toBeInTheDocument(); - - act(() => { - fireEvent.click(screen.queryByTestId('view-sbom-icon') as HTMLElement); - }); - - await waitFor(() => { - expect( - within( - screen.getByTestId('pipelinerun-logs-dialog') as HTMLElement, - ).queryByText('Logs modal content'), - ).not.toBeInTheDocument(); - }); - }); - - it('should disable the view output action', () => { - render( - , - ); - - expect(screen.queryByTestId('view-output-icon')).toBeInTheDocument(); - - expect( - screen.queryByTestId('view-output-icon')?.getAttribute('disabled'), - ).toBeDefined(); - }); - - it('should enable the view output action', () => { - render( - , - ); - - expect(screen.queryByTestId('view-output-icon')).toBeInTheDocument(); - - expect( - screen.queryByTestId('view-output-icon')?.getAttribute('disabled'), - ).toBeNull(); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunSBOMLink.test.tsx b/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunSBOMLink.test.tsx deleted file mode 100644 index 0b04c3b56c..0000000000 --- a/plugins/tekton/src/components/PipelineRunList/__tests__/PipelineRunSBOMLink.test.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; - -import { LinkProps } from '@backstage/core-components'; - -import { render, screen } from '@testing-library/react'; - -import { - taskRunWithResults, - taskRunWithSBOMResult, - taskRunWithSBOMResultExternalLink, -} from '../../../__fixtures__/taskRunData'; -import PipelineRunSBOMLink from '../PipelineRunSBOMLink'; - -jest.mock('react-router-dom', () => { - const actual = jest.requireActual('react-router-dom'); - return { - ...actual, - Link: (props: LinkProps) => ( - - {props.children} - - ), - }; -}); - -describe('PipelineRunSBOMLInk', () => { - it('should render the icon space holder', () => { - render(); - - expect(screen.queryByTestId('icon-space-holder')).toBeInTheDocument(); - }); - - it('should render the icon space holder if the taskrun passed is not a valid sbomTaskrun', () => { - render(); - - expect(screen.queryByTestId('icon-space-holder')).toBeInTheDocument(); - }); - - it('should render the internal logs link for a sbom Taskrun', () => { - render(); - expect(screen.queryByTestId('internal-sbom-link')).toBeInTheDocument(); - }); - - it('should render the external logs link for a sbom Taskrun', () => { - render( - , - ); - - expect(screen.queryByTestId('external-sbom-link')).toBeInTheDocument(); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogDialog.tsx b/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogDialog.tsx deleted file mode 100644 index 7095882f10..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogDialog.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import React from 'react'; - -import { ErrorBoundary } from '@backstage/core-components'; - -import { V1Pod } from '@kubernetes/client-node'; -import { - Box, - createStyles, - Dialog, - DialogContent, - DialogTitle, - IconButton, - makeStyles, - Theme, -} from '@material-ui/core'; -import CloseIcon from '@mui/icons-material/Close'; - -import { PipelineRunKind, TaskRunKind } from '@janus-idp/shared-react'; - -import { tektonGroupColor } from '../../types/types'; -import ResourceBadge from '../PipelineRunList/ResourceBadge'; -import PipelineRunLogDownloader from './PipelineRunLogDownloader'; -import PipelineRunLogs from './PipelineRunLogs'; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - titleContainer: { - display: 'flex', - alignItems: 'center', - gap: theme.spacing(1), - }, - closeButton: { - position: 'absolute', - right: theme.spacing(1), - top: theme.spacing(1), - color: theme.palette.grey[500], - }, - }), -); - -type PipelineRunLogDialogProps = { - open: boolean; - closeDialog: () => void; - pipelineRun: PipelineRunKind; - taskRuns: TaskRunKind[]; - pods: V1Pod[]; - activeTask?: string; -}; -const PipelineRunLogDialog = ({ - open, - closeDialog, - pipelineRun, - pods, - taskRuns, - activeTask, -}: PipelineRunLogDialogProps) => { - const classes = useStyles(); - - const [task, setTask] = React.useState(activeTask); - - return ( - - - - - - - - - - - - - - - - - ); -}; - -export default React.memo(PipelineRunLogDialog); diff --git a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogDownloader.tsx b/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogDownloader.tsx deleted file mode 100644 index 5a726d877c..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogDownloader.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react'; - -import { V1Pod } from '@kubernetes/client-node'; -import { Flex, FlexItem } from '@patternfly/react-core'; - -import { PipelineRunKind } from '@janus-idp/shared-react'; - -import { - TEKTON_PIPELINE_RUN, - TEKTON_PIPELINE_TASK, - TEKTON_PIPELINE_TASKRUN, -} from '../../consts/tekton-const'; -import PodLogsDownloadLink from './PodLogsDownloadLink'; - -const PipelineRunLogDownloader: React.FC<{ - pods: V1Pod[]; - pipelineRun: PipelineRunKind; - activeTask: string | undefined; -}> = ({ pods, pipelineRun, activeTask }) => { - const filteredPods: V1Pod[] = pods?.filter( - (p: V1Pod) => - p?.metadata?.labels?.[TEKTON_PIPELINE_RUN] === - pipelineRun?.metadata?.name, - ); - - const sortedPods: V1Pod[] = React.useMemo( - () => - Array.from(filteredPods)?.sort( - (a: V1Pod, b: V1Pod) => - new Date(a?.status?.startTime as Date).getTime() - - new Date(b?.status?.startTime as Date).getTime(), - ), - [filteredPods], - ); - - const activeTaskPod: V1Pod = - sortedPods.find( - (sp: V1Pod) => - sp.metadata?.labels?.[TEKTON_PIPELINE_TASKRUN] === activeTask, - ) ?? sortedPods[sortedPods.length - 1]; - - return sortedPods.length > 0 ? ( - - - - - - - - - ) : null; -}; -export default PipelineRunLogDownloader; diff --git a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogViewer.tsx b/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogViewer.tsx deleted file mode 100644 index 491d35534d..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogViewer.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react'; - -import { DismissableBanner, LogViewer } from '@backstage/core-components'; - -import { V1Container, V1Pod } from '@kubernetes/client-node'; -import { Paper } from '@material-ui/core'; -import { Skeleton } from '@material-ui/lab'; - -import { usePodLogsOfPipelineRun } from '../../hooks/usePodLogsOfPipelineRun'; - -type PipelineRunLogViewerProps = { pod: V1Pod }; - -export const PipelineRunLogViewer = ({ pod }: PipelineRunLogViewerProps) => { - const { value, error, loading } = usePodLogsOfPipelineRun({ - pod, - }); - - const containersList = pod?.spec?.containers || []; - let text = ''; - - text = containersList.reduce( - (acc: string, container: V1Container, idx: number) => { - if (container?.name && value?.[idx]?.text) { - return acc - .concat(`${container.name.toUpperCase()}\n${value[idx].text}`) - .concat(idx === containersList.length - 1 ? '' : '\n'); - } - return acc; - }, - '', - ); - - return ( - <> - {error && ( - - )} - - {loading && ( - - )} - {pod && !loading && } - - - ); -}; diff --git a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogs.tsx b/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogs.tsx deleted file mode 100644 index f4096fef50..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/PipelineRunLogs.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import React from 'react'; - -import { LogViewer, Progress } from '@backstage/core-components'; - -import { V1Pod } from '@kubernetes/client-node'; -import { Paper } from '@material-ui/core'; -import Grid from '@material-ui/core/Grid'; - -import { - getTaskRunsForPipelineRun, - pipelineRunFilterReducer, - PipelineRunKind, - TaskRunKind, -} from '@janus-idp/shared-react'; - -import { getActiveTaskRun, getSortedTaskRuns } from '../../utils/taskRun-utils'; -import { PipelineRunLogViewer } from './PipelineRunLogViewer'; -import { TaskStatusStepper } from './TaskStatusStepper'; - -type PipelineRunLogsProps = { - pipelineRun: PipelineRunKind; - taskRuns: TaskRunKind[]; - pods: V1Pod[]; - activeTask?: string; - setActiveTask: (t: string) => void; -}; -export const PipelineRunLogs = ({ - pipelineRun, - taskRuns, - pods, - activeTask, - setActiveTask, -}: PipelineRunLogsProps) => { - const PLRTaskRuns = getTaskRunsForPipelineRun(pipelineRun, taskRuns); - const sortedTaskRuns = getSortedTaskRuns(PLRTaskRuns); - const taskRunFromYaml = PLRTaskRuns?.reduce( - (acc: { [value: string]: TaskRunKind }, value) => { - if (value?.metadata?.name) { - acc[value.metadata.name] = value; - } - return acc; - }, - {}, - ); - - const completed = pipelineRunFilterReducer(pipelineRun); - const [lastActiveStepId, setLastActiveStepId] = React.useState(''); - - React.useEffect(() => { - const mostRecentFailedOrActiveStep = sortedTaskRuns.find(tr => - ['Failed', 'Running'].includes(tr.status), - ); - - if (completed && !mostRecentFailedOrActiveStep && !activeTask) { - setLastActiveStepId(sortedTaskRuns[sortedTaskRuns.length - 1]?.id); - return; - } - - setLastActiveStepId( - !activeTask ? (mostRecentFailedOrActiveStep?.id as string) : '', - ); - }, [sortedTaskRuns, completed, activeTask]); - - const currentStepId = activeTask || lastActiveStepId; - const activeItem = getActiveTaskRun(sortedTaskRuns, currentStepId); - const podName = - activeItem && taskRunFromYaml?.[currentStepId]?.status?.podName; - const podData = React.useMemo( - () => - pods.find(pod => { - return pod?.metadata?.name === podName; - }), - [pods, podName], - ); - - return ( - - - - - - - - {!currentStepId && } -
- {!podData ? ( - - - - ) : ( - - )} -
-
-
- ); -}; - -export default PipelineRunLogs; diff --git a/plugins/tekton/src/components/PipelineRunLogs/PodLogsDownloadLink.tsx b/plugins/tekton/src/components/PipelineRunLogs/PodLogsDownloadLink.tsx deleted file mode 100644 index 1f4e6855fb..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/PodLogsDownloadLink.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import React from 'react'; - -import { useApi } from '@backstage/core-plugin-api'; - -import { V1Pod } from '@kubernetes/client-node'; -import { createStyles, Link, makeStyles, Theme } from '@material-ui/core'; -import DownloadIcon from '@mui/icons-material/FileDownloadOutlined'; -import classNames from 'classnames'; - -import { downloadLogFile } from '@janus-idp/shared-react'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { ContainerScope } from '../../hooks/usePodLogsOfPipelineRun'; -import { - kubernetesProxyApiRef, - TektonResourcesContextData, -} from '../../types/types'; -import { getPodLogs } from '../../utils/log-downloader-utils'; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - downloadAction: { - position: 'relative', - marginBottom: 'var(--pf-v5-global--spacer--sm)', - color: 'var(--pf-v5-global--color--100)', - cursor: 'pointer', - }, - buttonDisabled: { - color: theme.palette.grey[400], - cursor: 'not-allowed', - }, - }), -); - -const PodLogsDownloadLink: React.FC<{ - pods: V1Pod[]; - fileName: string; - downloadTitle: string; -}> = ({ pods, fileName, downloadTitle, ...props }): React.ReactElement => { - const classes = useStyles(); - const [downloading, setDownloading] = React.useState(false); - const kubernetesProxyApi = useApi(kubernetesProxyApiRef); - - const { clusters, selectedCluster = 0 } = - React.useContext(TektonResourcesContext); - const currCluster = clusters.length > 0 ? clusters[selectedCluster] : ''; - - const getLogs = (podScope: ContainerScope): Promise<{ text: string }> => { - const { podName, podNamespace, containerName, clusterName } = podScope; - return kubernetesProxyApi.getPodLogs({ - podName: podName, - namespace: podNamespace, - containerName: containerName, - clusterName: clusterName, - }); - }; - - return ( - { - setDownloading(true); - getPodLogs(pods, getLogs, currCluster) - .then((logs: string) => { - setDownloading(false); - downloadLogFile(logs || '', fileName); - }) - .catch(err => { - // eslint-disable-next-line no-console - console.warn('Download failed', err); - setDownloading(false); - }); - }} - className={classNames(classes.downloadAction, { - [classes.buttonDisabled]: downloading, - })} - {...props} - > - - {downloadTitle || 'Download '} - - ); -}; -export default PodLogsDownloadLink; diff --git a/plugins/tekton/src/components/PipelineRunLogs/TaskStatusStepper.tsx b/plugins/tekton/src/components/PipelineRunLogs/TaskStatusStepper.tsx deleted file mode 100644 index a73261f0bd..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/TaskStatusStepper.tsx +++ /dev/null @@ -1,169 +0,0 @@ -import React from 'react'; -import useInterval from 'react-use/lib/useInterval'; - -import { - CircularProgress, - createStyles, - makeStyles, - StepButton, - StepIconProps, - Theme, -} from '@material-ui/core'; -import Step from '@material-ui/core/Step'; -import StepLabel from '@material-ui/core/StepLabel'; -import Stepper from '@material-ui/core/Stepper'; -import Typography from '@material-ui/core/Typography'; -import Cancel from '@material-ui/icons/Cancel'; -import Check from '@material-ui/icons/Check'; -import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord'; -import classNames from 'classnames'; - -import { ComputedStatus } from '@janus-idp/shared-react'; - -import { TaskStep } from '../../utils/taskRun-utils'; -import { calculateDuration } from '../../utils/tekton-utils'; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - root: { - width: '100%', - }, - titleContainer: { - display: 'flex', - alignItems: 'center', - gap: theme.spacing(1), - }, - closeButton: { - position: 'absolute', - right: theme.spacing(1), - top: theme.spacing(1), - color: theme.palette.grey[500], - }, - labelWrapper: { - display: 'flex', - flex: 1, - flexDirection: 'row', - justifyContent: 'space-between', - }, - stepWrapper: { - width: '100%', - }, - }), -); - -const StepTimeTicker = ({ step }: { step: TaskStep }) => { - const [time, setTime] = React.useState(''); - - useInterval(() => { - if (!step.startedAt) { - setTime(''); - return; - } - - setTime(calculateDuration(step.startedAt, step.endedAt)); - }, 1000); - - return {time}; -}; - -const useStepIconStyles = makeStyles((theme: Theme) => - createStyles({ - root: { - color: theme.palette.text.disabled, - display: 'flex', - height: 22, - alignItems: 'center', - }, - completed: { - color: theme.palette.status.ok, - }, - error: { - color: theme.palette.status.error, - }, - }), -); - -const TaskStepIconComponent = ({ active, completed, error }: StepIconProps) => { - const classes = useStepIconStyles(); - - const getMiddle = () => { - if (active) { - return ; - } - if (completed) { - return ; - } - if (error) { - return ; - } - return ; - }; - - return ( -
- {getMiddle()} -
- ); -}; - -type TaskStatusStepperProps = { - steps: TaskStep[]; - currentStepId: string | undefined; - onUserStepChange: (id: string) => void; - classes?: { - root?: string; - }; -}; - -export const TaskStatusStepper = React.memo((props: TaskStatusStepperProps) => { - const { steps, currentStepId, onUserStepChange } = props; - const classes = useStyles(props); - - return ( -
- s.id === currentStepId)} - orientation="vertical" - nonLinear - > - {steps.map((step, _) => { - const isCancelled = step.status === ComputedStatus.Cancelled; - const isActive = step.status === ComputedStatus.Running; - const isCompleted = step.status === ComputedStatus.Succeeded; - const isFailed = step.status === ComputedStatus.Failed; - const isSkipped = step.status === ComputedStatus.Skipped; - - return ( - - onUserStepChange(step.id)}> - -
- {step.name} - {isSkipped ? ( - Skipped - ) : ( - - )} -
-
-
-
- ); - })} -
-
- ); -}); diff --git a/plugins/tekton/src/components/PipelineRunLogs/__tests__/PipelineRunLogDialog.test.tsx b/plugins/tekton/src/components/PipelineRunLogs/__tests__/PipelineRunLogDialog.test.tsx deleted file mode 100644 index 02af8379cb..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/__tests__/PipelineRunLogDialog.test.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import React from 'react'; - -import { useApi } from '@backstage/core-plugin-api'; - -import { Theme } from '@material-ui/core'; -import { render, screen } from '@testing-library/react'; - -import { testPipelineRunPods } from '../../../__fixtures__/pods-data'; -import PipelineRunLogDialog from '../PipelineRunLogDialog'; - -jest.mock('@material-ui/styles', () => ({ - ...jest.requireActual('@material-ui/styles'), - makeStyles: (cb: any) => (theme: Theme) => - cb({ - ...theme, - spacing: () => 0, - palette: { grey: { 500: 'grey' } }, - }), -})); - -jest.mock('@backstage/core-components', () => ({ - ErrorBoundary: (props: any) => <>{props.children}, -})); - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useApi: jest.fn(), -})); - -jest.mock('../PipelineRunLogs', () => () =>
Pipeline run logs
); - -describe('PipelineRunLogDialog', () => { - beforeEach(() => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockResolvedValue({ text: 'log data...' }), - }); - }); - it('should not show pipeline run logs modal', () => { - const closeDialog = jest.fn(); - render( - , - ); - - expect( - screen.queryByTestId('pipelinerun-logs-dialog'), - ).not.toBeInTheDocument(); - }); - - it('should show pipeline run logs modal', () => { - const closeDialog = jest.fn(); - render( - , - ); - - expect(screen.getByTestId('pipelinerun-logs-dialog')).toBeInTheDocument(); - }); - - it('should not show download links in the logs modal if there are no pods', () => { - const closeDialog = jest.fn(); - render( - , - ); - - expect(screen.getByTestId('pipelinerun-logs-dialog')).toBeInTheDocument(); - - expect( - screen.queryByTestId('pipelinerun-logs-downloader'), - ).not.toBeInTheDocument(); - }); - - it('should show download links in the logs modal if pods are available', () => { - const closeDialog = jest.fn(); - render( - , - ); - - expect(screen.getByTestId('pipelinerun-logs-dialog')).toBeInTheDocument(); - expect( - screen.queryByTestId('pipelinerun-logs-downloader'), - ).toBeInTheDocument(); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunLogs/__tests__/PipelineRunLogDownloader.test.tsx b/plugins/tekton/src/components/PipelineRunLogs/__tests__/PipelineRunLogDownloader.test.tsx deleted file mode 100644 index 09fac0b431..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/__tests__/PipelineRunLogDownloader.test.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; - -import { render, screen } from '@testing-library/react'; - -import { testPipelineRunPods } from '../../../__fixtures__/pods-data'; -import PipelineRunLogDownloader from '../PipelineRunLogDownloader'; - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useApi: jest.fn(), -})); - -describe('PipelineRunLogDownloader', () => { - it('should not show download links', () => { - const { pipelineRun } = testPipelineRunPods; - render( - , - ); - - expect(screen.queryByTestId('download-task-logs')).not.toBeInTheDocument(); - expect( - screen.queryByTestId('download-pipelinerun-logs'), - ).not.toBeInTheDocument(); - }); - - it('should return download links', () => { - const { pipelineRun, pods } = testPipelineRunPods; - render( - , - ); - - expect(screen.getByTestId('download-task-logs')).toBeInTheDocument(); - expect(screen.getByTestId('download-pipelinerun-logs')).toBeInTheDocument(); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunLogs/__tests__/PodLogsDownloadLink.test.tsx b/plugins/tekton/src/components/PipelineRunLogs/__tests__/PodLogsDownloadLink.test.tsx deleted file mode 100644 index 15636a509d..0000000000 --- a/plugins/tekton/src/components/PipelineRunLogs/__tests__/PodLogsDownloadLink.test.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import React from 'react'; - -import { fireEvent, render, screen, waitFor } from '@testing-library/react'; - -import { downloadLogFile } from '@janus-idp/shared-react'; - -import { testPipelineRunPods } from '../../../__fixtures__/pods-data'; -import { getPodLogs } from '../../../utils/log-downloader-utils'; -import PodLogsDownloadLink from '../PodLogsDownloadLink'; - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useApi: jest.fn(), -})); - -jest.mock('../../../utils/log-downloader-utils', () => ({ - getPodLogs: jest.fn(), -})); - -jest.mock('@janus-idp/shared-react', () => ({ - ...jest.requireActual('@janus-idp/shared-react'), - downloadLogFile: jest.fn(), -})); - -const getPodLogsMock = getPodLogs as jest.Mock; -const downloadLogFileMock = downloadLogFile as jest.Mock; - -describe('PodLogsDownloadLink', () => { - beforeEach(() => { - getPodLogsMock.mockResolvedValue(''); - downloadLogFileMock.mockResolvedValue('download complete'); - }); - - it('should download the pipelineRun logs', async () => { - const { pods } = testPipelineRunPods; - - render( - , - ); - fireEvent.click(screen.getByTestId('download-pipelinerun-logs')); - - await waitFor(() => { - expect( - screen.getByTestId('download-pipelinerun-logs'), - ).toBeInTheDocument(); - - expect(getPodLogsMock).toHaveBeenCalled(); - expect(downloadLogFileMock).toHaveBeenCalled(); - }); - }); - - it('should disable download button during download and enable it back the process is complete', async () => { - getPodLogsMock.mockResolvedValue(''); - downloadLogFileMock.mockResolvedValue('download complete'); - - const { pods } = testPipelineRunPods; - render( - , - ); - - fireEvent.click(screen.getByTestId('download-pipelinerun-logs')); - - expect(screen.getByTestId('download-pipelinerun-logs')).toHaveAttribute( - 'disabled', - ); - - expect( - screen.getByTestId('download-pipelinerun-logs').getAttribute('title'), - ).toBe('downloading logs'); - - await waitFor(() => { - expect( - screen.getByTestId('download-pipelinerun-logs'), - ).not.toHaveAttribute('disabled'); - expect( - screen.getByTestId('download-pipelinerun-logs').getAttribute('title'), - ).toBe('Download all task logs'); - }); - }); - - it('should re-enable download button incase of any errors during download', async () => { - getPodLogsMock.mockRejectedValue('logs download error'); - downloadLogFileMock.mockResolvedValue(''); - - const { pods } = testPipelineRunPods; - render( - , - ); - - fireEvent.click(screen.getByTestId('download-pipelinerun-logs')); - - expect(screen.getByTestId('download-pipelinerun-logs')).toHaveAttribute( - 'disabled', - ); - - expect( - screen.getByTestId('download-pipelinerun-logs').getAttribute('title'), - ).toBe('downloading logs'); - - await waitFor(() => { - expect( - screen.getByTestId('download-pipelinerun-logs'), - ).not.toHaveAttribute('disabled'); - expect( - screen.getByTestId('download-pipelinerun-logs').getAttribute('title'), - ).toBe('Download all task logs'); - }); - }); -}); diff --git a/plugins/tekton/src/components/PipelineRunOutput/PipelineRunOutputDialog.tsx b/plugins/tekton/src/components/PipelineRunOutput/PipelineRunOutputDialog.tsx deleted file mode 100644 index dbcf83fbb5..0000000000 --- a/plugins/tekton/src/components/PipelineRunOutput/PipelineRunOutputDialog.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react'; - -import { ErrorBoundary } from '@backstage/core-components'; - -import { - Box, - createStyles, - Dialog, - DialogContent, - DialogTitle, - IconButton, - makeStyles, - Theme, -} from '@material-ui/core'; -import CloseIcon from '@mui/icons-material/Close'; - -import { PipelineRunKind, TaskRunKind } from '@janus-idp/shared-react'; - -import { tektonGroupColor } from '../../types/types'; -import PipelineRunOutput from '../PipelineRunList/PipelineRunOutput'; -import ResourceBadge from '../PipelineRunList/ResourceBadge'; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - titleContainer: { - display: 'flex', - alignItems: 'center', - gap: theme.spacing(1), - }, - closeButton: { - position: 'absolute', - right: theme.spacing(1), - top: theme.spacing(1), - color: theme.palette.grey[500], - }, - }), -); - -type PipelineRunOutputDialogProps = { - open: boolean; - closeDialog: () => void; - pipelineRun: PipelineRunKind; - taskRuns: TaskRunKind[]; -}; -const PipelineRunOutputDialog = ({ - open, - closeDialog, - pipelineRun, - taskRuns, -}: PipelineRunOutputDialogProps) => { - const classes = useStyles(); - - return ( - - - - {' '} - - - - - - - - - - - - ); -}; - -export default React.memo(PipelineRunOutputDialog); diff --git a/plugins/tekton/src/components/Router.tsx b/plugins/tekton/src/components/Router.tsx deleted file mode 100644 index 56859bf0f8..0000000000 --- a/plugins/tekton/src/components/Router.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { Route, Routes } from 'react-router-dom'; - -import { Entity } from '@backstage/catalog-model'; -import { useEntity } from '@backstage/plugin-catalog-react'; - -import { TEKTON_CI_ANNOTATION } from '../consts/tekton-const'; -import { TektonCIComponent } from './Tekton/TektonCIComponent'; - -/** @public */ -export const isTektonCIAvailable = (entity: Entity): boolean => - Boolean(entity.metadata.annotations?.[TEKTON_CI_ANNOTATION]); - -/** @public */ -export const Router = () => { - const { entity } = useEntity(); - if (isTektonCIAvailable(entity)) { - return ( - - } /> - - ); - } - return null; -}; diff --git a/plugins/tekton/src/components/Tekton/TektonCIComponent.test.tsx b/plugins/tekton/src/components/Tekton/TektonCIComponent.test.tsx deleted file mode 100644 index 2f8dd321e7..0000000000 --- a/plugins/tekton/src/components/Tekton/TektonCIComponent.test.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; - -import { usePermission } from '@backstage/plugin-permission-react'; - -import { render } from '@testing-library/react'; - -import { TektonCIComponent } from './TektonCIComponent'; - -// mock useTektonObjectsResponse hook -jest.mock('../../hooks/useTektonObjectsResponse', () => ({ - useTektonObjectsResponse: () => ({ - watchResourcesData: { - pipelineruns: { - data: [], - }, - taskruns: { - data: [], - }, - }, - loaded: true, - responseError: '', - selectedClusterErrors: [], - clusters: [], - setSelectedCluster: () => {}, - }), -})); - -jest.mock('@backstage/plugin-permission-react', () => ({ - usePermission: jest.fn(), -})); - -const mockUsePermission = usePermission as jest.MockedFunction< - typeof usePermission ->; - -describe('TektonComponent', () => { - beforeEach(() => { - mockUsePermission.mockReturnValue({ loading: false, allowed: true }); - }); - - it('should render Permission alert if the user does not have view permission', () => { - mockUsePermission.mockReturnValue({ loading: false, allowed: false }); - const { getByTestId } = render(); - expect(getByTestId('no-permission-alert')).toBeInTheDocument(); - }); - - it('should render TektonComponent', () => { - const { getByText } = render(); - expect(getByText(/No Pipeline Runs found/i)).not.toBeNull(); - }); -}); diff --git a/plugins/tekton/src/components/Tekton/TektonCIComponent.tsx b/plugins/tekton/src/components/Tekton/TektonCIComponent.tsx deleted file mode 100644 index b6e940d882..0000000000 --- a/plugins/tekton/src/components/Tekton/TektonCIComponent.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import React from 'react'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { useDarkTheme } from '../../hooks/useDarkTheme'; -import { useTektonObjectsResponse } from '../../hooks/useTektonObjectsResponse'; -import { useTektonViewPermission } from '../../hooks/useTektonViewPermission'; -import { ModelsPlural } from '../../models'; -import PermissionAlert from '../common/PermissionAlert'; -import PipelineRunList from '../PipelineRunList/PipelineRunList'; - -import '@patternfly/react-core/dist/styles/base.css'; -import '@patternfly/patternfly/patternfly-theme-dark.css'; -import '@patternfly/patternfly/patternfly-charts-theme-dark.css'; -import '@patternfly/patternfly/utilities/Accessibility/accessibility.css'; - -const savedStylesheets = new Set(); - -export const TektonCIComponent = () => { - useDarkTheme(); - - React.useLayoutEffect(() => { - const scalprumStyles = Array.from( - document.querySelectorAll('link[rel="stylesheet"]'), - ).filter(link => - link.attributes - .getNamedItem('href') - ?.value?.includes('backstage-plugin-tekton'), - ); - - scalprumStyles.forEach(link => - savedStylesheets.add(link as HTMLLinkElement), - ); - - savedStylesheets.forEach(link => { - if (!document.head.contains(link)) { - document.head.appendChild(link); - } - }); - return () => { - savedStylesheets.forEach(link => { - if (document.head.contains(link)) { - document.head.removeChild(link); - } - }); - }; - }, []); - - const watchedResources = [ - ModelsPlural.pipelineruns, - ModelsPlural.taskruns, - ModelsPlural.pods, - ]; - const tektonResourcesContextData = useTektonObjectsResponse(watchedResources); - const hasViewPermission = useTektonViewPermission(); - - if (!hasViewPermission) { - return ; - } - return ( - - - - ); -}; diff --git a/plugins/tekton/src/components/common/ClusterSelector.css b/plugins/tekton/src/components/common/ClusterSelector.css deleted file mode 100644 index da6aae614b..0000000000 --- a/plugins/tekton/src/components/common/ClusterSelector.css +++ /dev/null @@ -1,8 +0,0 @@ -.bs-tkn-cluster-selector { - display: flex; - align-items: center; -} - -.bs-tkn-cluster-selector > div > div > div { - margin-top: 0; -} diff --git a/plugins/tekton/src/components/common/ClusterSelector.tsx b/plugins/tekton/src/components/common/ClusterSelector.tsx deleted file mode 100644 index a22a2cc95a..0000000000 --- a/plugins/tekton/src/components/common/ClusterSelector.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import React from 'react'; - -import { Select, SelectedItems } from '@backstage/core-components'; -import { BackstageTheme } from '@backstage/theme'; - -import { makeStyles, Typography } from '@material-ui/core'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; - -import './ClusterSelector.css'; - -const useStyles = makeStyles(theme => ({ - label: { - color: theme.palette.text.primary, - fontSize: '1rem', - paddingRight: '10px', - fontWeight: 'bold', - }, -})); - -export const ClusterSelector = () => { - const classes = useStyles(); - const { - clusters: k8sClusters, - selectedCluster, - setSelectedCluster: setClusterContext, - } = React.useContext(TektonResourcesContext); - const clusterOptions = k8sClusters.map(cluster => ({ - value: cluster, - label: cluster, - })); - - const curCluster = - selectedCluster && k8sClusters?.length > 0 - ? k8sClusters[selectedCluster] - : k8sClusters?.[0]; - - const [clusterSelected, setClusterSelected] = - React.useState(curCluster); - - const onClusterChange = (arg: SelectedItems) => { - const index = k8sClusters.findIndex(cluster => cluster === arg); - setClusterContext(index); - setClusterSelected(arg); - }; - return ( -
- Cluster - -
- ); -}; diff --git a/plugins/tekton/src/components/common/TableExpandCollapse.tsx b/plugins/tekton/src/components/common/TableExpandCollapse.tsx deleted file mode 100644 index b0e05fa39e..0000000000 --- a/plugins/tekton/src/components/common/TableExpandCollapse.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React from 'react'; - -import { IconButton, makeStyles, Tooltip } from '@material-ui/core'; -import Collapse from '@material-ui/icons/UnfoldLess'; -import Expand from '@material-ui/icons/UnfoldMore'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; - -const useStyles = makeStyles({ - expandCollapse: { - flexGrow: 1, - textAlign: 'end', - }, - iconButton: { - padding: '2px', - }, -}); - -export const TableExpandCollapse = () => { - const classes = useStyles(); - const { isExpanded, setIsExpanded } = React.useContext( - TektonResourcesContext, - ); - - const handleExpandCollaspse = () => { - setIsExpanded(!isExpanded); - }; - return ( -
- - - handleExpandCollaspse()} - disabled={!isExpanded} - className={classes.iconButton} - > - - - - - - - handleExpandCollaspse()} - disabled={isExpanded} - className={classes.iconButton} - > - - - - -
- ); -}; diff --git a/plugins/tekton/src/components/common/WrapperInfoCard.tsx b/plugins/tekton/src/components/common/WrapperInfoCard.tsx deleted file mode 100644 index 8b7550c601..0000000000 --- a/plugins/tekton/src/components/common/WrapperInfoCard.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; - -import { BottomLinkProps, InfoCard } from '@backstage/core-components'; - -import { ClusterErrors } from '../../types/types'; -import { ClusterSelector, ErrorPanel } from '../common'; - -type WrapperInfoCardProps = { - title: string; - allErrors?: ClusterErrors; - footerLink?: BottomLinkProps; - showClusterSelector?: boolean; -}; - -export const WrapperInfoCard = ({ - children, - allErrors, - footerLink, - title, - showClusterSelector = true, -}: React.PropsWithChildren) => ( - <> - {allErrors && allErrors.length > 0 && } - })} - deepLink={footerLink} - > - {children} - - -); - -export default WrapperInfoCard; diff --git a/plugins/tekton/src/components/common/index.ts b/plugins/tekton/src/components/common/index.ts deleted file mode 100644 index ebf30499a0..0000000000 --- a/plugins/tekton/src/components/common/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { ErrorPanel } from './ErrorPanel'; -export { ClusterSelector } from './ClusterSelector'; -export { ResourceStatus } from './ResourceStatus'; diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineLayout.tsx b/plugins/tekton/src/components/pipeline-topology/PipelineLayout.tsx deleted file mode 100644 index 42f9a28d54..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineLayout.tsx +++ /dev/null @@ -1,188 +0,0 @@ -import React from 'react'; - -import { - action, - Controller, - createTopologyControlButtons, - defaultControlButtonsOptions, - EdgeModel, - GRAPH_LAYOUT_END_EVENT, - GRAPH_POSITION_CHANGE_EVENT, - GraphModel, - Node, - NodeModel, - Rect, - TopologyControlBar, - TopologyView, - Visualization, - VisualizationProvider, - VisualizationSurface, -} from '@patternfly/react-topology'; - -import { - DROP_SHADOW_SPACING, - GRAPH_MIN_WIDTH, - NODE_HEIGHT, - PipelineLayout as PipelineLayoutTypes, - TOOLBAR_HEIGHT, -} from '../../consts/pipeline-topology-const'; -import { PipelineMixedNodeModel } from '../../types/pipeline-topology-types'; -import { getLayoutData } from '../../utils/pipeline-topology-utils'; -import pipelineComponentFactory, { - layoutFactory, -} from './pipelineComponentFactory'; - -type PipelineLayoutProps = { - model: { - graph: GraphModel; - nodes: PipelineMixedNodeModel[]; - edges: EdgeModel[]; - }; -}; - -export const PipelineLayout = ({ model }: PipelineLayoutProps) => { - const [vis, setVis] = React.useState(null); - const [maxSize, setMaxSize] = React.useState<{ - height: number; - width: number; - }>({ height: 0, width: 0 }); - const storedGraphModel = React.useRef(null); - - const layout: PipelineLayoutTypes = model.graph.layout as PipelineLayoutTypes; - - const onLayoutUpdate = React.useCallback( - (nodes: Node[]) => { - const nodeBounds = nodes.map((node: Node) => - node.getBounds(), - ); - const maxWidth = Math.floor( - nodeBounds - .map((bounds: Rect) => bounds.width) - .reduce((w1: number, w2: number) => Math.max(w1, w2), 0), - ); - const maxHeight = Math.floor( - nodeBounds - .map((bounds: Rect) => bounds.height) - .reduce((h1: number, h2: number) => Math.max(h1, h2), 0), - ); - const maxObject = - nodeBounds.find((nb: Rect) => nb.height === maxHeight) ?? - ({ y: 0 } as Rect); - - const maxX = Math.floor( - nodeBounds - .map((bounds: Rect) => bounds.x) - .reduce((x1: number, x2: number) => Math.max(x1, x2), 0), - ); - const maxY = Math.floor( - nodeBounds - .map((bounds: Rect) => bounds.y) - .reduce((y1: number, y2: number) => Math.max(y1, y2), 0), - ); - - let horizontalMargin = 0; - let verticalMargin = 0; - if (layout) { - horizontalMargin = getLayoutData(layout)?.marginx || 0; - verticalMargin = getLayoutData(layout)?.marginy || 0; - } - const finallyTaskHeight = - maxObject.y + maxHeight + DROP_SHADOW_SPACING + verticalMargin * 2; - const regularTaskHeight = - maxY + NODE_HEIGHT + DROP_SHADOW_SPACING + verticalMargin * 2; - - setMaxSize({ - height: Math.max(finallyTaskHeight, regularTaskHeight) + TOOLBAR_HEIGHT, - width: Math.max( - maxX + maxWidth + DROP_SHADOW_SPACING + horizontalMargin * 2, - GRAPH_MIN_WIDTH, - ), - }); - }, - [setMaxSize, layout], - ); - - React.useEffect(() => { - if (model.graph.id !== storedGraphModel?.current?.id) { - storedGraphModel.current = null; - setVis(null); - } - }, [vis, model]); - - React.useEffect(() => { - let mounted = true; - if (vis === null) { - const controller = new Visualization(); - controller.registerLayoutFactory(layoutFactory); - controller.registerComponentFactory(pipelineComponentFactory); - controller.fromModel(model); - controller.addEventListener(GRAPH_POSITION_CHANGE_EVENT, () => { - storedGraphModel.current = controller.getGraph().toModel(); - }); - controller.addEventListener(GRAPH_LAYOUT_END_EVENT, () => { - onLayoutUpdate(controller.getGraph().getNodes()); - }); - if (mounted) { - setVis(controller); - } - } else { - const graph = storedGraphModel.current; - if (graph) { - model.graph = graph; - } - vis.fromModel(model); - vis.getGraph().layout(); - } - return () => { - mounted = false; - }; - }, [vis, model, onLayoutUpdate]); - - React.useEffect(() => { - if (model && vis) { - const graph = storedGraphModel.current; - if (graph) { - model.graph = graph; - } - vis.fromModel(model); - } - }, [model, vis]); - - if (!vis) return null; - - const controlBar = (controller: Controller) => ( - { - controller.getGraph().scaleBy(4 / 3); - }), - zoomOutCallback: action(() => { - controller.getGraph().scaleBy(0.75); - }), - fitToScreenCallback: action(() => { - controller.getGraph().fit(80); - }), - resetViewCallback: action(() => { - controller.getGraph().reset(); - controller.getGraph().layout(); - }), - legend: false, - })} - /> - ); - - return ( -
- - - - - -
- ); -}; diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineRunVisualization.tsx b/plugins/tekton/src/components/pipeline-topology/PipelineRunVisualization.tsx deleted file mode 100644 index 26685d784c..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineRunVisualization.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; - -import { useDarkTheme } from '../../hooks/useDarkTheme'; -import { PipelineVisualizationView } from './PipelineVisualizationView'; - -type PipelineRunVisualizationProps = { - pipelineRunName?: string; -}; - -export const PipelineRunVisualization = ({ - pipelineRunName, -}: PipelineRunVisualizationProps) => { - useDarkTheme(); - - return ( - <> - {pipelineRunName && ( - - )} - - ); -}; diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineTaskNode.css b/plugins/tekton/src/components/pipeline-topology/PipelineTaskNode.css deleted file mode 100644 index cccd0850c6..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineTaskNode.css +++ /dev/null @@ -1,3 +0,0 @@ -.bs-tkn-pipeline-task-node:focus { - outline: -webkit-focus-ring-color auto 5px; -} diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineTaskNode.tsx b/plugins/tekton/src/components/pipeline-topology/PipelineTaskNode.tsx deleted file mode 100644 index 8b21b8634a..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineTaskNode.tsx +++ /dev/null @@ -1,184 +0,0 @@ -import React from 'react'; - -import { Tooltip } from '@patternfly/react-core'; -import { - DEFAULT_LAYER, - DEFAULT_WHEN_OFFSET, - GraphElement, - Layer, - Node, - RunStatus, - ScaleDetailsLevel, - TaskNode, - TOP_LAYER, - useDetailsLevel, - useHover, - WhenDecorator, - WithContextMenuProps, - WithSelectionProps, -} from '@patternfly/react-topology'; -// eslint-disable-next-line @backstage/no-undeclared-imports -import { observer } from 'mobx-react'; - -import { PipelineTaskWithStatus, TaskRunKind } from '@janus-idp/shared-react'; - -import { NodeType } from '../../consts/pipeline-topology-const'; -import { - TEKTON_PIPELINE_RUN, - TEKTON_PIPELINE_TASK, -} from '../../consts/tekton-const'; -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { StepStatus } from '../../types/taskRun'; -import { TektonResourcesContextData } from '../../types/types'; -import { createStepStatus } from '../../utils/pipeline-step-utils'; -import { getTaskStatus } from '../../utils/pipelineRun-utils'; -import PipelineRunLogDialog from '../PipelineRunLogs/PipelineRunLogDialog'; -import { PipelineVisualizationStepList } from './PipelineVisualizationStepList'; - -import './PipelineTaskNode.css'; - -type PipelineTaskNodeProps = { - element: Node; -} & WithContextMenuProps & - WithSelectionProps & - GraphElement; - -const PipelineTaskNode = ({ - element, - onContextMenu, - contextMenuOpen, - ...rest -}: PipelineTaskNodeProps) => { - const [open, setOpen] = React.useState(false); - const { watchResourcesData } = React.useContext( - TektonResourcesContext, - ); - const data = element.getData(); - const triggerRef = React.useRef(null); - - const pipelineRun = data.pipelineRun; - const [hover, hoverRef] = useHover(); - const detailsLevel = useDetailsLevel(); - const isFinallyTask = element.getType() === NodeType.FINALLY_NODE; - - const pods = watchResourcesData?.pods?.data || []; - const taskRuns = watchResourcesData?.taskruns?.data || []; - const openDialog = () => { - setOpen(true); - }; - - const closeDialog = () => { - setOpen(false); - }; - - const computedTask: PipelineTaskWithStatus = data.task; - const stepList = - computedTask?.status?.steps || computedTask?.taskSpec?.steps || []; - - const taskStatus = getTaskStatus(data.pipelineRun, data.task); - - const stepStatusList: StepStatus[] = stepList.map((step: { name: string }) => - createStepStatus(step, taskStatus), - ); - const succeededStepsCount = stepStatusList.filter( - ({ status }) => status === RunStatus.Succeeded, - ).length; - - const badge = - stepStatusList.length > 0 && data.status - ? `${succeededStepsCount}/${stepStatusList.length}` - : null; - - const passedData = React.useMemo(() => { - const newData = { ...data }; - Object.keys(newData).forEach(key => { - if (newData[key] === undefined) { - delete newData[key]; - } - }); - return newData; - }, [data]); - - const hasTaskIcon = !!(data.taskIconClass || data.taskIcon); - const whenDecorator = data.whenStatus ? ( - - ) : null; - const activeTaskId = taskRuns.find( - (tr: TaskRunKind) => - tr?.metadata?.labels?.[TEKTON_PIPELINE_RUN] === - pipelineRun?.metadata?.name && - tr?.metadata?.labels?.[TEKTON_PIPELINE_TASK] === data.task?.name, - )?.metadata?.name; - - const taskNode = ( - <> - - - {whenDecorator} - - - ); - - return ( - - } - > - - } - triggerRef={triggerRef} - > - {taskNode} - - - - ); -}; - -export default React.memo(observer(PipelineTaskNode)); diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineVisualization.css b/plugins/tekton/src/components/pipeline-topology/PipelineVisualization.css deleted file mode 100644 index 3852d63ab2..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineVisualization.css +++ /dev/null @@ -1,27 +0,0 @@ -.bs-tkn-pipeline-visualization__label { - align-items: baseline; - padding-bottom: var(--pf-v5-global--spacer--xs); -} - -.bs-tkn-pipeline-visualization__label .badge { - font-size: 17px; - line-height: 20px; - margin-right: 4px; - min-width: 24px; - padding: 0 7px; - border-radius: 20px; - color: var(--pf-v5-global--palette--white); - display: inline-block; - text-align: center; - white-space: nowrap; - width: 100%; -} - -.bs-tkn-pipeline-visualization__layout .pf-topology-content { - border-radius: 20px; -} - -.bs-tkn-pipeline-visualization__layout .pf-topology-visualization-surface { - font-size: 1rem; - border-radius: 1rem; -} diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineVisualization.tsx b/plugins/tekton/src/components/pipeline-topology/PipelineVisualization.tsx deleted file mode 100644 index 48d04deea6..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineVisualization.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; - -import { PipelineRunKind, TaskRunKind } from '@janus-idp/shared-react'; - -import { useDarkTheme } from '../../hooks/useDarkTheme'; -import { getGraphDataModel } from '../../utils/pipeline-topology-utils'; -import { PipelineLayout } from './PipelineLayout'; - -import './PipelineVisualization.css'; - -type PipelineVisualizationProps = { - pipelineRun: PipelineRunKind | null; - taskRuns: TaskRunKind[]; -}; - -export const PipelineVisualization = ({ - pipelineRun, - taskRuns, -}: PipelineVisualizationProps) => { - useDarkTheme(); - - const model = getGraphDataModel(pipelineRun ?? undefined, taskRuns ?? []); - - return ( - <> - {!model || (model.nodes.length === 0 && model.edges.length === 0) ? ( -
- This Pipeline Run has no tasks to visualize -
- ) : ( -
- -
- )} - - ); -}; diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationStepList.css b/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationStepList.css deleted file mode 100644 index e6db778069..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationStepList.css +++ /dev/null @@ -1,67 +0,0 @@ -.bs-tkn-pipeline-visualization-step-list { - min-width: 10em; -} - -.bs-tkn-pipeline-visualization-step-list__task-name { - font-weight: var(--pf-v5-global--FontWeight--bold); - line-height: var(--pf-v5-global--spacer--lg); - max-height: var(--pf-v5-global--spacer--2xl); - max-width: 15em; - margin: 0 auto 10px auto; - - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - overflow: hidden; -} - -.bs-tkn-pipeline-visualization-step-list__task-type { - line-height: var(--pf-v5-global--spacer--xs); - max-height: var(--pf-v5-global--spacer--2xl); - margin: 0 auto 10px auto; -} - -.bs-tkn-pipeline-visualization-step-list__step { - display: flex; - margin-bottom: var(--pf-v5-global--spacer--xs); -} - -.bs-tkn-pipeline-visualization-step-list__step--task-run { - margin-bottom: var(--pf-v5-global--spacer--sm); -} - -.bs-tkn-pipeline-visualization-step-list__step:last-child { - margin-bottom: 0; -} - -.bs-tkn-pipeline-visualization-step-list__bullet { - font-size: 1rem; -} - -.bs-tkn-pipeline-visualization-step-list__icon { - flex: 0 0 18px; -} - -.bs-tkn-pipeline-visualization-step-list__icon-backdrop { - fill: var(--pf-v5-global--Color--light-100); -} - -.bs-tkn-pipeline-visualization-step-list__name { - flex: 1 1 auto; - overflow: hidden; - padding-left: var(--pf-v5-global--spacer--sm); - text-align: left; - text-overflow: ellipsis; - white-space: nowrap; -} - -.bs-tkn-pipeline-visualization-step-list__name.is-main-focus { - padding: 0 var(--pf-v5-global--spacer--sm); - text-align: center; -} - -.bs-tkn-pipeline-visualization-step-list__duration { - flex: 0 0 auto; - padding-left: var(--pf-v5-global--spacer--sm); - text-align: right; -} diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationStepList.tsx b/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationStepList.tsx deleted file mode 100644 index 68b5bd0622..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationStepList.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React from 'react'; - -import { RunStatus } from '@patternfly/react-topology'; -import classNames from 'classnames'; - -import { Status } from '@janus-idp/shared-react'; - -import { StepStatus } from '../../types/taskRun'; - -import './PipelineVisualizationStepList.css'; - -export type PipelineVisualizationStepListProps = { - isSpecOverview: boolean; - taskName: string; - steps: StepStatus[]; - isFinallyTask?: boolean; - hideHeader?: boolean; -}; - -type TooltipColoredStatusIconProps = { - status: RunStatus; -}; - -const TooltipColoredStatusIcon = ({ - status, -}: TooltipColoredStatusIconProps) => { - const icon = ; - return icon; -}; - -export const PipelineVisualizationStepList = ({ - isSpecOverview, - taskName, - steps, - isFinallyTask, - hideHeader, -}: PipelineVisualizationStepListProps) => { - return ( -
- {!hideHeader && ( -
- {taskName} -
- )} - {isFinallyTask && ( -
- Finally task -
- )} - {steps?.map(({ duration, name, status }) => { - return ( -
- {!isSpecOverview ? ( -
- -
- ) : ( - - • - - )} -
- {name} -
- {!isSpecOverview && ( -
- {duration} -
- )} -
- ); - })} -
- ); -}; diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationView.test.tsx b/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationView.test.tsx deleted file mode 100644 index 3a76da688b..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationView.test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import { BrowserRouter } from 'react-router-dom'; - -import { render } from '@testing-library/react'; - -import { ComputedStatus } from '@janus-idp/shared-react'; - -import { mockKubernetesPlrResponse } from '../../__fixtures__/1-pipelinesData'; -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { PipelineVisualizationView } from './PipelineVisualizationView'; - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useRouteRef: () => () => '/xyz', -})); - -describe('PipelineVisualizationView', () => { - it('should render the pipeline run visualization when pipelineRun name exists in the params', () => { - const mockContextData = { - watchResourcesData: { - pipelineruns: { - data: mockKubernetesPlrResponse.pipelineruns, - }, - taskruns: { - data: mockKubernetesPlrResponse.taskruns, - }, - }, - loaded: true, - responseError: '', - selectedClusterErrors: [], - clusters: [], - setSelectedCluster: () => {}, - selectedStatus: ComputedStatus.All, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }; - const { queryByTestId } = render( - - - - - , - ); - expect(queryByTestId('pipelineRun-visualization')).toBeInTheDocument(); - }); -}); diff --git a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationView.tsx b/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationView.tsx deleted file mode 100644 index a5cb538d6e..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/PipelineVisualizationView.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React from 'react'; - -import { EmptyState, Progress } from '@backstage/core-components'; - -import { isEmpty } from 'lodash'; - -import { TektonResourcesContext } from '../../hooks/TektonResourcesContext'; -import { getPipelineRun } from '../../utils/pipelineRun-utils'; -import { PipelineVisualization } from './PipelineVisualization'; - -import './PipelineVisualization.css'; - -type PipelineVisualizationViewProps = { - pipelineRun: string; -}; - -export const PipelineVisualizationView = ({ - pipelineRun, -}: PipelineVisualizationViewProps) => { - const { loaded, responseError, watchResourcesData } = React.useContext( - TektonResourcesContext, - ); - - const pipelineRunResource = React.useMemo( - () => - getPipelineRun(watchResourcesData?.pipelineruns?.data ?? [], pipelineRun), - [watchResourcesData, pipelineRun], - ); - - if (!loaded) - return ( -
- -
- ); - - if (loaded && (responseError || isEmpty(pipelineRunResource))) { - return ( - - ); - } - - return ( - - ); -}; diff --git a/plugins/tekton/src/components/pipeline-topology/TaskGroupEdge.tsx b/plugins/tekton/src/components/pipeline-topology/TaskGroupEdge.tsx deleted file mode 100644 index bbcfa80e76..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/TaskGroupEdge.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; - -import { Edge, TaskEdge } from '@patternfly/react-topology'; -// eslint-disable-next-line @backstage/no-undeclared-imports -import { observer } from 'mobx-react'; - -import { GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL } from '../../consts/pipeline-topology-const'; - -interface TaskEdgeProps { - element: Edge; -} - -const TaskGroupEdge = (props: TaskEdgeProps) => ( - -); - -export default observer(TaskGroupEdge); diff --git a/plugins/tekton/src/components/pipeline-topology/dag.test.ts b/plugins/tekton/src/components/pipeline-topology/dag.test.ts deleted file mode 100644 index 0ca60e097e..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/dag.test.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { DAG } from './dag'; - -describe('dag', () => { - describe('addVertex:', () => { - it('should add the vertex to the graph', () => { - const dag = new DAG(); - - dag.addVertex('task1'); - dag.addVertex('task2'); - - expect(dag.names).toHaveLength(2); - }); - - it('should skip the duplicate vertex added to the graph', () => { - const dag = new DAG(); - - dag.addVertex('task1'); - dag.addVertex('task1'); - - expect(dag.names).toHaveLength(1); - }); - }); - - describe('AddEdge:', () => { - it('should add the vertex if it not available in the graph', () => { - const dag = new DAG(); - - dag.addEdge('task1', 'task2'); - expect(dag.names).toHaveLength(2); - }); - - it('should add the edges to the graph', () => { - const dag = new DAG(); - - dag.addVertex('task1'); - dag.addVertex('task2'); - - dag.addEdge('task1', 'task2'); - expect(dag?.vertices?.get?.('task2')?.dependancyNames).toContain('task1'); - }); - - it('should skip the duplicate edges added to the graph', () => { - const dag = new DAG(); - - dag.addVertex('task1'); - dag.addVertex('task2'); - - dag.addEdge('task1', 'task2'); - dag.addEdge('task1', 'task2'); - expect(dag?.vertices?.get('task2')?.dependancyNames).toContain('task1'); - }); - }); - - describe('AddEdges', () => { - it('should form the dependancies when addEdges is called with multiple before and after tasks', () => { - const dag = new DAG(); - - dag.addVertex('task1'); - dag.addVertex('task2'); - dag.addVertex('task3'); - dag.addVertex('task4'); - dag.addVertex('task5'); - - const runAfter = ['task1', 'task2']; - const runBefore = ['task4', 'task5']; - - dag.addEdges('task3', { id: 'task3' }, runBefore, runAfter); - - expect(dag?.printGraph())?.toEqual( - 'task1 --> task2 --> task3 --> task4 --> task5', - ); - }); - - it('should throw an error if there is any cycle detected', () => { - const dag = new DAG(); - - dag.addVertex('task1'); - dag.addVertex('task2'); - dag.addVertex('task3'); - - const runAfter = ['task1', 'task2']; - const runBefore = ['task1']; - - expect(() => - dag.addEdges('task3', { id: 'task3' }, runBefore, runAfter), - ).toThrow('cycle detected: task3 --> task1 --> task3'); - }); - }); - - it('should print the tasks in topological sort order', () => { - const dag = new DAG(); - - dag.addVertex('task1'); - dag.addVertex('task2'); - dag.addVertex('task3'); - dag.addVertex('task4'); - - dag.addEdge('task1', 'task2'); - dag.addEdge('task2', 'task3'); - dag.addEdge('task3', 'task4'); - - expect(dag.printGraph()).toEqual('task1 --> task2 --> task3 --> task4'); - }); -}); diff --git a/plugins/tekton/src/components/pipeline-topology/dag.ts b/plugins/tekton/src/components/pipeline-topology/dag.ts deleted file mode 100644 index 32e3ca17db..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/dag.ts +++ /dev/null @@ -1,156 +0,0 @@ -export interface Vertex { - name: string; - level: number; - dependancy: { [key: string]: any }; - dependancyNames: string[]; - hasOutgoing: boolean; - data: any; -} - -type Vertices = Map; - -export class DAG { - names: string[]; - - vertices: Vertices; - - constructor() { - this.names = []; - this.vertices = new Map(); - } - - private visit( - vertex: Vertex, - fn: (v: Vertex, path: string[]) => void, - visited?: any, - path?: string[], - ) { - const { name } = vertex; - const vertices = vertex.dependancy; - const names = vertex.dependancyNames; - const len = names.length; - - if (!visited) { - // eslint-disable-next-line no-param-reassign - visited = new Map(); - } - if (!path) { - // eslint-disable-next-line no-param-reassign - path = []; - } - if (visited.has(name)) { - return; - } - path.push(name); - visited.set(name, true); - for (let i = 0; i < len; i++) { - this.visit(vertices[names[i]], fn, visited, path); - } - fn(vertex, path); - path.pop(); - } - - private map(name: string, data: any) { - const vertex = this.addVertex(name) as Vertex; - vertex.data = data; - } - - addVertex(name: string) { - if (!name) { - return null; - } - if (this.vertices.has(name)) { - return this.vertices.get(name); - } - - const vertex: Vertex = { - name, - level: 0, - dependancy: {}, - dependancyNames: [], - hasOutgoing: false, - data: {}, - }; - this.vertices.set(name, vertex); - this.names.push(name); - return vertex; - } - - addEdge(source: string, target: string): void { - if (!source || !target || source === target) { - return; - } - const fromNode = this.addVertex(source) as Vertex; - const toNode = this.addVertex(target) as Vertex; - - if (toNode.dependancy[source]) { - return; - } - - const printPath = (path: string[], tar: string): string => { - const reversedPath = [...path].reverse(); - return `${reversedPath.join(' --> ')} --> ${tar}`; - }; - - const checkCycle = (vertex: Vertex, path: string[]) => { - if (vertex.name === target) { - throw new Error(`cycle detected: ${printPath(path, target)}`); - } else { - vertex.level = path.length; - } - }; - this.visit(fromNode, checkCycle); - fromNode.hasOutgoing = true; - toNode.dependancy[source] = fromNode; - toNode.dependancyNames.push(source); - } - - addEdges( - name: string, - data: any, - before: string | string[], - after: string | string[], - ): void { - this.map(name, data); - - if (before) { - if (typeof before === 'string') { - this.addEdge(name, before); - } else { - before.forEach(b => this.addEdge(name, b)); - } - } - if (after) { - if (typeof after === 'string') { - this.addEdge(after, name); - } else { - after.forEach(a => this.addEdge(a, name)); - } - } - } - - topologicalSort(fn: any): void { - const visited = new Map(); - const { vertices } = this; - const { names } = this; - const len = names.length; - - for (let i = 0; i < len; i++) { - const vertex = vertices.get(names[i]) as Vertex; - if (!vertex.hasOutgoing) { - this.visit(vertex, fn, visited); - } - } - } - - printGraph() { - const orderedNodes: string[] = []; - this.topologicalSort((v: Vertex, t: string) => { - v.data.stage = this.names.length - t.length; - orderedNodes.push(v.name); - }); - // eslint-disable-next-line no-console - console.log(orderedNodes.join(' --> ')); - return orderedNodes.join(' --> '); - } -} diff --git a/plugins/tekton/src/components/pipeline-topology/index.ts b/plugins/tekton/src/components/pipeline-topology/index.ts deleted file mode 100644 index 710d89f5ee..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { PipelineVisualization } from './PipelineVisualization'; -export { PipelineRunVisualization } from './PipelineRunVisualization'; diff --git a/plugins/tekton/src/components/pipeline-topology/pipelineComponentFactory.tsx b/plugins/tekton/src/components/pipeline-topology/pipelineComponentFactory.tsx deleted file mode 100644 index 48b5faef60..0000000000 --- a/plugins/tekton/src/components/pipeline-topology/pipelineComponentFactory.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React from 'react'; - -import { - ComponentFactory, - DagreLayout, - DefaultTaskGroup, - Graph, - GraphComponent, - GraphElement, - LayoutFactory, - ModelKind, - PipelineDagreLayout, - SpacerNode, - TaskEdge, - withPanZoom, -} from '@patternfly/react-topology'; - -import { NodeType, PipelineLayout } from '../../consts/pipeline-topology-const'; -import { getLayoutData } from '../../utils/pipeline-topology-utils'; -import PipelineTaskNode from './PipelineTaskNode'; -import TaskGroupEdge from './TaskGroupEdge'; - -const GROUPED_EDGE_TYPE = 'GROUPED_EDGE'; - -export const layoutFactory: LayoutFactory = (type: string, graph: Graph) => { - switch (type) { - case PipelineLayout.DAGRE_BUILDER: - case PipelineLayout.DAGRE_BUILDER_SPACED: - return new DagreLayout(graph, { - // Hack to get around undesirable defaults - linkDistance: 0, - nodeDistance: 0, - groupDistance: 0, - collideDistance: 0, - simulationSpeed: 0, - chargeStrength: 0, - allowDrag: false, - layoutOnDrag: false, - ...getLayoutData(type), - }); - case PipelineLayout.DAGRE_VIEWER: - return new PipelineDagreLayout(graph, { nodesep: 25 }); - default: - return undefined; - } -}; - -const pipelineComponentFactory: ComponentFactory = ( - kind: ModelKind, - type: string, -): React.ComponentType<{ element: GraphElement }> | undefined => { - if (kind === ModelKind.graph) { - return withPanZoom()(GraphComponent) as React.ComponentType<{ - element: GraphElement; - }>; - } - if (kind === ModelKind.edge) { - return TaskEdge as React.ComponentType<{ element: GraphElement }>; - } - if (kind === ModelKind.node) { - switch (type) { - case NodeType.TASK_NODE: - case NodeType.FINALLY_NODE: - return PipelineTaskNode as React.ComponentType; - case 'task-group': - case NodeType.FINALLY_GROUP: - return DefaultTaskGroup as React.ComponentType<{ - element: GraphElement; - }>; - case NodeType.SPACER_NODE: - return SpacerNode as React.ComponentType<{ element: GraphElement }>; - case 'finally-spacer-edge': - case NodeType.EDGE: - return TaskEdge as React.ComponentType<{ element: GraphElement }>; - case GROUPED_EDGE_TYPE: - return TaskGroupEdge as React.ComponentType<{ element: GraphElement }>; - default: - return undefined; - } - } - return undefined; -}; - -export default pipelineComponentFactory; diff --git a/plugins/tekton/src/consts/pipeline-topology-const.ts b/plugins/tekton/src/consts/pipeline-topology-const.ts deleted file mode 100644 index 6e4e78c7c3..0000000000 --- a/plugins/tekton/src/consts/pipeline-topology-const.ts +++ /dev/null @@ -1,110 +0,0 @@ -import * as dagre from 'dagre'; - -export const NODE_SEPARATION_HORIZONTAL = 25; -export const NODE_SEPARATION_VERTICAL = 20; -export const DROP_SHADOW_SPACING = 5; -export const BUILDER_NODE_ADD_RADIUS = 9; -export const BUILDER_NODE_DECORATOR_RADIUS = 9; -export const BUILDER_NODE_ADD_PADDING = 4; - -export const NODE_WIDTH = 120; -export const NODE_HEIGHT = 30; -export const FINALLY_NODE_PADDING = 30; -export const FINALLY_NODE_VERTICAL_SPACING = 20; - -export const FINALLY_ADD_LINK_TEXT_HEIGHT = 10; -export const FINALLY_ADD_LINK_SIZE = 15; -export const WHEN_EXPRESSSION_DIAMOND_SIZE = 10; -export const WHEN_EXPRESSION_SPACING = 25; - -export const DEFAULT_NODE_HEIGHT = 32; -export const NODE_PADDING = 12; -export const DEFAULT_NODE_ICON_WIDTH = 30; -export const DEFAULT_BADGE_WIDTH = 40; -export const DEFAULT_FINALLLY_GROUP_PADDING = 35; -export const TOOLBAR_HEIGHT = 40; -export const GRAPH_MIN_WIDTH = 300; -export const GRAPH_MAX_HEIGHT_PERCENT = 45; - -export enum NodeType { - TASK_NODE = 'task', - SPACER_NODE = 'spacer', - LOADING_NODE = 'loading', - TASK_LIST_NODE = 'task-list', - BUILDER_NODE = 'builder', - INVALID_TASK_LIST_NODE = 'invalid-task-list', - FINALLY_NODE = 'finally-node', - BUILDER_FINALLY_NODE = 'builder-finally-node', - FINALLY_GROUP = 'finally-group', - EDGE = 'edge', -} -export enum DrawDesign { - INTEGRAL_SHAPE = 'integral-shape', - STRAIGHT = 'line', -} -export enum PipelineLayout { - DAGRE_BUILDER = 'dagre-builder', - DAGRE_BUILDER_SPACED = 'dagre-builder-spaced', - DAGRE_VIEWER = 'dagre-viewer', - DAGRE_VIEWER_SPACED = 'dagre-viewer-spaced', -} - -export enum AddNodeDirection { - /** - * Rules today: - * - the `relatedTask` is pointing at ONLY us - * - we inherit all that `relatedTask` is pointing at - */ - BEFORE = 'in-run-after', - - /** - * Rules today: - * - the `relatedTask` must be our ONLY runAfter - * - we are added to all that is pointing at `relatedTask` - */ - AFTER = 'has-run-after', - - /** - * Rules today: - * - we inherit all that `relatedTask` is pointing at - * - we are added to all that is pointing at `relatedTask` - */ - PARALLEL = 'shared-parallel', -} - -const DAGRE_SHARED_PROPS: dagre.GraphLabel = { - nodesep: NODE_SEPARATION_VERTICAL, - ranksep: NODE_SEPARATION_HORIZONTAL, - edgesep: 50, - ranker: 'longest-path', - rankdir: 'LR', - marginx: 20, - marginy: 20, -}; -export const DAGRE_VIEWER_PROPS: dagre.GraphLabel = { - ...DAGRE_SHARED_PROPS, -}; -export const DAGRE_VIEWER_SPACED_PROPS: dagre.GraphLabel = { - ...DAGRE_VIEWER_PROPS, - ranksep: NODE_SEPARATION_HORIZONTAL + WHEN_EXPRESSION_SPACING, -}; -export const DAGRE_BUILDER_PROPS: dagre.GraphLabel = { - ...DAGRE_SHARED_PROPS, - ranksep: NODE_SEPARATION_HORIZONTAL + BUILDER_NODE_ADD_RADIUS * 2, - nodesep: NODE_SEPARATION_VERTICAL + BUILDER_NODE_ADD_RADIUS, - marginx: DAGRE_SHARED_PROPS.marginx ?? 0 + BUILDER_NODE_ADD_RADIUS * 2, - marginy: DAGRE_SHARED_PROPS.marginy ?? 0 + BUILDER_NODE_ADD_RADIUS * 2, -}; - -export const DAGRE_BUILDER_SPACED_PROPS: dagre.GraphLabel = { - ...DAGRE_BUILDER_PROPS, - ranksep: - NODE_SEPARATION_HORIZONTAL + - WHEN_EXPRESSION_SPACING + - BUILDER_NODE_ADD_RADIUS * 2, -}; - -export const GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL = 200; - -export const REGEX_EXTRACT_DEPS = - /(?:\$\(tasks\.)([a-z0-9_-]+)(?:.results)(?:[.^\w]+\))/g; diff --git a/plugins/tekton/src/consts/tekton-const.ts b/plugins/tekton/src/consts/tekton-const.ts deleted file mode 100644 index 1d71c1f9ed..0000000000 --- a/plugins/tekton/src/consts/tekton-const.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const TEKTON_CI_ANNOTATION = 'janus-idp.io/tekton'; -export const TEKTON_PIPELINE_TASK = 'tekton.dev/pipelineTask'; -export const TEKTON_PIPELINE_RUN = 'tekton.dev/pipelineRun'; -export const TEKTON_PIPELINE_TASKRUN = 'tekton.dev/taskRun'; -export const TEKTON_SIGNED_ANNOTATION = 'chains.tekton.dev/signed'; diff --git a/plugins/tekton/src/globals.d.ts b/plugins/tekton/src/globals.d.ts deleted file mode 100644 index 006534e235..0000000000 --- a/plugins/tekton/src/globals.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.svg' { - const content: React.FunctionComponent>; - export default content; -} diff --git a/plugins/tekton/src/hooks/TektonResourcesContext.ts b/plugins/tekton/src/hooks/TektonResourcesContext.ts deleted file mode 100644 index 9e71f3621b..0000000000 --- a/plugins/tekton/src/hooks/TektonResourcesContext.ts +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; - -import { ComputedStatus } from '@janus-idp/shared-react'; - -import { TektonResourcesContextData } from '../types/types'; - -export const TektonResourcesContext = - React.createContext({ - clusters: [], - selectedStatus: ComputedStatus.All, - setSelectedCluster: () => {}, - setSelectedStatus: () => {}, - setIsExpanded: () => {}, - }); diff --git a/plugins/tekton/src/hooks/useAllWatchResources.test.ts b/plugins/tekton/src/hooks/useAllWatchResources.test.ts deleted file mode 100644 index 1ad4993e8f..0000000000 --- a/plugins/tekton/src/hooks/useAllWatchResources.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { KubernetesObjects } from '@backstage/plugin-kubernetes-react'; - -import { renderHook } from '@testing-library/react'; - -import { kubernetesObjects } from '../__fixtures__/kubernetesObject'; -import { ModelsPlural } from '../models'; -import { useAllWatchResources } from './useAllWatchResources'; - -const watchedResources = [ModelsPlural.pipelineruns, ModelsPlural.taskruns]; - -describe('useAllWatchResources', () => { - it('should return watchResourcesData as empty if no resources found', () => { - const k8sObjectsResponse = { - loading: false, - error: '', - } as KubernetesObjects; - const { result } = renderHook(() => - useAllWatchResources(k8sObjectsResponse, 0, watchedResources), - ); - expect(result.current).toEqual({}); - }); - - it('should return watchResourcesData if resources are present', () => { - const k8sObjectsResponse = { - kubernetesObjects, - loading: false, - error: '', - } as KubernetesObjects; - const { result } = renderHook(() => - useAllWatchResources(k8sObjectsResponse, 0, watchedResources), - ); - expect(result.current?.pipelineruns?.data).toHaveLength(5); - expect(result.current?.taskruns).toBeUndefined(); - }); - - it('should return watchResourcesData as empty if resources are present but it is not in in watchedResources', () => { - const k8sObjectsResponse = { - kubernetesObjects, - loading: false, - error: '', - } as KubernetesObjects; - const { result } = renderHook(() => - useAllWatchResources(k8sObjectsResponse, 0, []), - ); - expect(result.current).toEqual({}); - }); - - it('should update watchResourcesData as per API response', () => { - let k8sObjectsResponse = { - loading: false, - error: '', - } as KubernetesObjects; - const { result, rerender } = renderHook(() => - useAllWatchResources(k8sObjectsResponse, 0, watchedResources), - ); - expect(result.current).toEqual({}); - - k8sObjectsResponse = { - kubernetesObjects, - loading: false, - error: '', - } as KubernetesObjects; - rerender(); - expect(result.current?.pipelineruns?.data).toHaveLength(5); - }); -}); diff --git a/plugins/tekton/src/hooks/useAllWatchResources.ts b/plugins/tekton/src/hooks/useAllWatchResources.ts deleted file mode 100644 index c9d5adc7e4..0000000000 --- a/plugins/tekton/src/hooks/useAllWatchResources.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { useEffect, useMemo, useState } from 'react'; - -import { KubernetesObjects } from '@backstage/plugin-kubernetes-react'; - -import { useDeepCompareMemoize } from '@janus-idp/shared-react'; - -import { TektonResponseData } from '../types/types'; -import { getTektonResources } from '../utils/tekton-utils'; - -export const useAllWatchResources = ( - k8sObjectsResponse: KubernetesObjects, - cluster: number, - watchedResource: string[] = [], -): TektonResponseData => { - const { kubernetesObjects, loading, error } = k8sObjectsResponse; - const [resources, setResources] = useState({}); - - useEffect(() => { - let isMounted = true; - if (isMounted && !loading && kubernetesObjects && !error) { - const tektonResources: TektonResponseData = getTektonResources( - cluster, - kubernetesObjects, - ); - if (tektonResources) { - setResources(tektonResources); - } - } - return () => { - isMounted = false; - }; - }, [loading, kubernetesObjects, error, cluster]); - - const watchResourcesData = useMemo(() => { - return watchedResource.reduce((acc: TektonResponseData, resKind) => { - if (resources[resKind]) { - acc[resKind] = resources[resKind]; - } - return acc; - }, {}); - }, [watchedResource, resources]); - - return useDeepCompareMemoize(watchResourcesData); -}; diff --git a/plugins/tekton/src/hooks/useDarkTheme.test.ts b/plugins/tekton/src/hooks/useDarkTheme.test.ts deleted file mode 100644 index 8b97f7119c..0000000000 --- a/plugins/tekton/src/hooks/useDarkTheme.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { useTheme } from '@material-ui/core/styles'; -import { renderHook } from '@testing-library/react'; - -import { useDarkTheme } from './useDarkTheme'; - -jest.mock('@material-ui/core/styles', () => ({ - useTheme: jest.fn(), -})); - -const useThemeMock = useTheme as jest.Mock; - -describe('useDarkTheme', () => { - it('should add dark theme class to html tag', () => { - useThemeMock.mockReturnValue({ - palette: { - type: 'dark', - }, - }); - renderHook(() => useDarkTheme()); - const htmlTagElement = document.documentElement; - expect(htmlTagElement.classList.contains('pf-v5-theme-dark')).toBe(true); - }); - - it('should remove dark theme class from html tag', () => { - useThemeMock.mockReturnValue({ - palette: { - type: 'light', - }, - }); - renderHook(() => useDarkTheme()); - const htmlTagElement = document.documentElement; - expect(htmlTagElement.classList.contains('pf-v5-theme-dark')).toBe(false); - }); -}); diff --git a/plugins/tekton/src/hooks/useDarkTheme.ts b/plugins/tekton/src/hooks/useDarkTheme.ts deleted file mode 100644 index 24f48bbedf..0000000000 --- a/plugins/tekton/src/hooks/useDarkTheme.ts +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; - -import { useTheme } from '@material-ui/core/styles'; - -const THEME_DARK = 'dark'; -const THEME_DARK_CLASS = 'pf-v5-theme-dark'; - -export const useDarkTheme = () => { - const { - palette: { type }, - } = useTheme(); - - React.useEffect(() => { - const htmlTagElement = document.documentElement; - if (type === THEME_DARK) { - htmlTagElement.classList.add(THEME_DARK_CLASS); - } else { - htmlTagElement.classList.remove(THEME_DARK_CLASS); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [type]); -}; diff --git a/plugins/tekton/src/hooks/usePipelineRunScanResults.test.ts b/plugins/tekton/src/hooks/usePipelineRunScanResults.test.ts deleted file mode 100644 index aff80554a9..0000000000 --- a/plugins/tekton/src/hooks/usePipelineRunScanResults.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { renderHook } from '@testing-library/react'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { usePipelineRunScanResults } from './usePipelineRunScanResults'; - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useApi: jest.fn(), -})); - -describe('usePipelineRunVulnerabilities', () => { - it('should return vulnerabilities when SCAN_OUTPUT is set', () => { - const { result } = renderHook(() => - usePipelineRunScanResults(mockKubernetesPlrResponse.pipelineruns[2]), - ); - - expect(result.current.vulnerabilities?.critical).toEqual(13); - expect(result.current.vulnerabilities?.high).toEqual(29); - expect(result.current.vulnerabilities?.medium).toEqual(32); - expect(result.current.vulnerabilities?.low).toEqual(3); - }); - it('should return vulnerabilities when the suffix SCAN_OUTPUT is set', () => { - const { result } = renderHook(() => - usePipelineRunScanResults(mockKubernetesPlrResponse.pipelineruns[4]), - ); - - expect(result.current.vulnerabilities?.critical).toEqual(1); - expect(result.current.vulnerabilities?.high).toEqual(9); - expect(result.current.vulnerabilities?.medium).toEqual(20); - expect(result.current.vulnerabilities?.low).toEqual(1); - }); - it('should accumulate all vulnerabilities', () => { - const { result } = renderHook(() => { - const results4 = - mockKubernetesPlrResponse.pipelineruns[4].status.pipelineResults?.[0]; - const results1 = - mockKubernetesPlrResponse.pipelineruns[2].status.results?.[0]; - const plr = { - ...mockKubernetesPlrResponse.pipelineruns[2], - status: { - ...mockKubernetesPlrResponse.pipelineruns[2].status, - results: results4 && results1 ? [results4, results1] : [], - }, - }; - return usePipelineRunScanResults(plr); - }); - - expect(result.current.vulnerabilities?.critical).toEqual(14); - expect(result.current.vulnerabilities?.high).toEqual(38); - expect(result.current.vulnerabilities?.medium).toEqual(52); - expect(result.current.vulnerabilities?.low).toEqual(4); - }); -}); diff --git a/plugins/tekton/src/hooks/usePipelineRunScanResults.ts b/plugins/tekton/src/hooks/usePipelineRunScanResults.ts deleted file mode 100644 index 68014444b7..0000000000 --- a/plugins/tekton/src/hooks/usePipelineRunScanResults.ts +++ /dev/null @@ -1,49 +0,0 @@ -import * as React from 'react'; - -import { PipelineRunKind } from '@janus-idp/shared-react'; - -import { PipelineRunScanResults } from '../types/types'; - -const SCAN_OUTPUT_SUFFIX = 'SCAN_OUTPUT'; - -export const getPipelineRunScanResults = ( - pipelineRun: PipelineRunKind, -): PipelineRunScanResults => - (pipelineRun.status?.results || pipelineRun.status?.pipelineResults)?.reduce( - (acc, result) => { - if (result.name?.endsWith(SCAN_OUTPUT_SUFFIX)) { - if (!acc.vulnerabilities) { - acc.vulnerabilities = { critical: 0, high: 0, medium: 0, low: 0 }; - } - try { - const taskVulnerabilities = JSON.parse(result.value); - if (taskVulnerabilities.vulnerabilities) { - acc.vulnerabilities.critical += - taskVulnerabilities.vulnerabilities.critical || 0; - acc.vulnerabilities.high += - taskVulnerabilities.vulnerabilities.high || 0; - acc.vulnerabilities.medium += - taskVulnerabilities.vulnerabilities.medium || 0; - acc.vulnerabilities.low += - taskVulnerabilities.vulnerabilities.low || 0; - } - } catch (e) { - // ignore - } - } - return acc; - }, - {} as PipelineRunScanResults, - ) || {}; - -export const usePipelineRunScanResults = ( - pipelineRun: PipelineRunKind, -): PipelineRunScanResults => { - return React.useMemo(() => { - if (!pipelineRun) { - return {}; - } - - return getPipelineRunScanResults(pipelineRun); - }, [pipelineRun]); -}; diff --git a/plugins/tekton/src/hooks/usePodContainerLogs.test.ts b/plugins/tekton/src/hooks/usePodContainerLogs.test.ts deleted file mode 100644 index cda29cfe77..0000000000 --- a/plugins/tekton/src/hooks/usePodContainerLogs.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { useApi } from '@backstage/core-plugin-api'; - -import { renderHook, waitFor } from '@testing-library/react'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { usePodContainerLogs } from './usePodContainerLogs'; - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useApi: jest.fn(), -})); - -describe('usePodContainerLogs', () => { - it('should return loading as true and value as undefined initially', async () => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockResolvedValue({ text: 'log data...' }), - }); - const { result } = renderHook(() => - usePodContainerLogs({ - pod: mockKubernetesPlrResponse.pods[0] as any, - containerName: - mockKubernetesPlrResponse.pods[0].spec.containers[0].name, - }), - ); - - await waitFor(() => { - expect(result.current.loading).toEqual(true); - }); - - await waitFor(() => expect(result.current.value).toBeUndefined()); - }); - - it('should return value as log text', async () => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockResolvedValue({ text: 'log data...' }), - }); - const { result } = renderHook(() => - usePodContainerLogs({ - pod: mockKubernetesPlrResponse.pods[0] as any, - containerName: - mockKubernetesPlrResponse.pods[0].spec.containers[0].name, - }), - ); - - await waitFor(() => { - expect(result.current.value).toEqual({ text: 'log data...' }); - }); - }); -}); diff --git a/plugins/tekton/src/hooks/usePodContainerLogs.ts b/plugins/tekton/src/hooks/usePodContainerLogs.ts deleted file mode 100644 index bc89d9426e..0000000000 --- a/plugins/tekton/src/hooks/usePodContainerLogs.ts +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react'; -import { useAsync } from 'react-use'; - -import { useApi } from '@backstage/core-plugin-api'; -import { ContainerScope } from '@backstage/plugin-kubernetes-react'; - -import { V1Pod } from '@kubernetes/client-node'; - -import { - kubernetesProxyApiRef, - TektonResourcesContextData, -} from '../types/types'; -import { TektonResourcesContext } from './TektonResourcesContext'; - -interface PodContainerLogsOptions { - pod: V1Pod | undefined; - containerName: string; - intervalMs?: number; -} - -export const usePodContainerLogs = ({ - pod, - containerName: cName, -}: PodContainerLogsOptions) => { - const [loadingData, setLoadingData] = React.useState(true); - const [, setPodInfo] = React.useState(pod?.metadata?.name ?? ''); - const kubernetesProxyApi = useApi(kubernetesProxyApiRef); - const { clusters, selectedCluster } = - React.useContext(TektonResourcesContext); - const currCluster = - (clusters.length > 0 && clusters[selectedCluster || 0]) || ''; - const getLogs = React.useCallback( - async (podScope: ContainerScope): Promise<{ text: string }> => { - const { - podName, - podNamespace, - containerName, - cluster: { name: clusterName }, - } = podScope; - return await kubernetesProxyApi.getPodLogs({ - podName: podName, - namespace: podNamespace, - containerName: containerName, - clusterName: clusterName, - }); - }, - [kubernetesProxyApi], - ); - - const { value, error, loading } = useAsync(async () => { - if (pod?.metadata?.name && pod?.metadata?.namespace) { - const podScope = { - containerName: cName, - podName: pod.metadata.name, - podNamespace: pod.metadata.namespace, - cluster: { name: currCluster }, - }; - return getLogs(podScope); - } - return null; - }, [pod, getLogs]); - - React.useEffect(() => { - let mounted = true; - if (!loading && mounted) { - setPodInfo(prevState => { - if (prevState === pod?.metadata?.name) { - setLoadingData(false); - return prevState; - } - setLoadingData(true); - return pod?.metadata?.name || ''; - }); - } - return () => { - mounted = false; - }; - }, [loading, pod]); - - return { value, error, loading: loadingData }; -}; diff --git a/plugins/tekton/src/hooks/usePodLogsOfPipelineRun.test.ts b/plugins/tekton/src/hooks/usePodLogsOfPipelineRun.test.ts deleted file mode 100644 index eb505479ea..0000000000 --- a/plugins/tekton/src/hooks/usePodLogsOfPipelineRun.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { useApi } from '@backstage/core-plugin-api'; - -import { renderHook, waitFor } from '@testing-library/react'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { usePodLogsOfPipelineRun } from './usePodLogsOfPipelineRun'; - -jest.mock('@backstage/core-plugin-api', () => ({ - ...jest.requireActual('@backstage/core-plugin-api'), - useApi: jest.fn(), -})); - -describe('usePodLogsOfPipelineRun', () => { - it('should return loading as true and value as undefined initially', async () => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockResolvedValue({ text: 'log data...' }), - }); - const { result } = renderHook(() => - usePodLogsOfPipelineRun({ - pod: mockKubernetesPlrResponse.pods[0] as any, - intervalMs: 500, - }), - ); - - await waitFor(() => { - expect(result.current.loading).toEqual(true); - }); - - await waitFor(() => expect(result.current.value).toBeUndefined()); - }); - - it('should return value as log text', async () => { - (useApi as any).mockReturnValue({ - getPodLogs: jest.fn().mockResolvedValueOnce({ text: 'log data...' }), - }); - const { result } = renderHook(() => - usePodLogsOfPipelineRun({ - pod: mockKubernetesPlrResponse.pods[0] as any, - intervalMs: 500, - }), - ); - - await waitFor(() => { - expect(result.current.value).toEqual([{ text: 'log data...' }]); - }); - }); -}); diff --git a/plugins/tekton/src/hooks/usePodLogsOfPipelineRun.ts b/plugins/tekton/src/hooks/usePodLogsOfPipelineRun.ts deleted file mode 100644 index 021c3005f1..0000000000 --- a/plugins/tekton/src/hooks/usePodLogsOfPipelineRun.ts +++ /dev/null @@ -1,93 +0,0 @@ -import React from 'react'; -import useAsyncRetry from 'react-use/lib/useAsyncRetry'; -import useInterval from 'react-use/lib/useInterval'; - -import { useApi } from '@backstage/core-plugin-api'; - -import { V1Container, V1Pod } from '@kubernetes/client-node'; - -import { - kubernetesProxyApiRef, - TektonResourcesContextData, -} from '../types/types'; -import { TektonResourcesContext } from './TektonResourcesContext'; - -export interface ContainerScope { - podName: string; - podNamespace: string; - clusterName: string; - containerName: string; -} - -interface PodLogsOptions { - pod: V1Pod; - intervalMs?: number; -} - -export const usePodLogsOfPipelineRun = ({ - pod, - intervalMs = 5000, -}: PodLogsOptions) => { - const [loadingData, setLoadingData] = React.useState(true); - const [, setPodInfo] = React.useState(pod?.metadata?.name ?? ''); - const kubernetesProxyApi = useApi(kubernetesProxyApiRef); - const { clusters, selectedCluster } = - React.useContext(TektonResourcesContext); - const currCluster = - (clusters.length > 0 && clusters[selectedCluster || 0]) || ''; - const containersList = pod?.spec?.containers || []; - const getLogs = React.useCallback( - async (podScope: ContainerScope): Promise<{ text: string }> => { - const { podName, podNamespace, containerName, clusterName } = podScope; - return await kubernetesProxyApi.getPodLogs({ - podName: podName, - namespace: podNamespace, - containerName: containerName, - clusterName: clusterName, - }); - }, - [kubernetesProxyApi], - ); - - const { value, error, loading, retry } = useAsyncRetry(async () => { - const requests: Promise<{ - text: string; - }>[] = []; - containersList.map((container: V1Container, _idx: any) => { - if (pod?.metadata?.name && pod?.metadata?.namespace && container) { - const podScope = { - containerName: container.name, - podName: pod.metadata.name, - podNamespace: pod.metadata.namespace, - clusterName: currCluster, - }; - requests.push(getLogs(podScope)); - } - }); - return requests.length > 0 ? Promise.all(requests) : []; - }, [containersList, pod, getLogs]); - - const stopPolling = - pod?.status?.phase === 'Succeeded' || pod?.status?.phase === 'Failed'; - - useInterval(() => retry(), stopPolling ? null : intervalMs); - - React.useEffect(() => { - let mounted = true; - if (!loading && mounted) { - setPodInfo(prevState => { - if (prevState === pod?.metadata?.name) { - setLoadingData(false); - return prevState; - } - setLoadingData(true); - return pod?.metadata?.name || ''; - }); - } - return () => { - mounted = false; - }; - }, [loading, pod]); - - return { value, error, loading: loadingData }; -}; diff --git a/plugins/tekton/src/hooks/useResourcesClusters.test.ts b/plugins/tekton/src/hooks/useResourcesClusters.test.ts deleted file mode 100644 index 11452e2fea..0000000000 --- a/plugins/tekton/src/hooks/useResourcesClusters.test.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { KubernetesObjects } from '@backstage/plugin-kubernetes-react'; - -import { renderHook } from '@testing-library/react'; - -import { kubernetesObjects } from '../__fixtures__/kubernetesObject'; -import { useResourcesClusters } from './useResourcesClusters'; - -describe('useResourcesClusters', () => { - it('should return clusters and errors as empty if no resources found', () => { - const k8sObjectsResponse = { - loading: true, - error: '', - }; - const { result } = renderHook(() => - useResourcesClusters(k8sObjectsResponse), - ); - expect(result.current.clusters).toEqual([]); - expect(result.current.errors).toEqual([]); - }); - - it('should return clusters and errors(if any) if resources are present', () => { - let k8sObjectsResponse = { - kubernetesObjects: kubernetesObjects, - loading: false, - error: '', - } as KubernetesObjects; - const { result, rerender } = renderHook(() => - useResourcesClusters(k8sObjectsResponse), - ); - expect(result.current.clusters).toEqual(['minikube', 'ocp']); - expect(result.current.errors).toEqual([[], []]); - - const kubernetesObjectsWithError = { - items: [ - { - ...kubernetesObjects.items[0], - errors: [ - { errorType: 'FETCH_ERROR', message: 'Couldnt fetch resources' }, - ], - }, - ], - }; - - k8sObjectsResponse = { - kubernetesObjects: kubernetesObjectsWithError, - loading: false, - error: '', - } as KubernetesObjects; - rerender(); - expect(result.current.clusters).toEqual(['minikube']); - expect(result.current.errors).toEqual([ - [{ errorType: 'FETCH_ERROR', message: 'Couldnt fetch resources' }], - ]); - }); -}); diff --git a/plugins/tekton/src/hooks/useResourcesClusters.ts b/plugins/tekton/src/hooks/useResourcesClusters.ts deleted file mode 100644 index 1637592f96..0000000000 --- a/plugins/tekton/src/hooks/useResourcesClusters.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { useEffect, useState } from 'react'; - -import { KubernetesObjects } from '@backstage/plugin-kubernetes-react'; - -import { useDeepCompareMemoize } from '@janus-idp/shared-react'; - -import { ClusterErrors } from '../types/types'; -import { getClusters } from '../utils/tekton-utils'; - -export const useResourcesClusters = (k8sObjectsResponse: KubernetesObjects) => { - const { kubernetesObjects, loading, error } = k8sObjectsResponse; - const [clusters, setClusters] = useState<{ - clusters: string[]; - errors: ClusterErrors[]; - }>({ clusters: [], errors: [] }); - - useEffect(() => { - let isMounted = true; - if (isMounted && !loading && kubernetesObjects && !error) { - const k8sResourcesClusters = getClusters(kubernetesObjects); - if (k8sResourcesClusters) { - setClusters(k8sResourcesClusters); - } - } - return () => { - isMounted = false; - }; - }, [loading, kubernetesObjects, error]); - - return useDeepCompareMemoize(clusters); -}; diff --git a/plugins/tekton/src/hooks/useTektonObjectResponse.test.ts b/plugins/tekton/src/hooks/useTektonObjectResponse.test.ts deleted file mode 100644 index 3ed7e380ad..0000000000 --- a/plugins/tekton/src/hooks/useTektonObjectResponse.test.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { act } from 'react'; - -import { renderHook, waitFor } from '@testing-library/react'; - -import { useKubernetesObjects } from '@janus-idp/shared-react'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { kubernetesObjects } from '../__fixtures__/kubernetesObject'; -import { ModelsPlural } from '../models'; -import { useTektonObjectsResponse } from './useTektonObjectsResponse'; - -const watchedResources = [ModelsPlural.pipelineruns, ModelsPlural.taskruns]; - -jest.mock('@janus-idp/shared-react', () => ({ - useKubernetesObjects: jest.fn(), - useDeepCompareMemoize: (val: any) => val, - useDebounceCallback: (val: any) => jest.fn(val), -})); - -const mockUseKubernetesObjects = useKubernetesObjects as jest.Mock; - -jest.mock('@backstage/plugin-catalog-react', () => ({ - useEntity: () => ({ - entity: { - metadata: { - name: 'test', - }, - }, - }), -})); - -const watchResourcesData = { - pipelineruns: { - data: mockKubernetesPlrResponse.pipelineruns, - }, -}; - -describe('useTektonObjectResponse', () => { - it('should return k8sResourcesContextData', async () => { - mockUseKubernetesObjects.mockReturnValue({ - kubernetesObjects, - loading: false, - error: '', - }); - const { result, rerender } = renderHook(() => - useTektonObjectsResponse(watchedResources), - ); - rerender(); - await waitFor(() => { - expect(result.current.watchResourcesData).toEqual(watchResourcesData); - expect(result.current.clusters).toEqual(['minikube', 'ocp']); - expect(result.current.selectedClusterErrors).toEqual([]); - }); - }); - - it('should be able to select a cluster and return data accordingly', async () => { - mockUseKubernetesObjects.mockReturnValue({ - kubernetesObjects, - loading: false, - error: '', - }); - const { result } = renderHook(() => - useTektonObjectsResponse(watchedResources), - ); - expect(result.current.selectedCluster).toEqual(0); - act(() => { - result.current.setSelectedCluster(1); - }); - await waitFor(() => { - expect(result.current.watchResourcesData).toEqual({}); - expect(result.current.clusters).toEqual(['minikube', 'ocp']); - expect(result.current.selectedClusterErrors).toEqual([]); - expect(result.current.selectedCluster).toEqual(1); - }); - }); - - it('should return responseError with loaded if unable to fetch data', async () => { - mockUseKubernetesObjects.mockReturnValue({ - error: - 'getaddrinfo ENOTFOUND api.rhoms-4.13-052404.dev.openshiftappsvc.org', - }); - const { result } = renderHook(() => - useTektonObjectsResponse(watchedResources), - ); - await waitFor(() => { - expect(result.current.watchResourcesData).toBeUndefined(); - expect(result.current.clusters).toEqual([]); - expect(result.current.selectedClusterErrors).toEqual([]); - expect(result.current.loaded).toEqual(true); - expect(result.current.responseError).toEqual( - 'getaddrinfo ENOTFOUND api.rhoms-4.13-052404.dev.openshiftappsvc.org', - ); - }); - }); -}); diff --git a/plugins/tekton/src/hooks/useTektonObjectsResponse.ts b/plugins/tekton/src/hooks/useTektonObjectsResponse.ts deleted file mode 100644 index 99c20752e7..0000000000 --- a/plugins/tekton/src/hooks/useTektonObjectsResponse.ts +++ /dev/null @@ -1,105 +0,0 @@ -import React from 'react'; - -import { useEntity } from '@backstage/plugin-catalog-react'; - -import { isEqual } from 'lodash'; - -import { - ComputedStatus, - useDebounceCallback, - useDeepCompareMemoize, - useKubernetesObjects, -} from '@janus-idp/shared-react'; - -import { - kubernetesApiRef, - kubernetesAuthProvidersApiRef, - TektonResourcesContextData, - TektonResponseData, -} from '../types/types'; -import { useAllWatchResources } from './useAllWatchResources'; -import { useResourcesClusters } from './useResourcesClusters'; - -export const useTektonObjectsResponse = ( - watchedResource: string[], -): TektonResourcesContextData => { - const { entity } = useEntity(); - const { kubernetesObjects, loading, error } = useKubernetesObjects( - entity, - kubernetesApiRef, - kubernetesAuthProvidersApiRef, - ); - const [selectedCluster, setSelectedCluster] = React.useState(0); - const [selectedStatus, setSelectedStatus] = React.useState( - 'All' as ComputedStatus, - ); - const [isExpanded, setIsExpanded] = React.useState(false); - const [loaded, setLoaded] = React.useState(false); - const [errorState, setErrorState] = React.useState(); - const [pipelinesData, setPipelinesData] = React.useState< - TektonResponseData | undefined - >(); - - const mounted = React.useRef(false); - - React.useEffect(() => { - mounted.current = true; - return () => { - mounted.current = false; - }; - }, []); - - const watchResourcesData = useAllWatchResources( - { kubernetesObjects, loading, error }, - selectedCluster, - watchedResource, - ); - - const resourcesClusters = useResourcesClusters({ - kubernetesObjects, - loading, - error, - }); - - const updateResults = React.useCallback( - ( - resData: TektonResponseData, - isLoading: boolean, - errorData: string | undefined, - ) => { - if (!isLoading && !errorData && mounted.current) { - setLoaded(true); - setPipelinesData(prevPipelinesData => { - if (isEqual(prevPipelinesData, resData)) { - return prevPipelinesData; - } - return resData; - }); - } else if (errorData && mounted.current) { - setLoaded(true); - setErrorState(errorData); - } - }, - [setLoaded, setPipelinesData, setErrorState], - ); - - const debouncedUpdateResources = useDebounceCallback(updateResults, 250); - - React.useEffect(() => { - debouncedUpdateResources?.(watchResourcesData, loading, error); - }, [debouncedUpdateResources, watchResourcesData, loading, error]); - - return useDeepCompareMemoize({ - watchResourcesData: pipelinesData, - loaded, - responseError: errorState, - selectedClusterErrors: resourcesClusters?.errors?.[selectedCluster] ?? [], - clusters: resourcesClusters?.clusters || [], - selectedCluster, - setSelectedCluster, - selectedStatus, - setSelectedStatus, - isExpanded, - setIsExpanded, - }); -}; diff --git a/plugins/tekton/src/hooks/useTektonViewPermission.ts b/plugins/tekton/src/hooks/useTektonViewPermission.ts deleted file mode 100644 index 8cc944ef13..0000000000 --- a/plugins/tekton/src/hooks/useTektonViewPermission.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { usePermission } from '@backstage/plugin-permission-react'; - -import { tektonViewPermission } from '@janus-idp/backstage-plugin-tekton-common'; - -export const useTektonViewPermission = () => { - const tektonViewPermissionResult = usePermission({ - permission: tektonViewPermission, - }); - - return tektonViewPermissionResult.allowed; -}; diff --git a/plugins/tekton/src/index.ts b/plugins/tekton/src/index.ts deleted file mode 100644 index f469aedcf1..0000000000 --- a/plugins/tekton/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { tektonPlugin, TektonCI } from './plugin'; -export { TEKTON_CI_ANNOTATION } from './consts/tekton-const'; -export { isTektonCIAvailable } from './components/Router'; diff --git a/plugins/tekton/src/models.ts b/plugins/tekton/src/models.ts deleted file mode 100644 index 66e61bd281..0000000000 --- a/plugins/tekton/src/models.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { GroupVersionKind, tektonGroupColor } from './types/types'; - -export const PipelineRunGVK: GroupVersionKind = { - apiVersion: 'v1', - apiGroup: 'tekton.dev', - kind: 'PipelineRun', -}; - -export const PipelineRunModel = { - ...PipelineRunGVK, - abbr: 'PLR', - color: tektonGroupColor, -}; - -export const TaskRunGVK: GroupVersionKind = { - apiVersion: 'v1', - apiGroup: 'tekton.dev', - kind: 'TaskRun', -}; - -export enum ModelsPlural { - pipelineruns = 'pipelineruns', - taskruns = 'taskruns', - pods = 'pods', -} - -export const tektonResourceModels: { [key: string]: GroupVersionKind } = { - [ModelsPlural.pipelineruns]: PipelineRunGVK, - [ModelsPlural.taskruns]: TaskRunGVK, -}; diff --git a/plugins/tekton/src/plugin.test.ts b/plugins/tekton/src/plugin.test.ts deleted file mode 100644 index 2b12f2048d..0000000000 --- a/plugins/tekton/src/plugin.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { tektonPlugin } from './plugin'; - -describe('tekton', () => { - it('should export plugin', () => { - expect(tektonPlugin).toBeDefined(); - }); -}); diff --git a/plugins/tekton/src/plugin.ts b/plugins/tekton/src/plugin.ts deleted file mode 100644 index bd7052a73d..0000000000 --- a/plugins/tekton/src/plugin.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - createApiFactory, - createComponentExtension, - createPlugin, - discoveryApiRef, - fetchApiRef, - gitlabAuthApiRef, - googleAuthApiRef, - microsoftAuthApiRef, - oktaAuthApiRef, - oneloginAuthApiRef, -} from '@backstage/core-plugin-api'; -import { - KubernetesAuthProviders, - KubernetesBackendClient, - KubernetesProxyClient, -} from '@backstage/plugin-kubernetes-react'; - -import { - kubernetesApiRef, - kubernetesAuthProvidersApiRef, - kubernetesProxyApiRef, -} from './types/types'; - -export const tektonPlugin = createPlugin({ - id: 'tekton', - apis: [ - createApiFactory({ - api: kubernetesAuthProvidersApiRef, - deps: { - gitlabAuthApi: gitlabAuthApiRef, - googleAuthApi: googleAuthApiRef, - microsoftAuthApi: microsoftAuthApiRef, - oktaAuthApi: oktaAuthApiRef, - oneloginAuthApi: oneloginAuthApiRef, - }, - factory: ({ - gitlabAuthApi, - googleAuthApi, - microsoftAuthApi, - oktaAuthApi, - oneloginAuthApi, - }) => { - const oidcProviders = { - gitlab: gitlabAuthApi, - google: googleAuthApi, - microsoft: microsoftAuthApi, - okta: oktaAuthApi, - onelogin: oneloginAuthApi, - }; - - return new KubernetesAuthProviders({ - microsoftAuthApi, - googleAuthApi, - oidcProviders, - }); - }, - }), - createApiFactory({ - api: kubernetesApiRef, - deps: { - discoveryApi: discoveryApiRef, - fetchApi: fetchApiRef, - kubernetesAuthProvidersApi: kubernetesAuthProvidersApiRef, - }, - factory: ({ discoveryApi, fetchApi, kubernetesAuthProvidersApi }) => - new KubernetesBackendClient({ - discoveryApi, - fetchApi, - kubernetesAuthProvidersApi, - }), - }), - createApiFactory({ - api: kubernetesProxyApiRef, - deps: { - kubernetesApi: kubernetesApiRef, - }, - factory: ({ kubernetesApi }) => - new KubernetesProxyClient({ - kubernetesApi, - }), - }), - ], -}); - -export const TektonCI = tektonPlugin.provide( - createComponentExtension({ - name: 'TektonCI', - component: { - lazy: () => import('./components/Router').then(m => m.Router), - }, - }), -); diff --git a/plugins/tekton/src/setupTests.ts b/plugins/tekton/src/setupTests.ts deleted file mode 100644 index 48c09b5346..0000000000 --- a/plugins/tekton/src/setupTests.ts +++ /dev/null @@ -1,2 +0,0 @@ -import '@testing-library/jest-dom'; -import 'cross-fetch/polyfill'; diff --git a/plugins/tekton/src/types/output.ts b/plugins/tekton/src/types/output.ts deleted file mode 100644 index daf2c50b6e..0000000000 --- a/plugins/tekton/src/types/output.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { TaskRunKind } from '@janus-idp/shared-react'; - -export enum TaskType { - sbom = 'sbom', - ec = 'ec', - acsImageScan = 'acsImageScan', - acsImageCheck = 'acsImageCheck', - acsDeploymentCheck = 'acsDeploymentCheck', -} - -export type OutputTaskRunGroup = { - [key in `${TaskType}TaskRun`]?: TaskRunKind; -}; diff --git a/plugins/tekton/src/types/pipeline-topology-types.ts b/plugins/tekton/src/types/pipeline-topology-types.ts deleted file mode 100644 index 7d7e7fc5b8..0000000000 --- a/plugins/tekton/src/types/pipeline-topology-types.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { - EdgeModel, - NodeModel, - RunStatus, - WhenStatus, -} from '@patternfly/react-topology'; - -import { - PipelineRunKind, - PipelineTask, - TaskRunKind, -} from '@janus-idp/shared-react'; - -import { AddNodeDirection, NodeType } from '../consts/pipeline-topology-const'; - -// Builder Callbacks -export type NewTaskListNodeCallback = (direction: AddNodeDirection) => void; -export type NewTaskNodeCallback = (resource: TaskRunKind) => void; -export type RemoveListTaskCallback = () => void; -export type NodeSelectionCallback = (nodeData: BuilderNodeModelData) => void; - -export type TaskSearchCallback = (callback: () => void) => void; - -// Node Data Models -export type PipelineRunAfterNodeModelData = { - id?: string; - width?: number; - height?: number; - selected?: boolean; - status?: RunStatus; - whenStatus?: WhenStatus; - pipelineRun?: PipelineRunKind; - label?: string; - runAfterTasks?: string[]; - task: { - name: string; - runAfter?: string[]; - }; -}; - -type FinallyTask = { - name: string; - runAfter?: string[]; - error?: string; - selected?: boolean; - disableTooltip?: boolean; - onTaskSelection?: () => void; -}; -type FinallyListTask = { - name: string; - convertList: (resource: TaskRunKind) => void; - onRemoveTask: () => void; -}; -type FinallyNodeTask = { - name: string; - runAfter: string[]; - selected?: boolean; - isFinallyTask: boolean; - finallyTasks: FinallyTask[]; -}; -export type FinallyNodeData = { - task: FinallyNodeTask; -}; - -export type PipelineBuilderTaskBase = { name: string; runAfter?: string[] }; - -export type PipelineBuilderLoadingTask = PipelineBuilderTaskBase & { - isFinallyTask: boolean; - resource: TaskRunKind; - taskRef: { - kind: string; - name: string; - }; -}; - -export type BuilderFinallyNodeData = { - task: FinallyNodeTask & { - finallyInvalidListTasks: FinallyListTask[]; - finallyLoadingTasks: PipelineBuilderLoadingTask[]; - finallyListTasks: FinallyListTask[]; - addNewFinallyListNode?: () => void; - onTaskSearch: TaskSearchCallback; - }; -}; -export type FinallyNodeModel = FinallyNodeData & { - pipelineRun?: PipelineRunKind; - isFinallyTask: boolean; -}; -export type LoadingNodeModel = PipelineRunAfterNodeModelData & { - isFinallyTask: boolean; -}; -export type BuilderFinallyNodeModel = BuilderFinallyNodeData & { - clusterTaskList: TaskRunKind[]; - namespaceTaskList: TaskRunKind[]; - namespace: string; - isFinallyTask: boolean; -}; - -export type TaskListNodeModelData = PipelineRunAfterNodeModelData & { - clusterTaskList: TaskRunKind[]; - namespaceTaskList: TaskRunKind[]; - onNewTask: NewTaskNodeCallback; - onRemoveTask: RemoveListTaskCallback | null; - onTaskSearch: TaskSearchCallback; -}; -export type BuilderNodeModelData = PipelineRunAfterNodeModelData & { - error?: string; - task: PipelineTask; - onAddNode: NewTaskListNodeCallback; - onNodeSelection: NodeSelectionCallback; -}; -export type TaskNodeModelData = PipelineRunAfterNodeModelData & { - task: PipelineTask; - pipelineRun?: PipelineRunKind; -}; - -// Graph Models -type PipelineNodeModel = NodeModel & { - data: D; - type: NodeType; -}; -export type PipelineMixedNodeModel = - PipelineNodeModel; -export type PipelineTaskNodeModel = PipelineNodeModel; -export type PipelineBuilderTaskNodeModel = - PipelineNodeModel; -export type PipelineTaskListNodeModel = - PipelineNodeModel; -export type PipelineTaskLoadingNodeModel = PipelineNodeModel; -export type PipelineFinallyNodeModel = PipelineNodeModel; -export type PipelineBuilderFinallyNodeModel = - PipelineNodeModel; - -export type PipelineEdgeModel = EdgeModel; - -// Node Creators -export type NodeCreator = ( - name: string, - data: D, -) => PipelineNodeModel; -export type NodeCreatorSetup = ( - type: NodeType, - width?: number, - height?: number, -) => NodeCreator; - -export type CheckTaskErrorMessage = (taskIndex: number) => string | undefined; diff --git a/plugins/tekton/src/types/taskRun.ts b/plugins/tekton/src/types/taskRun.ts deleted file mode 100644 index 90762e5b23..0000000000 --- a/plugins/tekton/src/types/taskRun.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { RunStatus } from '@patternfly/react-topology'; - -import { ComputedStatus, TerminatedReasons } from '@janus-idp/shared-react'; - -export type StepStatus = { - duration: string | null | undefined; - name: string; - status: RunStatus; -}; - -export type TaskStatusStep = { - name: string; - running?: { startedAt: string }; - terminated?: { - finishedAt: string; - reason: TerminatedReasons; - startedAt: string; - }; - waiting?: {}; -}; - -export type TaskStatus = { - reason: ComputedStatus; - duration?: string; - steps?: TaskStatusStep[]; -}; diff --git a/plugins/tekton/src/types/types.ts b/plugins/tekton/src/types/types.ts deleted file mode 100644 index 0d51857fc8..0000000000 --- a/plugins/tekton/src/types/types.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { createApiRef } from '@backstage/core-plugin-api'; -import { - KubernetesApi, - KubernetesAuthProvidersApi, - KubernetesProxyApi, -} from '@backstage/plugin-kubernetes-react'; - -import { ComputedStatus } from '@janus-idp/shared-react'; - -export const tektonGroupColor = '#38812f'; - -export type GroupVersionKind = { - kind: string; - apiVersion: string; - apiGroup?: string; -}; - -export type TektonResponseData = { - [key: string]: { data: any[] }; -}; - -export type ClusterError = { - errorType?: string; - message?: string; - resourcePath?: string; - statusCode?: number; -}; - -export type ClusterErrors = ClusterError[]; - -export type TektonResourcesContextData = { - watchResourcesData?: TektonResponseData; - loaded?: boolean; - responseError?: string; - selectedClusterErrors?: ClusterErrors; - clusters: string[]; - selectedCluster?: number; - setSelectedCluster: React.Dispatch>; - selectedStatus: ComputedStatus; - setSelectedStatus: React.Dispatch>; - isExpanded?: boolean; - setIsExpanded: React.Dispatch>; -}; - -export type Order = 'asc' | 'desc'; - -export type OpenRowStatus = { - [x: string]: boolean; -}; - -export type PipelineRunScanResults = { - vulnerabilities?: { - critical: number; - high: number; - medium: number; - low: number; - }; -}; - -export const kubernetesAuthProvidersApiRef = - createApiRef({ - id: 'plugin.tekton-kubernetes-auth-providers.service', - }); - -export const kubernetesApiRef = createApiRef({ - id: 'plugin.tekton-kubernetes.service', -}); - -export const kubernetesProxyApiRef = createApiRef({ - id: 'plugin.tekton-kubernetes.proxy-service', -}); diff --git a/plugins/tekton/src/utils/log-downloader-utils.test.ts b/plugins/tekton/src/utils/log-downloader-utils.test.ts deleted file mode 100644 index ff02e01b6c..0000000000 --- a/plugins/tekton/src/utils/log-downloader-utils.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { testPods } from '../__fixtures__/pods-data'; -import { ContainerScope } from '../hooks/usePodLogsOfPipelineRun'; -import { getPodLogs } from './log-downloader-utils'; - -describe('getPodLogs', () => { - it('should return empty logs if there are no pods', async () => { - const podLogsGetter = () => Promise.resolve({ text: '' }); - const logs = await getPodLogs([], podLogsGetter, 'cluster-1'); - - expect(logs).toBe(''); - }); - - it('should return logs if there are pods', async () => { - const podLogsGetter = (p: ContainerScope) => { - return Promise.resolve({ text: `${p.containerName}` }); - }; - const logs = await getPodLogs(testPods, podLogsGetter, 'cluster-1'); - - expect(logs).toBe(`STEP-TKN -step-tkn -STEP-PRINT-SBOM-RESULTS -step-print-sbom-results -STEP-PRINT-SCAN-RESULTS -step-print-scan-results`); - }); - - it('should display logs only for the pods that has logs', async () => { - const podLogsGetter = (p: ContainerScope) => { - return Promise.resolve({ text: `${p.containerName}` }); - }; - - const podsWithoutContainers = [ - testPods[0], - - { ...testPods[1], spec: { ...testPods[1].spec, containers: [] } }, - ]; - - const logs = await getPodLogs( - podsWithoutContainers, - podLogsGetter, - 'cluster-1', - ); - - expect(logs).toBe(`STEP-TKN -step-tkn -`); - }); -}); diff --git a/plugins/tekton/src/utils/log-downloader-utils.ts b/plugins/tekton/src/utils/log-downloader-utils.ts deleted file mode 100644 index eedf08902c..0000000000 --- a/plugins/tekton/src/utils/log-downloader-utils.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { V1Container, V1Pod } from '@kubernetes/client-node'; - -import { ContainerScope } from '../hooks/usePodLogsOfPipelineRun'; - -export async function getPodLogs( - pods: V1Pod[] | [], - podLogsGetter: (podScope: ContainerScope) => Promise<{ text: string }>, - currentClusterName: string, -): Promise { - const containersList = pods.map((pod: V1Pod) => pod?.spec?.containers ?? []); - const isPodAndContainerAvailable = ( - pod: V1Pod, - container: V1Container, - ): boolean => !!(pod && container); - - const requests: Promise<{ text: string }>[] = []; - containersList.forEach((containers: V1Container[], _idx: number) => { - containers.forEach((container: V1Container) => { - const pod: V1Pod = pods[_idx]; - if (isPodAndContainerAvailable(pod, container)) { - const podScope: ContainerScope = { - containerName: container.name, - podName: pod.metadata?.name ?? '', - podNamespace: pod.metadata?.namespace ?? '', - clusterName: currentClusterName, - }; - - requests.push(podLogsGetter(podScope)); - } - }); - }); - return Promise.all(requests).then(response => { - const containerFlatList = containersList.flat(1); - return response.reduce( - (acc: string, r: { text: string }, idx) => { - const container: V1Container = containerFlatList[idx]; - return acc - .concat(`${container?.name.toUpperCase()}\n${r?.text}`) - .concat(idx === containersList.length - 1 ? '' : '\n'); - }, - - '', - ); - }); -} diff --git a/plugins/tekton/src/utils/pipeline-step-utils.test.ts b/plugins/tekton/src/utils/pipeline-step-utils.test.ts deleted file mode 100644 index e46359781f..0000000000 --- a/plugins/tekton/src/utils/pipeline-step-utils.test.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - ComputedStatus, - PipelineRunKind, - PipelineTaskWithStatus, -} from '@janus-idp/shared-react'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { createStepStatus } from './pipeline-step-utils'; -import { getTaskStatus } from './pipelineRun-utils'; - -describe('createStepStatus', () => { - it('should return the task step status', () => { - const computedTask: PipelineTaskWithStatus = { - ...mockKubernetesPlrResponse.pipelineruns[0].status.pipelineSpec.tasks[0], - status: { - completionTime: '2023-04-12T10:20:18Z', - conditions: [ - { - lastTransitionTime: '2023-04-12T10:20:18Z', - message: 'All Steps have completed executing', - reason: 'Succeeded', - status: 'True', - type: 'Succeeded', - }, - ], - podName: 'nodejs-ex-git-ez4iru-deploy-pod', - startTime: '2023-04-12T10:20:11Z', - steps: [ - { - container: 'step-oc', - imageID: - 'image-registry.openshift-image-registry.svc:5000/openshift/cli@sha256:d1b63fca6a4035a7fcacba436d778fc87bb8f4057ee3d43057b9c313b091b1ba', - name: 'oc', - terminated: { - containerID: - 'cri-o://0ec330c543090c8678de1ff97bfa49fc839a1915fbf9a994c5b3e43f1f261799', - exitCode: 0, - finishedAt: '2023-04-12T10:20:18Z', - reason: 'Completed', - startedAt: '2023-04-12T10:20:17Z', - }, - }, - ], - taskSpec: { - description: - 'This task runs commands against the cluster provided by user and if not provided then where the Task is being executed.\nOpenShift is a Kubernetes distribution from Red Hat which provides oc, the OpenShift CLI that complements kubectl for simplifying deployment and configuration applications on OpenShift.', - params: [], - steps: [ - { - env: [ - { - name: 'HOME', - value: '/tekton/home', - }, - ], - image: - 'image-registry.openshift-image-registry.svc:5000/openshift/cli:latest', - name: 'oc', - resources: {}, - script: '', - }, - ], - workspaces: [], - }, - duration: '7s', - reason: 'Succeeded', - }, - }; - const step = computedTask?.status?.steps?.[0] ?? { name: '' }; - const taskStatus = getTaskStatus( - mockKubernetesPlrResponse.pipelineruns[0] as PipelineRunKind, - computedTask, - ); - const stepStatus = createStepStatus(step, taskStatus); - expect(stepStatus).toEqual({ - duration: '1s', - name: 'oc', - status: 'Succeeded', - }); - }); - - it('should return proper status values when step and status objects have missing properties', () => { - const stepStatus = createStepStatus( - { name: '' }, - { reason: ComputedStatus.Other }, - ); - expect(stepStatus).toEqual({ - duration: undefined, - name: '', - status: ComputedStatus.Other, - }); - }); -}); diff --git a/plugins/tekton/src/utils/pipeline-step-utils.ts b/plugins/tekton/src/utils/pipeline-step-utils.ts deleted file mode 100644 index 820479e173..0000000000 --- a/plugins/tekton/src/utils/pipeline-step-utils.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { ComputedStatus, TerminatedReasons } from '@janus-idp/shared-react'; - -import { StepStatus, TaskStatus, TaskStatusStep } from '../types/taskRun'; -import { calculateDuration } from './tekton-utils'; - -const getMatchingStepDuration = (matchingStep?: TaskStatusStep) => { - if (!matchingStep) return ''; - - if (matchingStep.terminated) { - return calculateDuration( - matchingStep.terminated.startedAt, - matchingStep.terminated.finishedAt, - ); - } - - if (matchingStep.running) { - return calculateDuration(matchingStep.running.startedAt); - } - - return ''; -}; - -const getMatchingStep = ( - step: { name: string }, - status: TaskStatus, -): TaskStatusStep | undefined => { - const statusSteps: TaskStatusStep[] = status.steps || []; - return statusSteps.find(statusStep => { - // In rare occasions the status step name is prefixed with `step-` - // This is likely a bug but this workaround will be temporary as it's investigated separately - return ( - statusStep.name === step.name || statusStep.name === `step-${step.name}` - ); - }); -}; - -export const createStepStatus = ( - step: { name: string }, - status: TaskStatus, -): StepStatus => { - let stepRunStatus = ComputedStatus.PipelineNotStarted; - let duration = null; - - if (!status?.reason) { - stepRunStatus = ComputedStatus.Cancelled; - } else if (status.reason === ComputedStatus['In Progress']) { - // In progress, try to get granular statuses - const matchingStep = getMatchingStep(step, status); - - if (!matchingStep) { - stepRunStatus = ComputedStatus.Pending; - } else if (matchingStep.terminated) { - stepRunStatus = - matchingStep.terminated.reason === TerminatedReasons.Completed - ? ComputedStatus.Succeeded - : ComputedStatus.Failed; - duration = getMatchingStepDuration(matchingStep); - } else if (matchingStep.running) { - stepRunStatus = ComputedStatus['In Progress']; - duration = getMatchingStepDuration(matchingStep); - } else if (matchingStep.waiting) { - stepRunStatus = ComputedStatus.Pending; - } - } else { - // Not in progress, just use the run status reason - stepRunStatus = status.reason; - - duration = - getMatchingStepDuration(getMatchingStep(step, status)) || status.duration; - } - - return { - duration, - name: step.name, - status: stepRunStatus as any, - }; -}; diff --git a/plugins/tekton/src/utils/pipeline-topology-utils.test.ts b/plugins/tekton/src/utils/pipeline-topology-utils.test.ts deleted file mode 100644 index eb0305dcab..0000000000 --- a/plugins/tekton/src/utils/pipeline-topology-utils.test.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { RunStatus, WhenStatus } from '@patternfly/react-topology'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { - extractDepsFromContextVariables, - getGraphDataModel, - getTaskWhenStatus, -} from './pipeline-topology-utils'; -import { getPipelineRun } from './pipelineRun-utils'; - -describe('getPipelineRun', () => { - it('should return the required pipeline run resource', () => { - expect( - getPipelineRun( - mockKubernetesPlrResponse.pipelineruns, - 'pipeline-test-wbvtlk', - ), - ).toEqual(mockKubernetesPlrResponse.pipelineruns[1]); - }); - - it('should return null if pipeline run doesnot exist', () => { - expect( - getPipelineRun(mockKubernetesPlrResponse.pipelineruns, 'bnb'), - ).toEqual(null); - }); -}); - -describe('extractDepsFromContextVariables', () => { - it('should return emtpy array for invalid values', () => { - expect(extractDepsFromContextVariables('')).toEqual([]); - expect(extractDepsFromContextVariables(null)).toEqual([]); - expect(extractDepsFromContextVariables(undefined)).toEqual([]); - }); - - it('should return empty array if the context variable string does not contain results', () => { - expect(extractDepsFromContextVariables('$(context.pipeline.name)')).toEqual( - [], - ); - expect( - extractDepsFromContextVariables('$(context.pipelinerun.name)'), - ).toEqual([]); - }); - - it('should return a task name if the context variable string contains results', () => { - const contextVariable = '$(tasks.task1.results.sum)'; - expect(extractDepsFromContextVariables(contextVariable)).toEqual(['task1']); - }); - - it('should return a list of task names if the context variable string contains multiple results', () => { - const contextVariable = - '$(tasks.task1.results.sum) $(tasks.task2.results.sum)'; - - expect(extractDepsFromContextVariables(contextVariable)).toEqual([ - 'task1', - 'task2', - ]); - }); -}); - -describe('getTaskWhenStatus:', () => { - const [task1] = - mockKubernetesPlrResponse.pipelineruns[0].status.pipelineSpec.tasks; - - const taskWithStatus = ( - reason: RunStatus = RunStatus.Succeeded, - when?: boolean, - ) => { - return { - ...task1, - ...(when && { - when: [ - { - input: 'params.test', - operator: 'IN', - values: ['pass'], - }, - ], - }), - status: { - reason, - conditions: [], - }, - }; - }; - - it('should return undefined if the task does not have when expression', () => { - expect(getTaskWhenStatus(taskWithStatus())).toBeUndefined(); - }); - - it('should return a matching when status', () => { - const succeededTask = { - ...taskWithStatus(RunStatus.Succeeded, true), - }; - const skippedTask = { - ...taskWithStatus(RunStatus.Skipped, true), - }; - expect(getTaskWhenStatus(succeededTask)).toBe(WhenStatus.Met); - expect(getTaskWhenStatus(skippedTask)).toBe(WhenStatus.Unmet); - }); -}); - -describe('getGraphDataModel', () => { - it('should return null for invalid values', () => { - expect(getGraphDataModel(undefined, [])).toBeNull(); - }); - - it('should return graph, nodes and edges for valid pipelineRun', () => { - const model = getGraphDataModel( - mockKubernetesPlrResponse.pipelineruns[0], - mockKubernetesPlrResponse.taskruns, - ); - expect(model?.graph).toBeDefined(); - expect(model?.nodes).toHaveLength(3); - expect(model?.edges).toHaveLength(2); - }); - - it('should include the finally group and nodes for the pipeline with finally task', () => { - const model = getGraphDataModel( - mockKubernetesPlrResponse.pipelineruns[1], - mockKubernetesPlrResponse.taskruns, - ); - const finallyGroup = model?.nodes.filter(n => n.type === 'finally-group'); - const finallyNodes = model?.nodes.filter(n => n.type === 'finally-node'); - - expect(finallyGroup).toHaveLength(1); - expect(finallyNodes).toHaveLength(1); - }); -}); diff --git a/plugins/tekton/src/utils/pipeline-topology-utils.ts b/plugins/tekton/src/utils/pipeline-topology-utils.ts deleted file mode 100644 index 9ab58d492a..0000000000 --- a/plugins/tekton/src/utils/pipeline-topology-utils.ts +++ /dev/null @@ -1,367 +0,0 @@ -import { - EdgeModel, - getEdgesFromNodes, - getSpacerNodes, - GraphModel, - ModelKind, - RunStatus, - WhenStatus, -} from '@patternfly/react-topology'; -import * as dagre from 'dagre'; -import { minBy, uniq } from 'lodash'; - -import { - ComputedStatus, - PipelineRunKind, - PipelineTask, - PipelineTaskParam, - PipelineTaskWithStatus, - TaskRunKind, -} from '@janus-idp/shared-react'; - -import { DAG, Vertex } from '../components/pipeline-topology/dag'; -import { - DAGRE_BUILDER_PROPS, - DAGRE_BUILDER_SPACED_PROPS, - DAGRE_VIEWER_PROPS, - DAGRE_VIEWER_SPACED_PROPS, - DEFAULT_BADGE_WIDTH, - DEFAULT_FINALLLY_GROUP_PADDING, - DEFAULT_NODE_HEIGHT, - DEFAULT_NODE_ICON_WIDTH, - FINALLY_NODE_PADDING, - NODE_HEIGHT, - NODE_PADDING, - NODE_WIDTH, - NodeType, - PipelineLayout, - REGEX_EXTRACT_DEPS, - WHEN_EXPRESSION_SPACING, -} from '../consts/pipeline-topology-const'; -import { - FinallyNodeModel, - LoadingNodeModel, - NodeCreator, - NodeCreatorSetup, - PipelineEdgeModel, - PipelineMixedNodeModel, - PipelineRunAfterNodeModelData, -} from '../types/pipeline-topology-types'; -import { appendPipelineRunStatus, getPLRTaskRuns } from './pipelineRun-utils'; - -const createGenericNode: NodeCreatorSetup = - (type, width?, height?) => (name, data) => ({ - id: name, - label: data?.label || name, - runAfterTasks: data?.runAfterTasks || [], - ...(data && { data }), - height: height ?? NODE_HEIGHT, - width: width ?? NODE_WIDTH, - type, - }); - -const getMaxFinallyNode = (finallyTaskList: PipelineTaskWithStatus[]) => { - const sortedFinallyTaskList = [...finallyTaskList].sort( - (a, b) => b.name.length - a.name.length, - ); - return sortedFinallyTaskList[0]?.name || ''; -}; - -export const createFinallyNode = ( - height: number, -): NodeCreator => - createGenericNode( - NodeType.FINALLY_NODE, - NODE_WIDTH + WHEN_EXPRESSION_SPACING + FINALLY_NODE_PADDING * 2, - height, - ); - -export const createLoadingNode: NodeCreator = - createGenericNode(NodeType.LOADING_NODE); - -const createPipelineTaskNode = ( - type: NodeType, - data: PipelineRunAfterNodeModelData, -) => createGenericNode(type, data.width, data.height)(data.id ?? '', data); - -export const getTextWidth = ( - text: string, - font: string = '0.8rem RedHatText', -): number => { - if (!text || text.length === 0) { - return 0; - } - const canvas = document.createElement('canvas'); - const context = canvas.getContext('2d'); - if (!context) { - return text.length; - } - context.font = font; - const { width } = context.measureText(text); - return width; -}; - -export const extractDepsFromContextVariables = ( - contextVariable: string | null | undefined, -) => { - let matches; - const deps: string[] = []; - if (!contextVariable) { - return deps; - } - // eslint-disable-next-line no-cond-assign - while ((matches = REGEX_EXTRACT_DEPS.exec(contextVariable)) !== null) { - // This is necessary to avoid infinite loops with zero-width matches - if (matches.index === REGEX_EXTRACT_DEPS.lastIndex) { - REGEX_EXTRACT_DEPS.lastIndex++; - } - if (matches) { - if (!deps.includes(matches[1])) { - deps.push(matches[1]); - } - } - } - return deps; -}; - -export const getSpacerNode = ( - node: PipelineMixedNodeModel, -): PipelineMixedNodeModel => ({ - ...node, - height: 1, - width: 1, -}); - -export const getWhenStatus = ( - status: ComputedStatus, -): WhenStatus | undefined => { - switch (status) { - case ComputedStatus.Succeeded: - case ComputedStatus.Failed: - return WhenStatus.Met; - case ComputedStatus.Skipped: - case ComputedStatus['In Progress']: - case ComputedStatus.Idle: - return WhenStatus.Unmet; - default: - return undefined; - } -}; - -export const getTaskWhenStatus = ( - task: PipelineTaskWithStatus, -): WhenStatus | undefined => { - if (!task.when) { - return undefined; - } - return getWhenStatus(task.status?.reason as ComputedStatus); -}; - -const getDepsFromContextVariables = (task: PipelineTask) => { - const depsFromContextVariables: string[] = []; - if (task.params) { - task.params.forEach((p: PipelineTaskParam) => { - if (Array.isArray(p.value)) { - p.value.forEach(paramValue => { - depsFromContextVariables.push( - ...extractDepsFromContextVariables(paramValue), - ); - }); - } else { - depsFromContextVariables.push( - ...extractDepsFromContextVariables(p.value), - ); - } - }); - } - if (task?.when) { - task.when.forEach(({ input, values }) => { - depsFromContextVariables.push(...extractDepsFromContextVariables(input)); - values.forEach((whenValue: string) => { - depsFromContextVariables.push( - ...extractDepsFromContextVariables(whenValue), - ); - }); - }); - } - return depsFromContextVariables; -}; - -const getRunAfterTasks = (task: PipelineTask, dag: DAG, vertex: Vertex) => { - const runAfterTasks: string[] = []; - const depsFromContextVariables = getDepsFromContextVariables(task); - - const dependancies = uniq([...vertex.dependancyNames]); - if (dependancies) { - dependancies.forEach(dep => { - const depObj = dag.vertices.get(dep) as Vertex; - if ( - depObj.level - vertex.level <= 1 || - vertex.data.runAfter?.includes(depObj.name) - ) { - runAfterTasks.push(dep); - } - }); - } - if (depsFromContextVariables.length > 0) { - const v = depsFromContextVariables.map(d => { - return dag.vertices.get(d) as Vertex; - }); - const minLevelDep = minBy(v, (d: Vertex) => d.level) as Vertex; - const nearestDeps = v.filter(v1 => v1.level === minLevelDep.level); - nearestDeps.forEach(nd => { - if (nd.level - vertex.level <= 1 || vertex.dependancyNames.length === 0) { - runAfterTasks.push(nd.name); - } - }); - } - return runAfterTasks; -}; - -export const getGraphDataModel = ( - pipelineRun: PipelineRunKind | undefined, - taskRuns: TaskRunKind[], -): { - graph: GraphModel; - nodes: PipelineMixedNodeModel[]; - edges: EdgeModel[]; -} | null => { - if (!pipelineRun) { - return null; - } - - const plrTaskRuns = getPLRTaskRuns(taskRuns, pipelineRun?.metadata?.name); - - const taskList = appendPipelineRunStatus(pipelineRun, plrTaskRuns); - - const dag = new DAG(); - taskList?.forEach((task: PipelineTask) => { - dag.addEdges(task.name, task, '', task.runAfter || []); - }); - - const nodes: PipelineMixedNodeModel[] = []; - const maxWidthForLevel: { [key: string]: number } = {}; - dag.topologicalSort((v: Vertex) => { - if (!maxWidthForLevel[v.level]) { - maxWidthForLevel[v.level] = getTextWidth(v.name); - } else { - maxWidthForLevel[v.level] = Math.max( - maxWidthForLevel[v.level], - getTextWidth(v.name), - ); - } - }); - dag.topologicalSort((vertex: Vertex) => { - const task = vertex.data as PipelineTask; - const runAfterTasks = getRunAfterTasks(task, dag, vertex); - const badgePadding = - Object.keys(pipelineRun.spec)?.length > 0 ? DEFAULT_BADGE_WIDTH : 0; - const isTaskSkipped = pipelineRun?.status?.skippedTasks?.some( - t => t.name === task.name, - ); - nodes.push( - createPipelineTaskNode(NodeType.TASK_NODE, { - id: vertex.name, - label: vertex.name, - width: - maxWidthForLevel[vertex.level] + - NODE_PADDING * 2 + - DEFAULT_NODE_ICON_WIDTH + - badgePadding, - runAfterTasks, - status: isTaskSkipped ? RunStatus.Skipped : vertex.data.status?.reason, - whenStatus: getTaskWhenStatus(vertex.data), - task: vertex.data, - pipelineRun, - }), - ); - }); - - const finallyTaskList = appendPipelineRunStatus( - pipelineRun, - plrTaskRuns, - true, - ); - - const finallyNodes = finallyTaskList.map(fTask => { - const isTaskSkipped = pipelineRun?.status?.skippedTasks?.some( - t => t.name === fTask.name, - ); - - return createPipelineTaskNode(NodeType.FINALLY_NODE, { - id: fTask.name, - label: fTask.name, - width: - getTextWidth(getMaxFinallyNode(finallyTaskList)) + - NODE_PADDING * 2 + - DEFAULT_FINALLLY_GROUP_PADDING * 2, - height: DEFAULT_NODE_HEIGHT, - runAfterTasks: [], - status: isTaskSkipped - ? RunStatus.Skipped - : (fTask.status?.reason as RunStatus), - whenStatus: getTaskWhenStatus(fTask), - task: fTask, - pipelineRun, - }); - }); - - const finallyGroup = finallyNodes.length - ? [ - { - id: 'finally-group-id', - type: NodeType.FINALLY_GROUP, - children: finallyNodes.map(n => n.id), - group: true, - style: { padding: DEFAULT_FINALLLY_GROUP_PADDING }, - }, - ] - : []; - const spacerNodes: PipelineMixedNodeModel[] = ( - getSpacerNodes([...nodes, ...finallyNodes], NodeType.SPACER_NODE, [ - NodeType.FINALLY_NODE, - ]) as PipelineMixedNodeModel[] - ).map(getSpacerNode); - - const edges: PipelineEdgeModel[] = getEdgesFromNodes( - [...nodes, ...spacerNodes, ...finallyNodes], - NodeType.SPACER_NODE, - NodeType.EDGE, - NodeType.EDGE, - [NodeType.FINALLY_NODE], - NodeType.EDGE, - ); - - return { - graph: { - id: `${pipelineRun?.metadata?.name}-graph`, - type: ModelKind.graph, - layout: PipelineLayout.DAGRE_VIEWER, - scaleExtent: [0.5, 1], - }, - nodes: [ - ...nodes, - ...spacerNodes, - ...finallyNodes, - ...finallyGroup, - ] as PipelineMixedNodeModel[], - edges, - }; -}; - -export const getLayoutData = ( - layout: PipelineLayout, -): dagre.GraphLabel | null => { - switch (layout) { - case PipelineLayout.DAGRE_BUILDER: - return DAGRE_BUILDER_PROPS; - case PipelineLayout.DAGRE_VIEWER: - return DAGRE_VIEWER_PROPS; - case PipelineLayout.DAGRE_VIEWER_SPACED: - return DAGRE_VIEWER_SPACED_PROPS; - case PipelineLayout.DAGRE_BUILDER_SPACED: - return DAGRE_BUILDER_SPACED_PROPS; - default: - return null; - } -}; diff --git a/plugins/tekton/src/utils/pipelineRun-utils.test.ts b/plugins/tekton/src/utils/pipelineRun-utils.test.ts deleted file mode 100644 index 710faa2f2d..0000000000 --- a/plugins/tekton/src/utils/pipelineRun-utils.test.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { - ComputedStatus, - SucceedConditionReason, - TaskRunKind, -} from '@janus-idp/shared-react'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { appendPipelineRunStatus, getPLRTaskRuns } from './pipelineRun-utils'; - -describe('pipelineRun-utils', () => { - it('should append Pending status if a taskrun status reason is missing', () => { - const pipelineRun = mockKubernetesPlrResponse.pipelineruns[0]; - const pipelineRunWithoutStatus = { ...pipelineRun }; - const plrTaskRuns = getPLRTaskRuns( - mockKubernetesPlrResponse.taskruns, - mockKubernetesPlrResponse.pipelineruns[0].metadata.name, - ); - - const taskList = appendPipelineRunStatus( - pipelineRunWithoutStatus, - plrTaskRuns, - ); - expect( - taskList.filter(t => t?.status.reason === ComputedStatus.Pending), - ).toHaveLength(2); - }); - - it('should append pipelineRun running status for all the tasks', () => { - const plrTaskRuns = getPLRTaskRuns( - mockKubernetesPlrResponse.taskruns, - mockKubernetesPlrResponse.pipelineruns[0].metadata.name, - ); - - const taskList = appendPipelineRunStatus( - mockKubernetesPlrResponse.pipelineruns[0], - plrTaskRuns, - ); - expect( - taskList.filter(t => t.status.reason === ComputedStatus.Running), - ).toHaveLength(1); - }); - - it('should append pipelineRun pending status for all the tasks if taskruns are not present and pipelinerun status is PipelineRunPending', () => { - const pipelineRun = { ...mockKubernetesPlrResponse.pipelineruns[0] }; - pipelineRun.status.conditions[0] = { - ...pipelineRun.status.conditions[0], - reason: SucceedConditionReason.PipelineRunPending, - }; - const taskList = appendPipelineRunStatus(pipelineRun, {}); - expect( - taskList.filter(t => t.status.reason === ComputedStatus.Idle), - ).toHaveLength(pipelineRun.status.pipelineSpec.tasks.length); - }); - - it('should append pipelineRun cancelled status for all the tasks if taskruns are not present and pipelinerun status is PipelineRunCancelled', () => { - const pipelineRun = { ...mockKubernetesPlrResponse.pipelineruns[0] }; - pipelineRun.status.conditions[0] = { - ...pipelineRun.status.conditions[0], - reason: SucceedConditionReason.PipelineRunCancelled, - }; - const taskList = appendPipelineRunStatus(pipelineRun, {}); - expect( - taskList.filter(t => t.status.reason === ComputedStatus.Cancelled), - ).toHaveLength(pipelineRun.status.pipelineSpec.tasks.length); - }); - - it('should append status to only pipeline tasks if isFinallyTasks is false', () => { - const pipelineRun = { ...mockKubernetesPlrResponse.pipelineruns[1] }; - const plrTaskRuns = getPLRTaskRuns( - mockKubernetesPlrResponse.taskruns, - pipelineRun.metadata.name, - ); - const taskList = appendPipelineRunStatus(pipelineRun, plrTaskRuns); - expect(taskList).toHaveLength(3); - }); - - it('should append status to only finally tasks if isFinallyTasks is true', () => { - const pipelineRun = { ...mockKubernetesPlrResponse.pipelineruns[1] }; - const plrTaskRuns = getPLRTaskRuns( - mockKubernetesPlrResponse.taskruns, - pipelineRun.metadata.name, - ); - const taskList = appendPipelineRunStatus(pipelineRun, plrTaskRuns, true); - expect(taskList).toHaveLength(1); - }); - - it('should return empty array if there are no finally tasks but isFinallyTasks is true', () => { - const pipelineRun = { ...mockKubernetesPlrResponse.pipelineruns[0] }; - const plrTaskRuns = getPLRTaskRuns( - mockKubernetesPlrResponse.taskruns as TaskRunKind[], - pipelineRun.metadata.name, - ); - const taskList = appendPipelineRunStatus(pipelineRun, plrTaskRuns, true); - expect(taskList).toHaveLength(0); - }); -}); diff --git a/plugins/tekton/src/utils/pipelineRun-utils.ts b/plugins/tekton/src/utils/pipelineRun-utils.ts deleted file mode 100644 index 7ff302c0de..0000000000 --- a/plugins/tekton/src/utils/pipelineRun-utils.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { cloneDeep, each, find, get, isEmpty, isFinite, trim } from 'lodash'; - -import { - ComputedStatus, - pipelineRunFilterReducer, - PipelineRunKind, - pipelineRunStatus, - PipelineTask, - PipelineTaskWithStatus, - PLRTaskRuns, - SucceedConditionReason, - TaskRunKind, -} from '@janus-idp/shared-react'; - -import { - TEKTON_PIPELINE_RUN, - TEKTON_PIPELINE_TASK, -} from '../consts/tekton-const'; -import { TaskStatus } from '../types/taskRun'; - -// Conversions between units and milliseconds -const s = 1000; -const m = s * 60; -const h = m * 60; -const d = h * 24; -const w = d * 7; -const units = { w, d, h, m, s }; - -export const formatPrometheusDuration = (ms: number) => { - if (!isFinite(ms) || ms < 0) { - return ''; - } - let remaining = ms; - let str = ''; - each(units, (factor, unit) => { - const n = Math.floor(remaining / factor); - if (n > 0) { - str += `${n}${unit} `; - remaining -= n * factor; - } - }); - return trim(str); -}; - -export const taskConditions = { - hasFromDependency: (task: PipelineTask): boolean => - !!task?.resources?.inputs?.[0].from, - hasRunAfterDependency: (task: PipelineTask): boolean => - !!task?.runAfter && task?.runAfter?.length > 0, -}; - -export const getPipelineRun = ( - runs: PipelineRunKind[], - name: string, -): PipelineRunKind | null => { - if (runs?.length > 0 && name) { - return runs.find(run => run?.metadata?.name === name) ?? null; - } - return null; -}; - -const getStatusReason = (reason: string | undefined) => { - switch (reason) { - case SucceedConditionReason.PipelineRunCancelled: - return ComputedStatus.Cancelled; - case SucceedConditionReason.PipelineRunPending: - return ComputedStatus.Idle; - default: - return ComputedStatus.Failed; - } -}; - -const appendTaskDuration = (mTask: PipelineTaskWithStatus) => { - const task = cloneDeep(mTask); - if (mTask?.status?.completionTime && mTask?.status?.startTime) { - const date = - new Date(mTask.status.completionTime).getTime() - - new Date(mTask.status.startTime).getTime(); - task.status = { - ...mTask.status, - duration: formatPrometheusDuration(date), - }; - } - return task; -}; - -const appendTaskStatus = (mTask: PipelineTaskWithStatus) => { - let task = cloneDeep(mTask); - if (!mTask.status) { - task = { - ...mTask, - status: { reason: ComputedStatus.Pending, conditions: [] }, - }; - } else if (mTask.status?.conditions) { - task.status.reason = pipelineRunStatus(mTask) || ComputedStatus.Pending; - } else if (mTask.status && !mTask.status.reason) { - task.status.reason = ComputedStatus.Pending; - } - return task; -}; - -export const appendPipelineRunStatus = ( - pipelineRun: PipelineRunKind, - taskRuns: PLRTaskRuns, - isFinallyTasks = false, -) => { - const tasks = - (isFinallyTasks - ? pipelineRun.status?.pipelineSpec?.finally - : pipelineRun.status?.pipelineSpec?.tasks) || []; - - return tasks?.map(task => { - if (!pipelineRun.status) { - return task as PipelineTaskWithStatus; - } - if (isEmpty(taskRuns)) { - return { - ...task, - status: { - reason: getStatusReason(pipelineRun?.status?.conditions?.[0].reason), - }, - } as PipelineTaskWithStatus; - } - let mTask = { - ...task, - status: get(find(taskRuns, { pipelineTaskName: task.name }), 'status'), - } as PipelineTaskWithStatus; - // append task duration - mTask = appendTaskDuration(mTask); - // append task status - mTask = appendTaskStatus(mTask); - return mTask; - }); -}; - -export const getPLRTaskRuns = ( - taskRuns: TaskRunKind[], - pipelineRun: string | undefined, -): PLRTaskRuns => { - const filteredTaskRuns = taskRuns.filter( - tr => tr?.metadata?.labels?.[TEKTON_PIPELINE_RUN] === pipelineRun, - ); - return filteredTaskRuns.reduce((acc: any, taskRun: TaskRunKind) => { - const temp = { - [`${taskRun?.metadata?.name}`]: { - pipelineTaskName: taskRun?.metadata?.labels?.[TEKTON_PIPELINE_TASK], - status: taskRun?.status, - }, - }; - // eslint-disable-next-line no-param-reassign - acc = { ...acc, ...temp }; - return acc; - }, {}); -}; - -export const getTaskStatus = ( - pipelineRun: PipelineRunKind, - task: PipelineTaskWithStatus, -) => { - let taskStatus: TaskStatus = { - reason: ComputedStatus.Idle, - }; - - const computedStatus = pipelineRunFilterReducer(pipelineRun); - const isSkipped = !!( - task && - pipelineRun?.status?.skippedTasks?.some( - (t: { name: string }) => t.name === task.name, - ) - ); - - if (task?.status) { - taskStatus = task.status as TaskStatus; - } - if ( - computedStatus === ComputedStatus.Failed || - computedStatus === ComputedStatus.Cancelled - ) { - if ( - task?.status?.reason === ComputedStatus.Idle || - task?.status?.reason === ComputedStatus.Pending - ) { - taskStatus.reason = ComputedStatus.Cancelled; - } - } - if (isSkipped) { - taskStatus.reason = ComputedStatus.Skipped; - } - return taskStatus; -}; diff --git a/plugins/tekton/src/utils/taskRun-utils.test.ts b/plugins/tekton/src/utils/taskRun-utils.test.ts deleted file mode 100644 index 816568b32e..0000000000 --- a/plugins/tekton/src/utils/taskRun-utils.test.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { - acsDeploymentCheckTaskRun, - acsImageCheckTaskRun, - acsImageScanTaskRun, - enterpriseContractTaskRun, - taskRunWithResults, - taskRunWithSBOMResult, - taskRunWithSBOMResultExternalLink, -} from '../__fixtures__/taskRunData'; -import { - getActiveTaskRun, - getSbomLink, - getSortedTaskRuns, - getTaskrunsOutputGroup, - hasExternalLink, - isACSDeploymentCheckTaskRun, - isACSImageCheckTaskRun, - isACSImageScanTaskRun, - isECTaskRun, - isSbomTaskRun, -} from './taskRun-utils'; - -describe('taskRun-utils', () => { - it('should return sorted task runs', () => { - const sortedTaskRuns = getSortedTaskRuns( - mockKubernetesPlrResponse.taskruns, - ); - expect(sortedTaskRuns[0].id).toEqual('ruby-ex-git-xf45fo-build'); - }); - - it('should return empty sorted task runs', () => { - const sortedTaskRuns = getSortedTaskRuns([]); - expect(sortedTaskRuns).toHaveLength(0); - }); - - it('should return active taskrun as the latest taskrun when active task is not present', () => { - const activeTaskRun = getActiveTaskRun( - getSortedTaskRuns(mockKubernetesPlrResponse.taskruns), - '', - ); - expect(activeTaskRun).toBe('pipelinerun-with-sbom-task-t237ev-sbom-task'); - }); - - it('should return active taskrun when active task is present', () => { - const activeTaskRun = getActiveTaskRun( - getSortedTaskRuns(mockKubernetesPlrResponse.taskruns), - 'pipeline-test-wbvtlk-tkn', - ); - expect(activeTaskRun).toBe('pipeline-test-wbvtlk-tkn'); - }); - - it('should return undefined when active task is not present', () => { - const activeTaskRun = getActiveTaskRun( - getSortedTaskRuns(mockKubernetesPlrResponse.taskruns), - 'pipeline-test-wbvt-tkn', - ); - expect(activeTaskRun).toBe(undefined); - }); - - it('should not return the SBOM link', () => { - expect(getSbomLink(taskRunWithResults)).toBeUndefined(); - }); - - it('should return the SBOM link', () => { - expect(getSbomLink(taskRunWithSBOMResult)).toBe( - 'quay.io/test/image:build-8e536-1692702836', - ); - }); - - it('should return false if taskrun is missing annotations', () => { - expect( - hasExternalLink({ - ...taskRunWithSBOMResultExternalLink, - metadata: { - ...taskRunWithSBOMResultExternalLink.metadata, - annotations: undefined, - }, - }), - ).toBe(false); - }); - - it('should return false if the taskrun is missing external-link type annotation', () => { - expect(hasExternalLink(taskRunWithSBOMResult)).toBe(false); - }); - - it('should return true if the taskrun has external-link type annotation', () => { - expect(hasExternalLink(taskRunWithSBOMResultExternalLink)).toBe(true); - }); - - it('should return true if the taskrun is a valid SBOM task', () => { - expect(isSbomTaskRun(taskRunWithSBOMResultExternalLink)).toBe(true); - expect(isSbomTaskRun(taskRunWithSBOMResult)).toBe(true); - }); - - it('should return true if the taskrun is a valid EC task', () => { - expect(isECTaskRun(enterpriseContractTaskRun)).toBe(true); - }); - - it('should return true if the taskrun is a valid ACS image scan task', () => { - expect(isACSImageScanTaskRun(acsImageScanTaskRun)).toBe(true); - }); - - it('should return true if the taskrun is a valid ACS image check task', () => { - expect(isACSImageCheckTaskRun(acsImageCheckTaskRun)).toBe(true); - }); - it('should return true if the taskrun is a valid ACS deployment check task', () => { - expect(isACSDeploymentCheckTaskRun(acsDeploymentCheckTaskRun)).toBe(true); - }); - - it('should return false if the taskrun is not a valid SBOM task', () => { - expect(isSbomTaskRun(taskRunWithResults)).toBe(false); - expect(isECTaskRun(taskRunWithResults)).toBe(false); - expect(isACSImageScanTaskRun(taskRunWithResults)).toBe(false); - expect(isACSImageCheckTaskRun(taskRunWithResults)).toBe(false); - expect(isACSDeploymentCheckTaskRun(taskRunWithResults)).toBe(false); - }); - - it('should return the taskrun group', () => { - const outputGroup = getTaskrunsOutputGroup( - 'pipelinerun-with-scanner-task', - [acsImageScanTaskRun, acsImageCheckTaskRun, acsDeploymentCheckTaskRun], - ); - - expect(outputGroup.acsImageScanTaskRun).toBeDefined(); - expect(outputGroup.acsImageCheckTaskRun).toBeDefined(); - expect(outputGroup.acsDeploymentCheckTaskRun).toBeDefined(); - expect(outputGroup.ecTaskRun).toBeUndefined(); - expect(outputGroup.sbomTaskRun).toBeUndefined(); - }); -}); diff --git a/plugins/tekton/src/utils/taskRun-utils.ts b/plugins/tekton/src/utils/taskRun-utils.ts deleted file mode 100644 index 57a52db053..0000000000 --- a/plugins/tekton/src/utils/taskRun-utils.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { - TaskRunResultsAnnotations, - TaskRunResultsKeyValue, - TaskRunResultsTypeValue, -} from '@aonic-ui/pipelines'; - -import { - ComputedStatus, - pipelineRunFilterReducer, - TaskRunKind, -} from '@janus-idp/shared-react'; - -import { - TEKTON_PIPELINE_RUN, - TEKTON_PIPELINE_TASK, -} from '../consts/tekton-const'; -import { OutputTaskRunGroup } from '../types/output'; - -export type TaskStep = { - id: string; - name: string; - status: ComputedStatus; - startedAt?: string; - endedAt?: string; -}; - -export const getSortedTaskRuns = (tRuns: TaskRunKind[]): TaskStep[] => { - if (!tRuns || tRuns.length === 0) { - return []; - } - const taskRuns = Array.from(tRuns).sort((a, b) => { - if (a.status?.completionTime) { - return b.status?.completionTime && - new Date(a.status?.completionTime ?? '') > - new Date(b.status.completionTime) - ? 1 - : -1; - } - return b.status?.completionTime || - new Date(a.status?.startTime ?? '') > new Date(b.status?.startTime ?? '') - ? 1 - : -1; - }); - return (taskRuns?.map(tr => { - return { - id: tr.metadata?.name, - name: tr.metadata?.labels?.[TEKTON_PIPELINE_TASK], - status: pipelineRunFilterReducer(tr), - startedAt: tr.status?.startTime, - endedAt: tr.status?.completionTime, - }; - }) || []) as TaskStep[]; -}; - -export const getActiveTaskRun = ( - taskRuns: TaskStep[], - activeTask: string | undefined, -): string | undefined => - activeTask - ? taskRuns.find(taskRun => taskRun?.id === activeTask)?.id - : taskRuns[taskRuns.length - 1]?.id; - -const checkTypeAnnotation = ( - tr: TaskRunKind | undefined, - type: TaskRunResultsTypeValue, -): boolean => - tr?.metadata?.annotations?.[TaskRunResultsAnnotations.TYPE] === type; - -export const isSbomTaskRun = (tr: TaskRunKind | undefined): boolean => - tr?.metadata?.annotations?.[TaskRunResultsAnnotations.KEY] === - TaskRunResultsKeyValue.SBOM; - -export const isECTaskRun = (tr: TaskRunKind | undefined): boolean => - checkTypeAnnotation(tr, TaskRunResultsTypeValue.EC); - -export const isACSImageScanTaskRun = (tr: TaskRunKind | undefined): boolean => - checkTypeAnnotation(tr, TaskRunResultsTypeValue.ROXCTL_IMAGE_SCAN); - -export const isACSImageCheckTaskRun = (tr: TaskRunKind | undefined): boolean => - checkTypeAnnotation(tr, TaskRunResultsTypeValue.ROXCTL_IMAGE_CHECK); - -export const isACSDeploymentCheckTaskRun = ( - tr: TaskRunKind | undefined, -): boolean => - checkTypeAnnotation(tr, TaskRunResultsTypeValue.ROXCTL_DEPLOYMENT_CHECK); - -export const getTaskrunsOutputGroup = ( - pipelineRunName: string | undefined, - taskruns: TaskRunKind[], -): OutputTaskRunGroup => { - const getPLRTaskRunByType = ( - check: (tr: TaskRunKind | undefined) => boolean, - ): TaskRunKind | undefined => - taskruns?.find( - (tr: TaskRunKind) => - tr?.metadata?.labels?.[TEKTON_PIPELINE_RUN] === pipelineRunName && - check(tr), - ); - - return { - sbomTaskRun: getPLRTaskRunByType(isSbomTaskRun), - ecTaskRun: getPLRTaskRunByType(isECTaskRun), - acsImageScanTaskRun: getPLRTaskRunByType(isACSImageScanTaskRun), - acsImageCheckTaskRun: getPLRTaskRunByType(isACSImageCheckTaskRun), - acsDeploymentCheckTaskRun: getPLRTaskRunByType(isACSDeploymentCheckTaskRun), - }; -}; - -export const hasExternalLink = ( - sbomTaskRun: TaskRunKind | undefined, -): boolean => - sbomTaskRun?.metadata?.annotations?.[TaskRunResultsAnnotations.TYPE] === - TaskRunResultsTypeValue.EXTERNAL_LINK; - -export const getSbomLink = ( - sbomTaskRun: TaskRunKind | undefined, -): string | undefined => - (sbomTaskRun?.status?.results || sbomTaskRun?.status?.taskResults)?.find( - r => r.name === TaskRunResultsKeyValue.SBOM, - )?.value; diff --git a/plugins/tekton/src/utils/tekton-utils.test.ts b/plugins/tekton/src/utils/tekton-utils.test.ts deleted file mode 100644 index 73b58f0ab4..0000000000 --- a/plugins/tekton/src/utils/tekton-utils.test.ts +++ /dev/null @@ -1,330 +0,0 @@ -import { RawFetchError } from '@backstage/plugin-kubernetes-common'; - -import { PipelineRunKind, PipelineRunStatus } from '@janus-idp/shared-react'; - -import { mockKubernetesPlrResponse } from '../__fixtures__/1-pipelinesData'; -import { kubernetesObjects } from '../__fixtures__/kubernetesObject'; -import { - calculateDuration, - calculateDurationInSeconds, - getClusters, - getComparator, - getDuration, - getTaskStatusOfPLR, - getTektonResources, - pipelineRunDuration, - totalPipelineRunTasks, -} from './tekton-utils'; - -describe('tekton-utils', () => { - it('getClusters should return the cluster', () => { - const k8sObjects = { - items: [ - { - cluster: { - name: 'cluster1', - }, - podMetrics: [], - errors: [ - { - errorType: 'FETCH_ERROR', - message: 'Could not fetch resources', - } as RawFetchError, - ], - resources: [], - }, - ], - }; - const { clusters, errors } = getClusters(k8sObjects); - expect(clusters).toEqual(['cluster1']); - expect(errors).toEqual([ - [{ errorType: 'FETCH_ERROR', message: 'Could not fetch resources' }], - ]); - }); - - it('getTektonResources should return the tekton resources if exists', () => { - const plrResources = getTektonResources(0, kubernetesObjects); - expect(plrResources).toEqual({ - pipelineruns: { - data: mockKubernetesPlrResponse.pipelineruns, - }, - pods: { - data: mockKubernetesPlrResponse.pods, - }, - }); - }); - - it('getTektonResources should not return the tekton resources if does not exists', () => { - const plrResources = getTektonResources(1, kubernetesObjects); - expect(plrResources).toEqual({}); - }); - - it('totalPipelineRunTasks should return the total number of tasks in a pipeline run', () => { - const totalTasks = totalPipelineRunTasks( - mockKubernetesPlrResponse.pipelineruns[0], - ); - expect(totalTasks).toEqual(3); - }); - - it('getTaskStatusOfPLR should return the updated task status', () => { - const updatedTaskStatus = getTaskStatusOfPLR( - mockKubernetesPlrResponse.pipelineruns[0], - [mockKubernetesPlrResponse.taskruns[0]], - ); - expect(updatedTaskStatus).toEqual({ - PipelineNotStarted: 0, - Pending: 2, - Running: 1, - Succeeded: 0, - Failed: 0, - Cancelled: 0, - Skipped: 0, - }); - }); - - it('getTaskStatusOfPLR should return the updated task status if no taskrun exist', () => { - const mockPipelineRun = { - ...kubernetesObjects.items[0].resources[0].resources[0], - status: {}, - }; - const updatedTaskStatus = getTaskStatusOfPLR(mockPipelineRun, [ - mockKubernetesPlrResponse.taskruns[1], - ]); - expect(updatedTaskStatus).toEqual({ - PipelineNotStarted: 1, - Pending: 0, - Running: 0, - Succeeded: 0, - Failed: 0, - Cancelled: 0, - Skipped: 0, - }); - }); - - it('should return duration in seconds', () => { - let duration = calculateDurationInSeconds( - '2020-05-22T11:57:53Z', - '2020-05-22T11:57:57Z', - ); - expect(duration).toEqual(4); - - duration = calculateDurationInSeconds( - '2020-05-22T11:57:53Z', - '2020-05-22T12:02:20Z', - ); - expect(duration).toBe(267); - - duration = calculateDurationInSeconds( - '2020-05-22T10:57:53Z', - '2020-05-22T12:57:57Z', - ); - expect(duration).toBe(7204); - }); - - it('should return the right duration strings', () => { - expect(getDuration(0, false)).toBe('less than a sec'); - expect(getDuration(0, true)).toBe('less than a sec'); - - expect(getDuration(10, false)).toBe('10s'); - expect(getDuration(10, true)).toBe('10 seconds'); - - expect(getDuration(60, false)).toBe('1m'); - expect(getDuration(60, true)).toBe('1 minute'); - - expect(getDuration(3600 + 2 * 60 + 3, false)).toBe('1h 2m 3s'); - expect(getDuration(3600 + 2 * 60 + 3, true)).toBe( - '1 hour 2 minutes 3 seconds', - ); - - expect(getDuration(48 * 3600 + 1, false)).toBe('48h 1s'); - expect(getDuration(48 * 3600 + 1, true)).toBe('48 hours 1 second'); - }); - - it('should return definite duration', () => { - let duration = calculateDuration( - '2020-05-22T11:57:53Z', - '2020-05-22T11:57:57Z', - ); - expect(duration).toEqual('4s'); - duration = calculateDuration( - '2020-05-22T11:57:53Z', - '2020-05-22T11:57:57Z', - true, - ); - expect(duration).toEqual('4 seconds'); - duration = calculateDuration( - '2020-05-22T11:57:53Z', - '2020-05-22T12:02:20Z', - ); - expect(duration).toBe('4m 27s'); - duration = calculateDuration( - '2020-05-22T11:57:53Z', - '2020-05-22T12:02:20Z', - true, - ); - expect(duration).toBe('4 minutes 27 seconds'); - duration = calculateDuration( - '2020-05-22T10:57:53Z', - '2020-05-22T12:57:57Z', - ); - expect(duration).toBe('2h 4s'); - }); - - it('should return expect duration for PipelineRun', () => { - const duration = pipelineRunDuration( - mockKubernetesPlrResponse.pipelineruns[0], - ); - expect(duration).not.toBeNull(); - expect(duration).toBe('2 minutes 9 seconds'); - }); - - it('should return expect duration as - for PipelineRun without start time', () => { - const mockPipelineRun: PipelineRunKind = { - ...mockKubernetesPlrResponse.pipelineruns[0], - status: { - ...mockKubernetesPlrResponse.pipelineruns[0].status, - startTime: '', - }, - }; - const duration = pipelineRunDuration(mockPipelineRun); - expect(duration).not.toBeNull(); - expect(duration).toBe('-'); - }); - - it('should return expect duration as - for PipelineRun without end time', () => { - const mockPipelineRun: PipelineRunKind = { - ...mockKubernetesPlrResponse.pipelineruns[1], - status: { - ...mockKubernetesPlrResponse.pipelineruns[1].status, - completionTime: '', - }, - }; - const duration = pipelineRunDuration(mockPipelineRun); - expect(duration).not.toBeNull(); - expect(duration).toBe('-'); - }); - - it('should be able to sort pipelineRunsData in ascending order based on pipelinerun name', () => { - const mockPipelineRuns: PipelineRunKind[] = [ - ...mockKubernetesPlrResponse.pipelineruns, - ]; - - const sortedData: PipelineRunKind[] = Array.from(mockPipelineRuns).sort( - getComparator('asc', 'metadata.name', 'name'), - ); - expect(sortedData[0].metadata?.name).toBe('pipeline-test-wbvtlk'); - }); - - it('should be able to sort pipelineRunsData in ascending order based on pipelinerun start time', () => { - const mockPipelineRuns: PipelineRunKind[] = [ - ...mockKubernetesPlrResponse.pipelineruns, - ]; - - const sortedData: PipelineRunKind[] = Array.from(mockPipelineRuns).sort( - getComparator('asc', 'status.startTime', 'start-time'), - ); - expect(sortedData[0].metadata?.name).toBe('ruby-ex-git-xf45fo'); - }); - - it('should be able to sort pipelineRunsData in ascending order based on pipelinerun duration', () => { - const mockPipelineRuns: PipelineRunKind[] = [ - ...mockKubernetesPlrResponse.pipelineruns, - ]; - - const sortedData: PipelineRunKind[] = Array.from(mockPipelineRuns).sort( - getComparator('asc', 'status.completionTime', 'duration'), - ); - expect(sortedData[0].metadata?.name).toBe('ruby-ex-git-xf45fo'); - }); - it('should be able to sort pipelineRunsData in ascending order based on pipelinerun vulnerabilities', () => { - const mockPipelineRun: PipelineRunKind = - mockKubernetesPlrResponse.pipelineruns[1]; - - const pipelineRunA: PipelineRunKind = { - ...mockPipelineRun, - metadata: { ...mockPipelineRun.metadata, name: 'A' }, - status: { - ...mockPipelineRun.status, - results: [ - { - name: 'SCAN_OUTPUT', - value: - '{"vulnerabilities":{\n"critical": 13,\n"high": 29,\n"medium": 32,\n"low": 3,\n"unknown": 0}\n}\n', - }, - ], - } as PipelineRunStatus, - }; - const pipelineRunB: PipelineRunKind = { - ...mockPipelineRun, - metadata: { ...mockPipelineRun.metadata, name: 'B' }, - status: { - ...mockPipelineRun.status, - results: [ - { - name: 'SCAN_OUTPUT', - value: - '{"vulnerabilities":{\n"critical": 1,\n"high": 29,\n"medium": 32,\n"low": 3,\n"unknown": 0}\n}\n', - }, - ], - } as PipelineRunStatus, - }; - const pipelineRuns = [pipelineRunA, pipelineRunB]; - - let sortedData: PipelineRunKind[] = Array.from(pipelineRuns).sort( - getComparator('asc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('B'); - sortedData = Array.from(pipelineRuns).sort( - getComparator('desc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('A'); - - pipelineRunB.status!.results = [ - { - name: 'SCAN_OUTPUT', - value: - '{"vulnerabilities":{\n"critical": 13,\n"high": 30,\n"medium": 2,\n"low": 2,\n"unknown": 0}\n}\n', - }, - ]; - sortedData = Array.from(pipelineRuns).sort( - getComparator('asc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('A'); - sortedData = Array.from(pipelineRuns).sort( - getComparator('desc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('B'); - - pipelineRunB.status!.results = [ - { - name: 'SCAN_OUTPUT', - value: - '{"vulnerabilities":{\n"critical": 13,\n"high": 29,\n"medium": 33,\n"low": 2,\n"unknown": 0}\n}\n', - }, - ]; - sortedData = Array.from(pipelineRuns).sort( - getComparator('asc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('A'); - sortedData = Array.from(pipelineRuns).sort( - getComparator('desc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('B'); - - pipelineRunB.status!.results = [ - { - name: 'SCAN_OUTPUT', - value: - '{"vulnerabilities":{\n"critical": 13,\n"high": 29,\n"medium": 32,\n"low": 4,\n"unknown": 0}\n}\n', - }, - ]; - sortedData = Array.from(pipelineRuns).sort( - getComparator('asc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('A'); - sortedData = Array.from(pipelineRuns).sort( - getComparator('desc', 'status.results', 'vulnerabilities'), - ); - expect(sortedData[0].metadata?.name).toBe('B'); - }); -}); diff --git a/plugins/tekton/src/utils/tekton-utils.ts b/plugins/tekton/src/utils/tekton-utils.ts deleted file mode 100644 index f4d4ca5eb4..0000000000 --- a/plugins/tekton/src/utils/tekton-utils.ts +++ /dev/null @@ -1,291 +0,0 @@ -import { - ClusterObjects, - ObjectsByEntityResponse, -} from '@backstage/plugin-kubernetes-common'; - -import { pluralize } from '@patternfly/react-core'; -import { get } from 'lodash'; - -import { - ComputedStatus, - getTaskRunsForPipelineRun, - pipelineRunFilterReducer, - PipelineRunKind, - pipelineRunStatus, - SucceedConditionReason, - TaskRunKind, - TaskStatusTypes, - updateTaskStatus, -} from '@janus-idp/shared-react'; - -import { getPipelineRunScanResults } from '../hooks/usePipelineRunScanResults'; -import { PipelineRunGVK, TaskRunGVK } from '../models'; -import { - ClusterErrors, - Order, - PipelineRunScanResults, - TektonResponseData, -} from '../types/types'; - -export const getClusters = (k8sObjects: ObjectsByEntityResponse) => { - const clusters: string[] = k8sObjects.items.map( - (item: ClusterObjects) => item.cluster.name, - ); - const errors: ClusterErrors[] = k8sObjects.items.map( - (item: ClusterObjects) => item.errors, - ); - return { clusters, errors }; -}; - -const isTektonResource = (kind: string) => - [PipelineRunGVK.kind, TaskRunGVK.kind].includes(kind); - -const getResourceType = (kind: string) => { - switch (kind) { - case PipelineRunGVK.kind: - return 'pipelineruns'; - case TaskRunGVK.kind: - return 'taskruns'; - default: - return ''; - } -}; - -export const getTektonResources = ( - cluster: number, - k8sObjects: ObjectsByEntityResponse, -) => - k8sObjects.items?.[cluster]?.resources?.reduce( - (acc: TektonResponseData, res: any) => { - if (res.type === 'pods') { - return { - ...acc, - pods: { data: res.resources }, - }; - } - if ( - res.type !== 'customresources' || - (res.type === 'customresources' && res.resources.length === 0) - ) { - return acc; - } - const customResKind = res.resources[0].kind; - return { - ...acc, - ...(isTektonResource(customResKind) && { - [getResourceType(customResKind)]: { - data: res.resources, - }, - }), - }; - }, - {}, - ); - -export const totalPipelineRunTasks = (pipelinerun: PipelineRunKind): number => { - if (!pipelinerun?.status?.pipelineSpec) { - return 0; - } - const totalTasks = (pipelinerun.status.pipelineSpec?.tasks || []).length; - const finallyTasks = - (pipelinerun.status.pipelineSpec?.finally || []).length ?? 0; - return totalTasks + finallyTasks; -}; - -export const getTaskStatusOfPLR = ( - pipelinerun: PipelineRunKind, - taskRuns: TaskRunKind[], -) => { - const totalTasks = totalPipelineRunTasks(pipelinerun); - const plrTasks = getTaskRunsForPipelineRun(pipelinerun, taskRuns); - const plrTaskLength = plrTasks?.length; - const skippedTaskLength = pipelinerun?.status?.skippedTasks?.length || 0; - - const taskStatus: TaskStatusTypes = updateTaskStatus(pipelinerun, plrTasks); - - if (plrTasks?.length > 0) { - const pipelineRunHasFailure = taskStatus[ComputedStatus.Failed] > 0; - const pipelineRunIsCancelled = - pipelineRunFilterReducer(pipelinerun) === ComputedStatus.Cancelled; - const unhandledTasks = - totalTasks >= plrTaskLength - ? totalTasks - plrTaskLength - skippedTaskLength - : totalTasks; - - if (pipelineRunHasFailure || pipelineRunIsCancelled) { - taskStatus[ComputedStatus.Cancelled] += unhandledTasks; - } else { - taskStatus[ComputedStatus.Pending] += unhandledTasks; - } - } else if ( - pipelinerun?.status?.conditions?.[0]?.status === 'False' || - pipelinerun?.spec?.status === SucceedConditionReason.PipelineRunCancelled - ) { - taskStatus[ComputedStatus.Cancelled] = totalTasks; - } else if ( - pipelinerun?.spec?.status === SucceedConditionReason.PipelineRunPending - ) { - taskStatus[ComputedStatus.Pending] += totalTasks; - } else { - taskStatus[ComputedStatus.PipelineNotStarted]++; - } - return taskStatus; -}; - -export const getDuration = (seconds: number, long?: boolean): string => { - if (seconds === 0) { - return 'less than a sec'; - } - let sec = Math.round(seconds); - let min = 0; - let hr = 0; - let duration = ''; - if (sec >= 60) { - min = Math.floor(sec / 60); - sec %= 60; - } - if (min >= 60) { - hr = Math.floor(min / 60); - min %= 60; - } - if (hr > 0) { - duration += long ? pluralize(hr, 'hour', 'hours') : `${hr}h`; - duration += ' '; - } - if (min > 0) { - duration += long ? pluralize(min, 'minute', 'minutes') : `${min}m`; - duration += ' '; - } - if (sec > 0) { - duration += long ? pluralize(sec, 'second', 'seconds') : `${sec}s`; - } - - return duration.trim(); -}; - -export const descendingComparator = ( - a: PipelineRunKind, - b: PipelineRunKind, - orderBy: string, -) => { - if (get(b, orderBy) < get(a, orderBy)) { - return -1; - } - if (get(b, orderBy) > get(a, orderBy)) { - return 1; - } - return 0; -}; - -export const calculateDurationInSeconds = ( - startTime: string, - endTime?: string, -) => { - const start = new Date(startTime).getTime(); - const end = endTime ? new Date(endTime).getTime() : new Date().getTime(); - const durationInSeconds = (end - start) / 1000; - return durationInSeconds; -}; - -export const durationComparator = (a: PipelineRunKind, b: PipelineRunKind) => { - const durationA = a.status?.startTime - ? calculateDurationInSeconds(a.status?.startTime, a.status?.completionTime) - : 0; - - const durationB = b.status?.startTime - ? calculateDurationInSeconds(b.status?.startTime, b.status?.completionTime) - : 0; - - if (durationB < durationA) { - return -1; - } - if (durationB > durationA) { - return 1; - } - return 0; -}; - -const vulnerabilitiesSortValue = ( - scanResults: PipelineRunScanResults, -): number => { - if (!scanResults?.vulnerabilities) { - return -1; - } - // Expect no more than 999 of any one severity - return ( - (scanResults.vulnerabilities.critical ?? 0) * 1000000000 + - (scanResults.vulnerabilities.high ?? 0) * 1000000 + - (scanResults.vulnerabilities.medium ?? 0) * 1000 + - (scanResults.vulnerabilities.low ?? 0) - ); -}; - -export const vulnerabilitiesComparator = ( - a: PipelineRunKind, - b: PipelineRunKind, -) => { - const vulnerabilitiesSortValueA = vulnerabilitiesSortValue( - getPipelineRunScanResults(a), - ); - const vulnerabilitiesSortValueB = vulnerabilitiesSortValue( - getPipelineRunScanResults(b), - ); - - if (vulnerabilitiesSortValueB < vulnerabilitiesSortValueA) { - return -1; - } - if (vulnerabilitiesSortValueB > vulnerabilitiesSortValueA) { - return 1; - } - return 0; -}; - -export const getComparator = ( - order: Order, - orderBy: string, - orderById: string, -) => { - switch (orderById) { - case 'duration': - return (a: PipelineRunKind, b: PipelineRunKind) => { - return order === 'desc' - ? durationComparator(a, b) - : -durationComparator(a, b); - }; - case 'vulnerabilities': - return (a: PipelineRunKind, b: PipelineRunKind) => { - return order === 'desc' - ? vulnerabilitiesComparator(a, b) - : -vulnerabilitiesComparator(a, b); - }; - default: - return (a: PipelineRunKind, b: PipelineRunKind) => { - return order === 'desc' - ? descendingComparator(a, b, orderBy) - : -descendingComparator(a, b, orderBy); - }; - } -}; - -export const calculateDuration = ( - startTime: string, - endTime?: string, - long?: boolean, -) => { - const durationInSeconds = calculateDurationInSeconds(startTime, endTime); - return getDuration(durationInSeconds, long); -}; - -export const pipelineRunDuration = (run: PipelineRunKind): string => { - if (!run || Object.keys(run).length === 0) { - return '-'; - } - const startTime = run.status?.startTime; - const completionTime = run.status?.completionTime; - - // Duration cannot be computed if start time is missing or a completed/failed pipeline/task has no end time - if (!startTime || (!completionTime && pipelineRunStatus(run) !== 'Running')) { - return '-'; - } - return calculateDuration(startTime, completionTime, true); -}; diff --git a/plugins/tekton/tests/tekton.spec.ts b/plugins/tekton/tests/tekton.spec.ts deleted file mode 100644 index ff02cdcffb..0000000000 --- a/plugins/tekton/tests/tekton.spec.ts +++ /dev/null @@ -1,323 +0,0 @@ -import { expect, Locator, Page, test } from '@playwright/test'; - -import { Common } from './tektonHelper'; - -test.describe('Tekton plugin', () => { - let page: Page; - let common: Common; - test.beforeAll(async ({ browser }) => { - const context = await browser.newContext(); - page = await context.newPage(); - common = new Common(page); - - await common.loginAsGuest(); - await expect( - page.getByRole('heading', { name: 'Pipeline Runs' }), - ).toBeVisible({ timeout: 20000 }); - }); - - test.afterAll(async ({ browser }) => { - await browser.close(); - }); - - test('Control elements are shown', async () => { - const clusterSelect = page.locator('.bs-tkn-cluster-selector'); - await expect( - clusterSelect.getByText('Cluster', { exact: true }), - ).toBeVisible(); - await expect(clusterSelect.getByText('mock-cluster')).toBeVisible(); - - const statusSelect = page.locator('.bs-tkn-status-selector'); - await expect(statusSelect.getByText('Status')).toBeVisible(); - await expect(statusSelect.getByText('All')).toBeVisible(); - - const columns = [ - 'NAME', - 'VULNERABILITIES', - 'STATUS', - 'TASK STATUS', - 'STARTED', - 'DURATION', - 'ACTIONS', - ]; - const thead = page.locator('thead'); - for (const col of columns) { - await expect( - thead.getByRole('columnheader', { name: col, exact: true }), - ).toBeVisible(); - } - }); - - test('Pipelines are shown', async () => { - const plrLabel = page.locator('.bs-tkn-pipeline-visualization__label'); - expect(await plrLabel.all()).toHaveLength(5); - for (const plr of await plrLabel.all()) { - expect(plr).toBeVisible(); - } - }); - - test('Pipeline without scan or sbom only shows logs', async () => { - const row = page.getByRole('row', { name: 'pipeline-test-wbvtlk' }); - await expect(row.getByRole('cell').nth(2)).toHaveText('-'); - - const actions = row.getByRole('cell').last(); - await expect(actions.getByRole('button').first()).toBeEnabled(); - await expect(row.getByTestId('view-sbom-icon')).toBeDisabled(); - await expect(row.getByTestId('view-output-icon')).toBeDisabled(); - }); - - test.describe('Pipeline with scanner', () => { - const output = { - vulnerabilities: { - critical: 13, - high: 29, - medium: 32, - low: 3, - unknown: 0, - }, - unpatched_vulnerabilities: { - critical: 0, - high: 1, - medium: 0, - low: 1, - }, - }; - const policyColumns = [ - 'Name', - 'Severity', - 'Breaks build', - 'Description', - 'Violation', - 'Remediation', - ]; - let row: Locator; - - test.beforeAll(() => { - row = page.getByRole('row', { name: 'pipelinerun-with-scanner-task' }); - }); - - test.afterAll(async () => { - await page.getByLabel('close').click(); - }); - - test('Vulnerabilities are shown in the run', async () => { - await checkVulnerabilities(row, output.vulnerabilities); - }); - - test('Output action is available', async () => { - const btn = row.getByTestId('view-output-icon'); - await expect(btn).toBeEnabled(); - await btn.click(); - await expect(page.getByTestId('pipelinerun-output-dialog')).toBeVisible(); - }); - - test('Enterprise contract output is shown', async () => { - const card = page.getByTestId('enterprise-contract'); - const title = page.locator('[id="{enterprise contract-title}"]'); - // check the title and the badge - await expect(title.getByTestId('card-title')).toBeVisible(); - await expect(title.getByTestId('card-title')).toHaveText( - 'Enterprise Contract', - ); - await expect(title.getByTestId('card-badge')).toHaveText('Failed'); - - // check the description - await expect(card).toContainText('Enterprise Contract is a set of tools'); - - // check the summary - const summary = card.locator('.pf-v5-c-card'); - await expect(summary.getByText('Summary')).toBeVisible(); - await expect(summary.getByText('Failed')).toBeVisible(); - await expect(summary.getByText('Success')).toBeVisible(); - await expect(summary.getByText('Warning')).toBeVisible(); - - // check the rules - const rules = page.getByTestId('ec-policy-table'); - const statuses = rules.getByTestId('rule-status'); - await expect(statuses).toHaveCount(4); - await expect(statuses.filter({ hasText: 'Failed' })).toHaveCount(2); - await expect(statuses.filter({ hasText: 'Warning' })).toHaveCount(1); - await expect(statuses.filter({ hasText: 'Success' })).toHaveCount(1); - }); - - test('ACS Image Scan is shown', async () => { - const card = page.locator(`[id='advanced cluster security']`); - await card - .locator(`[id='advanced cluster security-toggle-button']`) - .click(); - await card.scrollIntoViewIfNeeded(); - - // check the title and the badge - await expect(card.getByTestId('card-title')).toBeVisible(); - await expect(card.getByTestId('card-title')).toHaveText( - 'Advanced Cluster Security', - ); - await expect(card.getByTestId('card-badge')).toHaveText('Issues found'); - - const sections = [ - 'CVEs by severity', - 'CVEs by status', - 'Total scan results', - ]; - const columns = [ - 'CVE ID', - 'Severity', - 'Component', - 'Component version', - 'Fixed in version', - ]; - - await checkCards(card, sections, 'image-scan-table', columns); - }); - - test('ACS Image Check is shown', async () => { - const card = page.locator(`[id='advanced cluster security']`); - await card.getByRole('tab', { name: 'Image Check' }).click(); - const cards = ['CVEs by severity', 'Failing policy checks']; - - await checkCards(card, cards, 'image-check-table', policyColumns); - }); - - test('ACS Deployment Check is shown', async () => { - const card = page.locator(`[id='advanced cluster security']`); - await card.getByRole('tab', { name: 'Deployment Check' }).click(); - const cards = ['Violations by severity', 'Failing policy checks']; - - await checkCards(card, cards, 'deployment-check-table', policyColumns); - }); - - test('Check other output', async () => { - const card = page.locator('[id="others"]'); - await card.locator(`[id='others-toggle-button']`).click(); - await card.scrollIntoViewIfNeeded(); - - await expect(card.getByRole('gridcell').first()).toContainText( - 'SCAN_OUTPUT', - ); - - const text = (await card - .getByRole('gridcell') - .last() - .textContent()) as string; - expect(JSON.parse(text)).toEqual(output); - }); - }); - - test('Pipeline with sbom has the show sbom action', async () => { - const row = page.getByRole('row', { name: 'pipelinerun-with-sbom-task' }); - await expect(row.getByRole('cell').nth(2)).toHaveText('-'); - - const showSbom = row.getByTestId('view-sbom-icon'); - await expect(showSbom).toBeEnabled(); - await expect(row.getByTestId('view-output-icon')).toBeDisabled(); - await showSbom.click(); - - const dialog = page.getByTitle('PipelineRun Logs'); - await expect(dialog.getByText('sbom-task')).toBeVisible(); - - await page.getByLabel('close').click(); - }); - - test.describe('Pipeline with external sbom', () => { - let row: Locator; - const output = { - vulnerabilities: { - critical: 1, - high: 9, - medium: 20, - low: 1, - unknown: 0, - }, - unpatched_vulnerabilities: { - critical: 0, - high: 1, - medium: 0, - low: 1, - }, - }; - - test.beforeAll(() => { - row = page.getByRole('row', { - name: 'pipelinerun-with-external-sbom-task', - }); - }); - - test('Vulnerability scan is shown', async () => { - await checkVulnerabilities(row, output.vulnerabilities); - }); - - test('Show sbom action points to quay.io', async () => { - const showSbom = row.getByTestId('view-sbom-icon'); - await expect(showSbom).toBeEnabled(); - expect(await showSbom.locator('a').getAttribute('href')).toContain( - 'https://quay.io', - ); - }); - - test('View output action is enabled', async () => { - const viewOutput = row.getByTestId('view-output-icon'); - await expect(viewOutput).toBeEnabled(); - - await viewOutput.click(); - const dialog = page.getByRole('dialog'); - await expect(dialog).toBeVisible(); - - await expect(dialog.locator('tbody')).toContainText('MY_SCAN_OUTPUT'); - const text = (await dialog.locator('td').last().textContent()) as string; - expect(JSON.parse(text)).toEqual(output); - await page.getByLabel('close').click(); - }); - }); - - test('Signed pipeline shows the signed indicator', async () => { - const row = page.getByRole('row', { name: 'ruby-ex-git-xf45fo' }); - await expect(row.locator('.signed-indicator')).toBeVisible(); - }); -}); - -async function checkCards( - base: Locator, - sectionTitles: string[], - tableName: string, - columns: string[], -) { - // check the violations summary - const sections = base.locator('.pf-v5-c-card:visible'); - for (const item of sectionTitles) { - await expect(sections.filter({ hasText: item })).toBeVisible(); - } - - // check the violations table - const table = base.getByTestId(tableName); - await expect(table).toBeVisible(); - - for (const col of columns) { - await expect( - table.locator('thead').getByText(col, { exact: true }), - ).toBeVisible(); - } - expect(await table.getByRole('row').count()).toBeGreaterThan(1); -} - -async function checkVulnerabilities( - row: Locator, - vulnerabilities: { - critical: number; - high: number; - medium: number; - low: number; - }, -) { - const vuln = row.locator('.severity'); - let i = 0; - - for (const prop in vulnerabilities) { - if (vulnerabilities[prop] > 0) { - await expect(vuln.nth(i)).toContainText( - new RegExp(`${prop}\s*${vulnerabilities[prop]}`), - { ignoreCase: true }, - ); - i++; - } - } -} diff --git a/plugins/tekton/tests/tektonHelper.ts b/plugins/tekton/tests/tektonHelper.ts deleted file mode 100644 index 888eecc39f..0000000000 --- a/plugins/tekton/tests/tektonHelper.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { expect, type Locator, type Page } from '@playwright/test'; - -export class Common { - page: Page; - - constructor(page: Page) { - this.page = page; - } - - async verifyHeading(heading: string) { - const headingLocator = this.page - .locator('h1, h2, h3, h4, h5, h6') - .filter({ hasText: heading }) - .first(); - await headingLocator.waitFor({ state: 'visible', timeout: 30000 }); - await expect(headingLocator).toBeVisible(); - } - - async clickButton( - label: string, - clickOpts?: Parameters[0], - getByTextOpts: Parameters[1] = { exact: true }, - ) { - const muiButtonLabel = 'span[class^="MuiButton-label"]'; - const selector = `${muiButtonLabel}:has-text("${label}")`; - const button = this.page - .locator(selector) - .getByText(label, getByTextOpts) - .first(); - await button.waitFor({ state: 'visible' }); - await button.click(clickOpts); - } - - async waitForSideBarVisible() { - await this.page.waitForSelector('nav a', { timeout: 120000 }); - } - - async loginAsGuest() { - await this.page.goto('/'); - // TODO - Remove it after https://issues.redhat.com/browse/RHIDP-2043. A Dynamic plugin for Guest Authentication Provider needs to be created - this.page.on('dialog', async dialog => { - await dialog.accept(); - }); - - await this.verifyHeading('Select a sign-in method'); - await this.clickButton('Enter'); - await this.waitForSideBarVisible(); - } -} diff --git a/plugins/tekton/tsconfig.json b/plugins/tekton/tsconfig.json deleted file mode 100644 index 0fba2d784c..0000000000 --- a/plugins/tekton/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@backstage/cli/config/tsconfig.json", - "include": ["src", "dev", "migrations"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "../../dist-types/plugins/tekton", - "rootDir": "." - } -} diff --git a/plugins/tekton/turbo.json b/plugins/tekton/turbo.json deleted file mode 100644 index 3d4f6e8aa7..0000000000 --- a/plugins/tekton/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/tekton/**"] - } - } -} diff --git a/yarn.lock b/yarn.lock index 15af164b8e..ec9573b453 100644 --- a/yarn.lock +++ b/yarn.lock @@ -34,23 +34,6 @@ __metadata: languageName: node linkType: hard -"@aonic-ui/pipelines@npm:^1.1.1": - version: 1.1.1 - resolution: "@aonic-ui/pipelines@npm:1.1.1" - dependencies: - "@patternfly/react-table": ^5.1.2 - js-yaml: ^4.1.0 - peerDependencies: - "@patternfly/react-core": ^5.1.2 - "@patternfly/react-icons": ^5.1.2 - "@patternfly/react-table": ^5.1.2 - "@patternfly/react-tokens": ^5.1.2 - "@testing-library/jest-dom": ^6.2.0 - react: ^18.2.0 - checksum: c1e65ca7923efbb107d816f5d7028b855baa67c7f6c93377adc20c2dff28ca397f32420ca17379d92f2e70118ca9efd16c01a883624a5c5861e70ff73a551e23 - languageName: node - linkType: hard - "@apidevtools/json-schema-ref-parser@npm:9.0.6": version: 9.0.6 resolution: "@apidevtools/json-schema-ref-parser@npm:9.0.6" @@ -4572,42 +4555,6 @@ __metadata: languageName: node linkType: hard -"@backstage/plugin-kubernetes@npm:^0.11.16": - version: 0.11.16 - resolution: "@backstage/plugin-kubernetes@npm:0.11.16" - dependencies: - "@backstage/catalog-model": ^1.7.0 - "@backstage/core-compat-api": ^0.3.1 - "@backstage/core-components": ^0.15.1 - "@backstage/core-plugin-api": ^1.10.0 - "@backstage/frontend-plugin-api": ^0.9.0 - "@backstage/plugin-catalog-react": ^1.14.0 - "@backstage/plugin-kubernetes-common": ^0.8.3 - "@backstage/plugin-kubernetes-react": ^0.4.4 - "@kubernetes-models/apimachinery": ^2.0.0 - "@kubernetes-models/base": ^5.0.0 - "@kubernetes/client-node": 0.20.0 - "@material-ui/core": ^4.12.2 - cronstrue: ^2.2.0 - js-yaml: ^4.0.0 - kubernetes-models: ^4.1.0 - lodash: ^4.17.21 - luxon: ^3.0.0 - xterm: ^5.2.1 - xterm-addon-attach: ^0.9.0 - xterm-addon-fit: ^0.8.0 - peerDependencies: - "@types/react": ^16.13.1 || ^17.0.0 || ^18.0.0 - react: ^16.13.1 || ^17.0.0 || ^18.0.0 - react-dom: ^16.13.1 || ^17.0.0 || ^18.0.0 - react-router-dom: 6.0.0-beta.0 || ^6.3.0 - peerDependenciesMeta: - "@types/react": - optional: true - checksum: 59bc25ccaf1c8ab521c4361c13c06ec853607fa6ac0bc7d50c103134cb090e1d5d1143b23fb2f135ce1c16b6c3b1107a31fc6a27a09ec3e3786ebf2ee0af2f90 - languageName: node - linkType: hard - "@backstage/plugin-org@npm:^0.6.31": version: 0.6.31 resolution: "@backstage/plugin-org@npm:0.6.31" @@ -6014,22 +5961,6 @@ __metadata: languageName: node linkType: hard -"@dagrejs/dagre@npm:1.1.2": - version: 1.1.2 - resolution: "@dagrejs/dagre@npm:1.1.2" - dependencies: - "@dagrejs/graphlib": 2.2.2 - checksum: 70d0d746be64efe7f09d18c123f0a9a83339e46b3817d56effd76530795b78838ea5ed862a92897c90643403c9181723a79768bb8b8f3e0f65139393e95027cf - languageName: node - linkType: hard - -"@dagrejs/graphlib@npm:2.2.2": - version: 2.2.2 - resolution: "@dagrejs/graphlib@npm:2.2.2" - checksum: ceb833f350a9b984dc8557bd9f4a4304e3fe7a9293295313e63f8b94a2808c8dac51cfd6bd3a17c26260507440d0c6025bfa7eb24eb8ce7eda211119929f5216 - languageName: node - linkType: hard - "@dagrejs/graphlib@npm:^2.1.13": version: 2.2.4 resolution: "@dagrejs/graphlib@npm:2.2.4" @@ -7935,63 +7866,6 @@ __metadata: languageName: unknown linkType: soft -"@janus-idp/backstage-plugin-analytics-module-matomo@workspace:plugins/analytics-module-matomo": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-plugin-analytics-module-matomo@workspace:plugins/analytics-module-matomo" - dependencies: - "@backstage/cli": 0.28.2 - "@backstage/core-app-api": 1.15.1 - "@backstage/core-plugin-api": ^1.10.0 - "@backstage/dev-utils": 1.1.2 - "@backstage/test-utils": 1.7.0 - "@redhat-developer/red-hat-developer-hub-theme": 0.4.0 - "@testing-library/jest-dom": 6.4.8 - "@testing-library/react": 14.3.1 - "@testing-library/user-event": 14.5.2 - "@types/node": 18.19.33 - cross-fetch: 4.0.0 - msw: 1.3.3 - prettier: 3.3.3 - peerDependencies: - react: ^16.13.1 || ^17.0.0 || ^18.0.0 - languageName: unknown - linkType: soft - -"@janus-idp/backstage-plugin-analytics-provider-segment@workspace:plugins/analytics-provider-segment": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-plugin-analytics-provider-segment@workspace:plugins/analytics-provider-segment" - dependencies: - "@backstage/cli": 0.28.2 - "@backstage/config": ^1.2.0 - "@backstage/core-app-api": 1.15.1 - "@backstage/core-components": ^0.15.1 - "@backstage/core-plugin-api": ^1.10.0 - "@backstage/dev-utils": 1.1.2 - "@backstage/test-utils": 1.7.0 - "@backstage/theme": ^0.6.0 - "@material-ui/core": ^4.9.13 - "@material-ui/icons": ^4.11.3 - "@material-ui/lab": 4.0.0-alpha.61 - "@redhat-developer/red-hat-developer-hub-theme": 0.4.0 - "@segment/analytics-next": ^1.58.0 - "@testing-library/dom": 9.3.4 - "@testing-library/jest-dom": 6.4.8 - "@testing-library/react": 14.3.1 - "@testing-library/user-event": 14.5.2 - "@types/node": 18.19.34 - "@types/react": 18.3.3 - cross-fetch: 4.0.0 - msw: 1.3.3 - prettier: 3.3.3 - prop-types: ^15.8.1 - react-use: ^17.4.0 - peerDependencies: - react: ^16.13.1 || ^17.0.0 || ^18.0.0 - react-dom: ^16.13.1 || ^17.0.0 || ^18.0.0 - react-router-dom: ^6.0.0 - languageName: unknown - linkType: soft - "@janus-idp/backstage-plugin-audit-log-node@^1.7.1, @janus-idp/backstage-plugin-audit-log-node@workspace:plugins/audit-log-node": version: 0.0.0-use.local resolution: "@janus-idp/backstage-plugin-audit-log-node@workspace:plugins/audit-log-node" @@ -8146,58 +8020,6 @@ __metadata: languageName: unknown linkType: soft -"@janus-idp/backstage-plugin-matomo-backend@workspace:plugins/matomo-backend": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-plugin-matomo-backend@workspace:plugins/matomo-backend" - dependencies: - "@backstage/backend-defaults": ^0.5.2 - "@backstage/backend-plugin-api": ^1.0.1 - "@backstage/cli": 0.28.2 - "@backstage/config": ^1.2.0 - "@types/express": 4.17.20 - "@types/supertest": 2.0.16 - express: ^4.18.2 - http-proxy-middleware: ^2.0.6 - msw: 1.3.3 - node-fetch: ^3.3.2 - prettier: 3.3.3 - supertest: 6.3.4 - yn: ^4.0.0 - languageName: unknown - linkType: soft - -"@janus-idp/backstage-plugin-matomo@workspace:plugins/matomo": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-plugin-matomo@workspace:plugins/matomo" - dependencies: - "@backstage/catalog-model": ^1.7.0 - "@backstage/cli": 0.28.2 - "@backstage/core-app-api": 1.15.1 - "@backstage/core-components": ^0.15.1 - "@backstage/core-plugin-api": ^1.10.0 - "@backstage/dev-utils": 1.1.2 - "@backstage/plugin-catalog-react": ^1.14.0 - "@backstage/test-utils": 1.7.0 - "@backstage/theme": ^0.6.0 - "@mui/icons-material": ^5.15.18 - "@mui/material": ^5.15.18 - "@redhat-developer/red-hat-developer-hub-theme": 0.4.0 - "@tanstack/react-query": ^4.36.1 - "@testing-library/jest-dom": 6.4.8 - "@testing-library/react": 14.3.1 - "@testing-library/user-event": 14.5.2 - "@types/node": 18.19.33 - axios: ^1.7.4 - cross-fetch: 4.0.0 - msw: 1.3.3 - prettier: 3.3.3 - react-use: ^17.4.0 - recharts: ^2.9.0 - peerDependencies: - react: ^16.13.1 || ^17.0.0 || ^18.0.0 - languageName: unknown - linkType: soft - "@janus-idp/backstage-plugin-orchestrator-backend@workspace:plugins/orchestrator-backend": version: 0.0.0-use.local resolution: "@janus-idp/backstage-plugin-orchestrator-backend@workspace:plugins/orchestrator-backend" @@ -8441,70 +8263,6 @@ __metadata: languageName: node linkType: hard -"@janus-idp/backstage-plugin-tekton-common@^1.3.1, @janus-idp/backstage-plugin-tekton-common@workspace:plugins/tekton-common": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-plugin-tekton-common@workspace:plugins/tekton-common" - dependencies: - "@backstage/cli": 0.28.2 - prettier: 3.3.3 - peerDependencies: - "@backstage/plugin-permission-common": ^0.8.1 - languageName: unknown - linkType: soft - -"@janus-idp/backstage-plugin-tekton@workspace:plugins/tekton": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-plugin-tekton@workspace:plugins/tekton" - dependencies: - "@aonic-ui/pipelines": ^1.1.1 - "@backstage/catalog-model": ^1.7.0 - "@backstage/cli": 0.28.2 - "@backstage/core-app-api": 1.15.1 - "@backstage/core-components": ^0.15.1 - "@backstage/core-plugin-api": ^1.10.0 - "@backstage/dev-utils": 1.1.2 - "@backstage/plugin-catalog-react": ^1.14.0 - "@backstage/plugin-kubernetes": ^0.11.16 - "@backstage/plugin-kubernetes-common": ^0.8.3 - "@backstage/plugin-kubernetes-react": ^0.4.4 - "@backstage/plugin-permission-react": ^0.4.27 - "@backstage/test-utils": 1.7.0 - "@backstage/theme": ^0.6.0 - "@janus-idp/backstage-plugin-tekton-common": ^1.3.1 - "@janus-idp/shared-react": ^2.13.1 - "@kubernetes/client-node": ^0.22.1 - "@material-ui/core": ^4.9.13 - "@material-ui/icons": ^4.11.3 - "@material-ui/lab": ^4.0.0-alpha.45 - "@mui/icons-material": 5.15.17 - "@patternfly/patternfly": ^5.1.0 - "@patternfly/react-charts": ^7.1.1 - "@patternfly/react-core": ^5.1.2 - "@patternfly/react-tokens": ^5.1.2 - "@patternfly/react-topology": ^5.1.0 - "@playwright/test": 1.45.3 - "@redhat-developer/red-hat-developer-hub-theme": 0.4.0 - "@testing-library/jest-dom": 6.4.8 - "@testing-library/react": 14.3.1 - "@testing-library/react-hooks": 8.0.1 - "@testing-library/user-event": 14.5.2 - "@types/node": 18.19.34 - classnames: ^2.3.2 - cross-fetch: 4.0.0 - dagre: ^0.8.5 - lodash: ^4.17.21 - msw: 1.3.3 - prettier: 3.3.3 - react-measure: ^2.5.2 - react-use: ^17.4.0 - start-server-and-test: 2.0.8 - peerDependencies: - react: ^16.13.1 || ^17.0.0 || ^18.0.0 - react-dom: ^16.13.1 || ^17.0.0 || ^18.0.0 - react-router-dom: ^6.0.0 - languageName: unknown - linkType: soft - "@janus-idp/backstage-plugin-web-terminal@workspace:plugins/web-terminal": version: 0.0.0-use.local resolution: "@janus-idp/backstage-plugin-web-terminal@workspace:plugins/web-terminal" @@ -8571,18 +8329,6 @@ __metadata: languageName: unknown linkType: soft -"@janus-idp/backstage-scaffolder-backend-module-quay@workspace:plugins/quay-actions": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-scaffolder-backend-module-quay@workspace:plugins/quay-actions" - dependencies: - "@backstage/backend-plugin-api": ^1.0.1 - "@backstage/cli": 0.28.2 - "@backstage/plugin-scaffolder-node": ^0.5.0 - "@backstage/plugin-scaffolder-node-test-utils": 0.1.14 - prettier: 3.3.3 - languageName: unknown - linkType: soft - "@janus-idp/cli@*, @janus-idp/cli@workspace:packages/cli": version: 0.0.0-use.local resolution: "@janus-idp/cli@workspace:packages/cli" @@ -8669,7 +8415,7 @@ __metadata: languageName: unknown linkType: soft -"@janus-idp/shared-react@^2.13.1, @janus-idp/shared-react@workspace:plugins/shared-react": +"@janus-idp/shared-react@workspace:plugins/shared-react": version: 0.0.0-use.local resolution: "@janus-idp/shared-react@workspace:plugins/shared-react" dependencies: @@ -9641,22 +9387,13 @@ __metadata: languageName: node linkType: hard -"@lukeed/csprng@npm:^1.0.0, @lukeed/csprng@npm:^1.1.0": +"@lukeed/csprng@npm:^1.0.0": version: 1.1.0 resolution: "@lukeed/csprng@npm:1.1.0" checksum: 926f5f7fc629470ca9a8af355bfcd0271d34535f7be3890f69902432bddc3262029bb5dbe9025542cf6c9883d878692eef2815fc2f3ba5b92e9da1f9eba2e51b languageName: node linkType: hard -"@lukeed/uuid@npm:^2.0.0": - version: 2.0.1 - resolution: "@lukeed/uuid@npm:2.0.1" - dependencies: - "@lukeed/csprng": ^1.1.0 - checksum: f5e71e4da852dbff49b93cad27d5a2f61c2241e307bbe89b3b54b889ecb7927f2487246467f90ebb6cbdb7e0ac2a213e2e58b1182cb7990cef6e049aa7c39e7b - languageName: node - linkType: hard - "@manypkg/find-root@npm:^1.1.0": version: 1.1.0 resolution: "@manypkg/find-root@npm:1.1.0" @@ -10315,7 +10052,7 @@ __metadata: languageName: node linkType: hard -"@mui/material@npm:^5.12.2, @mui/material@npm:^5.15.18": +"@mui/material@npm:^5.12.2": version: 5.16.7 resolution: "@mui/material@npm:5.16.7" dependencies: @@ -11442,7 +11179,7 @@ __metadata: languageName: node linkType: hard -"@patternfly/react-core@npm:^5.1.1, @patternfly/react-core@npm:^5.1.2, @patternfly/react-core@npm:^5.4.8": +"@patternfly/react-core@npm:^5.1.1": version: 5.4.8 resolution: "@patternfly/react-core@npm:5.4.8" dependencies: @@ -11510,23 +11247,6 @@ __metadata: languageName: node linkType: hard -"@patternfly/react-table@npm:^5.1.2": - version: 5.4.8 - resolution: "@patternfly/react-table@npm:5.4.8" - dependencies: - "@patternfly/react-core": ^5.4.8 - "@patternfly/react-icons": ^5.4.2 - "@patternfly/react-styles": ^5.4.1 - "@patternfly/react-tokens": ^5.4.1 - lodash: ^4.17.21 - tslib: ^2.7.0 - peerDependencies: - react: ^17 || ^18 - react-dom: ^17 || ^18 - checksum: 12c279b68367db9b3db44e01631b1d15c8dced087df1555e8327d82243236c35450e696074856381f9e3f984587a08106c48a6f2e7646abaacb1d751c2c5ab1d - languageName: node - linkType: hard - "@patternfly/react-tokens@npm:^4.94.7": version: 4.94.7 resolution: "@patternfly/react-tokens@npm:4.94.7" @@ -11534,7 +11254,7 @@ __metadata: languageName: node linkType: hard -"@patternfly/react-tokens@npm:^5.1.2, @patternfly/react-tokens@npm:^5.4.1": +"@patternfly/react-tokens@npm:^5.4.1": version: 5.4.1 resolution: "@patternfly/react-tokens@npm:5.4.1" checksum: d6f51cbd31db797ed42b148f58ecb28bcc93bdcdf39d0f20b8db5ac40ac2998002ddfad764af38c2f00bc366ac57b1c12fdd42a55e7a30fe3b01e26739e770cf @@ -11575,32 +11295,6 @@ __metadata: languageName: node linkType: hard -"@patternfly/react-topology@npm:^5.1.0": - version: 5.4.0 - resolution: "@patternfly/react-topology@npm:5.4.0" - dependencies: - "@dagrejs/dagre": 1.1.2 - "@patternfly/react-core": ^5.1.1 - "@patternfly/react-icons": ^5.1.1 - "@patternfly/react-styles": ^5.1.1 - "@types/d3": ^7.4.0 - "@types/d3-force": ^1.2.1 - "@types/react-measure": ^2.0.6 - d3: ^7.8.0 - mobx: ^6.9.0 - mobx-react: ^7.6.0 - point-in-svg-path: ^1.0.1 - popper.js: ^1.16.1 - react-measure: ^2.3.0 - tslib: ^2.0.0 - webcola: 3.4.0 - peerDependencies: - react: ^17 || ^18 - react-dom: ^17 || ^18 - checksum: 3b5a4469ba7cf02499d57bc7a82e419895aeba38ce2b35579faf414e763e90ff7a0c599fc6b9b09c9ceb7313f61f2c61aad1a5c20d74fc2cf5b6ae1b299d739a - languageName: node - linkType: hard - "@patternfly/virtual-assistant@npm:2.0.0-alpha.61": version: 2.0.0-alpha.61 resolution: "@patternfly/virtual-assistant@npm:2.0.0-alpha.61" @@ -13246,82 +12940,6 @@ __metadata: languageName: node linkType: hard -"@segment/analytics-core@npm:1.8.0": - version: 1.8.0 - resolution: "@segment/analytics-core@npm:1.8.0" - dependencies: - "@lukeed/uuid": ^2.0.0 - "@segment/analytics-generic-utils": 1.2.0 - dset: ^3.1.4 - tslib: ^2.4.1 - checksum: c8e2a98670658d6400d8e517e141aff6eff581a12a4015ce8ff906185d148cf9dad79cc5bfb5376195794cc0c964a9c9ca79d36f3d4b49affeb7344251dcde1f - languageName: node - linkType: hard - -"@segment/analytics-generic-utils@npm:1.2.0": - version: 1.2.0 - resolution: "@segment/analytics-generic-utils@npm:1.2.0" - dependencies: - tslib: ^2.4.1 - checksum: f36aa093722e4f51dddd4dfa37164bd082175bb0c0960096f9b03073c482e96a17012bc99782259a9d3787e52a48f03ab3447902c6c635654a8ce544892073e5 - languageName: node - linkType: hard - -"@segment/analytics-next@npm:^1.58.0": - version: 1.75.0 - resolution: "@segment/analytics-next@npm:1.75.0" - dependencies: - "@lukeed/uuid": ^2.0.0 - "@segment/analytics-core": 1.8.0 - "@segment/analytics-generic-utils": 1.2.0 - "@segment/analytics.js-video-plugins": ^0.2.1 - "@segment/facade": ^3.4.9 - dset: ^3.1.4 - js-cookie: 3.0.1 - node-fetch: ^2.6.7 - tslib: ^2.4.1 - unfetch: ^4.1.0 - checksum: 92bc7ad1b1364e2446d8df3869a87d4014dc2a096248fdbd0c3bda9f2206e482eedbe044f348f21738f4139925d2d1997cff83df0879659c3accf1a4edf2c2b5 - languageName: node - linkType: hard - -"@segment/analytics.js-video-plugins@npm:^0.2.1": - version: 0.2.1 - resolution: "@segment/analytics.js-video-plugins@npm:0.2.1" - dependencies: - unfetch: ^3.1.1 - checksum: 284b42bb05569366ac4a7c51c90d64bcea64315b2dd330ff8b58c63fa11949443b3d2f7e92d2e3c118495e9018352249183f7d3fb05e4b904148302536d385ba - languageName: node - linkType: hard - -"@segment/facade@npm:^3.4.9": - version: 3.4.10 - resolution: "@segment/facade@npm:3.4.10" - dependencies: - "@segment/isodate-traverse": ^1.1.1 - inherits: ^2.0.4 - new-date: ^1.0.3 - obj-case: 0.2.1 - checksum: 5d10861f586ecebe3a71b25c9f37b3c922298188965047efcfd5b7e6f7147dc6967c3760726c43db99f33ef285191498e0726fc8d2556d5bdd82312a5f647ef2 - languageName: node - linkType: hard - -"@segment/isodate-traverse@npm:^1.1.1": - version: 1.1.1 - resolution: "@segment/isodate-traverse@npm:1.1.1" - dependencies: - "@segment/isodate": ^1.0.3 - checksum: 06f783623c74a7a2310bdcca50355a1f7b9cbb7a1d77f0c7408def29bd0a355dbc2ff31516d025b7cd6baebfdca7d771fb62899f446366f86cd6d34cae9a7000 - languageName: node - linkType: hard - -"@segment/isodate@npm:1.0.3, @segment/isodate@npm:^1.0.3": - version: 1.0.3 - resolution: "@segment/isodate@npm:1.0.3" - checksum: 31faf12e83fa6ab5ba7dfd5600dfaf8d224a00ab24f3a2d3d9ba7f4ecdc1683a55c00fc9246585361aa5cb67c6d7846e1d5497cc3bcca58c105902b79c91c34a - languageName: node - linkType: hard - "@severlessworkflow/sdk-typescript@npm:3.0.3, @severlessworkflow/sdk-typescript@npm:^3.0.3": version: 3.0.3 resolution: "@severlessworkflow/sdk-typescript@npm:3.0.3" @@ -16455,13 +16073,6 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:4.36.1": - version: 4.36.1 - resolution: "@tanstack/query-core@npm:4.36.1" - checksum: 47672094da20d89402d9fe03bb7b0462be73a76ff9ca715169738bc600a719d064d106d083a8eedae22a2c22de22f87d5eb5d31ef447aba771d9190f2117ed10 - languageName: node - linkType: hard - "@tanstack/query-core@npm:5.59.16": version: 5.59.16 resolution: "@tanstack/query-core@npm:5.59.16" @@ -16469,25 +16080,6 @@ __metadata: languageName: node linkType: hard -"@tanstack/react-query@npm:^4.36.1": - version: 4.36.1 - resolution: "@tanstack/react-query@npm:4.36.1" - dependencies: - "@tanstack/query-core": 4.36.1 - use-sync-external-store: ^1.2.0 - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-native: "*" - peerDependenciesMeta: - react-dom: - optional: true - react-native: - optional: true - checksum: 1aff0a476859386f8d32253fa0d0bde7b81769a6d4d4d9cbd78778f0f955459a3bdb7ee27a0d2ee7373090f12998b45df80db0b5b313bd0a7a39d36c6e8e51c5 - languageName: node - linkType: hard - "@tanstack/react-query@npm:^5.59.15": version: 5.59.16 resolution: "@tanstack/react-query@npm:5.59.16" @@ -17325,18 +16917,6 @@ __metadata: languageName: node linkType: hard -"@types/express@npm:4.17.20": - version: 4.17.20 - resolution: "@types/express@npm:4.17.20" - dependencies: - "@types/body-parser": "*" - "@types/express-serve-static-core": ^4.17.33 - "@types/qs": "*" - "@types/serve-static": "*" - checksum: bf8a97d283128e5129f9ccabbeef728ff3f0484465e0ae74a304bd0588fa6cb715ae68845650caba9a641944b7791ba125d02ddbd47a7e62aaefdd036570c6c5 - languageName: node - linkType: hard - "@types/express@npm:4.17.21, @types/express@npm:^4.17.13, @types/express@npm:^4.17.21, @types/express@npm:^4.17.6, @types/express@npm:^4.7.0": version: 4.17.21 resolution: "@types/express@npm:4.17.21" @@ -21542,7 +21122,7 @@ __metadata: languageName: node linkType: hard -"clsx@npm:^2.0.0, clsx@npm:^2.1.0, clsx@npm:^2.1.1": +"clsx@npm:^2.1.0, clsx@npm:^2.1.1": version: 2.1.1 resolution: "clsx@npm:2.1.1" checksum: acd3e1ab9d8a433ecb3cc2f6a05ab95fe50b4a3cfc5ba47abb6cbf3754585fcb87b84e90c822a1f256c4198e3b41c7f6c391577ffc8678ad587fc0976b24fd57 @@ -22440,7 +22020,7 @@ __metadata: languageName: node linkType: hard -"cronstrue@npm:^2.2.0, cronstrue@npm:^2.32.0": +"cronstrue@npm:^2.32.0": version: 2.50.0 resolution: "cronstrue@npm:2.50.0" bin: @@ -23235,13 +22815,6 @@ __metadata: languageName: node linkType: hard -"data-uri-to-buffer@npm:^4.0.0": - version: 4.0.1 - resolution: "data-uri-to-buffer@npm:4.0.1" - checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c - languageName: node - linkType: hard - "data-uri-to-buffer@npm:^6.0.2": version: 6.0.2 resolution: "data-uri-to-buffer@npm:6.0.2" @@ -23404,13 +22977,6 @@ __metadata: languageName: node linkType: hard -"decimal.js-light@npm:^2.4.1": - version: 2.5.1 - resolution: "decimal.js-light@npm:2.5.1" - checksum: f5a2c7eac1c4541c8ab8a5c8abea64fc1761cefc7794bd5f8afd57a8a78d1b51785e0c4e4f85f4895a043eaa90ddca1edc3981d1263eb6ddce60f32bf5fe66c9 - languageName: node - linkType: hard - "decimal.js@npm:^10.2.1, decimal.js@npm:^10.4.2, decimal.js@npm:^10.4.3": version: 10.4.3 resolution: "decimal.js@npm:10.4.3" @@ -24200,7 +23766,7 @@ __metadata: languageName: node linkType: hard -"dset@npm:^3.1.2, dset@npm:^3.1.4": +"dset@npm:^3.1.2": version: 3.1.4 resolution: "dset@npm:3.1.4" checksum: 9a7677e9ffd3c13ad850f7cf367aa94b39984006510e84c3c09b7b88bba0a5b3b7196d85a99d0c4cae4e47d67bdeca43dc1834a41d80f31bcdc86dd26121ecec @@ -25717,7 +25283,7 @@ __metadata: languageName: node linkType: hard -"eventemitter3@npm:^4.0.0, eventemitter3@npm:^4.0.1, eventemitter3@npm:^4.0.4": +"eventemitter3@npm:^4.0.0, eventemitter3@npm:^4.0.4": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" checksum: 1875311c42fcfe9c707b2712c32664a245629b42bb0a5a84439762dd0fd637fc54d078155ea83c2af9e0323c9ac13687e03cfba79b03af9f40c89b4960099374 @@ -26059,13 +25625,6 @@ __metadata: languageName: node linkType: hard -"fast-equals@npm:^5.0.1": - version: 5.0.1 - resolution: "fast-equals@npm:5.0.1" - checksum: fbb3b6a74f3a0fa930afac151ff7d01639159b4fddd2678b5d50708e0ba38e9ec14602222d10dadb8398187342692c04fbef5a62b1cfcc7942fe03e754e064bc - languageName: node - linkType: hard - "fast-fifo@npm:^1.2.0, fast-fifo@npm:^1.3.2": version: 1.3.2 resolution: "fast-fifo@npm:1.3.2" @@ -26277,16 +25836,6 @@ __metadata: languageName: node linkType: hard -"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": - version: 3.2.0 - resolution: "fetch-blob@npm:3.2.0" - dependencies: - node-domexception: ^1.0.0 - web-streams-polyfill: ^3.0.3 - checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf - languageName: node - linkType: hard - "fetch-retry@npm:^5.0.2": version: 5.0.6 resolution: "fetch-retry@npm:5.0.6" @@ -26878,15 +26427,6 @@ __metadata: languageName: node linkType: hard -"formdata-polyfill@npm:^4.0.10": - version: 4.0.10 - resolution: "formdata-polyfill@npm:4.0.10" - dependencies: - fetch-blob: ^3.1.2 - checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db - languageName: node - linkType: hard - "formidable@npm:^2.1.2": version: 2.1.2 resolution: "formidable@npm:2.1.2" @@ -28400,7 +27940,7 @@ __metadata: languageName: node linkType: hard -"http-proxy-middleware@npm:^2.0.0, http-proxy-middleware@npm:^2.0.3, http-proxy-middleware@npm:^2.0.6": +"http-proxy-middleware@npm:^2.0.0, http-proxy-middleware@npm:^2.0.3": version: 2.0.7 resolution: "http-proxy-middleware@npm:2.0.7" dependencies: @@ -30404,13 +29944,6 @@ __metadata: languageName: node linkType: hard -"js-cookie@npm:3.0.1": - version: 3.0.1 - resolution: "js-cookie@npm:3.0.1" - checksum: bb48de67e2a6bd1ae3dfd6b2d5a167c33dd0c5a37e909206161eb0358c98f17cb55acd55827a58e9eea3630d89444e7479f7938ef4420dda443218b8c434a4c3 - languageName: node - linkType: hard - "js-cookie@npm:^2.2.1": version: 2.2.1 resolution: "js-cookie@npm:2.2.1" @@ -31315,7 +30848,7 @@ __metadata: languageName: node linkType: hard -"kubernetes-models@npm:^4.1.0, kubernetes-models@npm:^4.3.1": +"kubernetes-models@npm:^4.3.1": version: 4.4.0 resolution: "kubernetes-models@npm:4.4.0" dependencies: @@ -34459,15 +33992,6 @@ __metadata: languageName: node linkType: hard -"new-date@npm:^1.0.3": - version: 1.0.3 - resolution: "new-date@npm:1.0.3" - dependencies: - "@segment/isodate": 1.0.3 - checksum: 5bc778542276f5d947b77654f10ad796c7502b184bd7f9b87749064a3f69a5cb5631acfceb234b433b3408cfe151de34ee484d5751d1fd87a74d6ec1e7e1ac9c - languageName: node - linkType: hard - "nimma@npm:0.2.2": version: 0.2.2 resolution: "nimma@npm:0.2.2" @@ -34596,17 +34120,6 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^3.3.2": - version: 3.3.2 - resolution: "node-fetch@npm:3.3.2" - dependencies: - data-uri-to-buffer: ^4.0.0 - fetch-blob: ^3.1.4 - formdata-polyfill: ^4.0.10 - checksum: 06a04095a2ddf05b0830a0d5302699704d59bda3102894ea64c7b9d4c865ecdff2d90fd042df7f5bc40337266961cb6183dcc808ea4f3000d024f422b462da92 - languageName: node - linkType: hard - "node-forge@npm:^1, node-forge@npm:^1.2.1, node-forge@npm:^1.3.1": version: 1.3.1 resolution: "node-forge@npm:1.3.1" @@ -34916,13 +34429,6 @@ __metadata: languageName: node linkType: hard -"obj-case@npm:0.2.1": - version: 0.2.1 - resolution: "obj-case@npm:0.2.1" - checksum: 2726b29d054027c52c6ac1a18531c3f995fcc313047847c7f7357889a56cf07bd88bef459bd4645c139fa56f9432c282806e0f1c7ab444d6cbdb662e39073e36 - languageName: node - linkType: hard - "object-assign@npm:^4, object-assign@npm:^4.0.1, object-assign@npm:^4.1.0, object-assign@npm:^4.1.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" @@ -38069,7 +37575,7 @@ __metadata: languageName: node linkType: hard -"react-measure@npm:^2.3.0, react-measure@npm:^2.5.2": +"react-measure@npm:^2.3.0": version: 2.5.2 resolution: "react-measure@npm:2.5.2" dependencies: @@ -38248,20 +37754,6 @@ __metadata: languageName: node linkType: hard -"react-smooth@npm:^4.0.0": - version: 4.0.1 - resolution: "react-smooth@npm:4.0.1" - dependencies: - fast-equals: ^5.0.1 - prop-types: ^15.8.1 - react-transition-group: ^4.4.5 - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - checksum: 42c17803dcb3892a284bbb692d745d438e3bb204ecfc3c9f4f3ff808253ab783f6c64de85a0e84a20c2ea20cf0af39e78b947417ced328164d8dd4eca2918e01 - languageName: node - linkType: hard - "react-sparklines@npm:^1.7.0": version: 1.7.0 resolution: "react-sparklines@npm:1.7.0" @@ -38544,34 +38036,6 @@ __metadata: languageName: node linkType: hard -"recharts-scale@npm:^0.4.4": - version: 0.4.5 - resolution: "recharts-scale@npm:0.4.5" - dependencies: - decimal.js-light: ^2.4.1 - checksum: e970377190a610e684a32c7461c7684ac3603c2e0ac0020bbba1eea9d099b38138143a8e80bf769bb49c0b7cecf22a2f5c6854885efed2d56f4540d4aa7052bd - languageName: node - linkType: hard - -"recharts@npm:^2.9.0": - version: 2.13.0 - resolution: "recharts@npm:2.13.0" - dependencies: - clsx: ^2.0.0 - eventemitter3: ^4.0.1 - lodash: ^4.17.21 - react-is: ^18.3.1 - react-smooth: ^4.0.0 - recharts-scale: ^0.4.4 - tiny-invariant: ^1.3.1 - victory-vendor: ^36.6.8 - peerDependencies: - react: ^16.0.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 - checksum: b4a53895fba5cf152dd9147030c227183eee2b67d0e21ba738ae3782e625d1ebdebe5ced57a6f00d4ef51e418fc50e1c816a0801648039166f3929b412d22847 - languageName: node - linkType: hard - "rechoir@npm:^0.8.0": version: 0.8.0 resolution: "rechoir@npm:0.8.0" @@ -43020,20 +42484,6 @@ __metadata: languageName: node linkType: hard -"unfetch@npm:^3.1.1": - version: 3.1.2 - resolution: "unfetch@npm:3.1.2" - checksum: 5529f0021c51ffa52b5eb36b7b7824f5cbb2167c4a7a09365d071af7534a87a7968a93f1d71f8cdb1aab930af5692af10f53521100999021a05bfb738ff859ab - languageName: node - linkType: hard - -"unfetch@npm:^4.1.0": - version: 4.2.0 - resolution: "unfetch@npm:4.2.0" - checksum: 6a4b2557e1d921eaa80c4425ce27a404945ec26491ed06e62598f333996a91a44c7908cb26dc7c2746d735762b13276cf4aa41829b4c8f438dde63add3045d7a - languageName: node - linkType: hard - "unicode-canonical-property-names-ecmascript@npm:^2.0.0": version: 2.0.1 resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.1" @@ -44102,7 +43552,7 @@ __metadata: languageName: node linkType: hard -"victory-vendor@npm:^36.6.8, victory-vendor@npm:^36.9.2": +"victory-vendor@npm:^36.9.2": version: 36.9.2 resolution: "victory-vendor@npm:36.9.2" dependencies: @@ -45264,7 +44714,7 @@ __metadata: languageName: node linkType: hard -"xterm@npm:^5.2.1, xterm@npm:^5.3.0": +"xterm@npm:^5.3.0": version: 5.3.0 resolution: "xterm@npm:5.3.0" checksum: 1bdfdfe4cae4412128376180d85e476b43fb021cdd1114b18acad821c9ea44b5b600e0d88febf2b3572f38fad7741e5161ce0178a44369617cf937222cc6e011