From f341d3d9cdb94b6b2c0e7ad2e7a52e7c607adc24 Mon Sep 17 00:00:00 2001 From: Bethany Griggs Date: Thu, 5 Dec 2024 18:17:07 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20remove=20migrated=20kubernetes-actions?= =?UTF-8?q?=20and=20scaffolder-annotator-ac=E2=80=A6=20(#2594)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chore: remove migrated kubernetes-actions and scaffolder-annotator-action plugins Signed-off-by: Beth Griggs --- .github/renovate.json | 4 - catalog-info.yaml | 2 - plugins/kubernetes-actions/.eslintignore | 2 - plugins/kubernetes-actions/.eslintrc.js | 1 - plugins/kubernetes-actions/.lintstagedrc.json | 4 - plugins/kubernetes-actions/.prettierignore | 12 - plugins/kubernetes-actions/.prettierrc.js | 20 - plugins/kubernetes-actions/.versionhistory.md | 3 - plugins/kubernetes-actions/CHANGELOG.md | 354 ------------------ plugins/kubernetes-actions/CONTRIBUTING.md | 24 -- plugins/kubernetes-actions/README.md | 6 + .../__fixtures__/cluster-entities/bar.json | 13 - .../__fixtures__/cluster-entities/foo.json | 13 - .../__fixtures__/cluster-entities/qux.json | 11 - plugins/kubernetes-actions/catalog-info.yaml | 61 --- .../templates/01-kubernetes-template.yaml | 64 ---- plugins/kubernetes-actions/package.json | 76 ---- .../actions/createKubernetesNamespace.test.ts | 248 ------------ .../src/actions/createKubernetesNamespace.ts | 235 ------------ .../kubernetes-actions/src/actions/index.ts | 1 - plugins/kubernetes-actions/src/index.ts | 9 - plugins/kubernetes-actions/src/module.ts | 28 -- plugins/kubernetes-actions/tsconfig.json | 9 - plugins/kubernetes-actions/turbo.json | 8 - .../scaffolder-annotator-action/.eslintignore | 2 - .../scaffolder-annotator-action/.eslintrc.js | 1 - .../.lintstagedrc.json | 4 - .../.prettierignore | 12 - .../.prettierrc.js | 20 - .../.versionhistory.md | 2 - .../scaffolder-annotator-action/CHANGELOG.md | 82 ---- plugins/scaffolder-annotator-action/README.md | 6 + .../catalog-info.yaml | 57 --- .../templates/01-scaffolder-template.yaml | 106 ------ .../scaffolder-annotator-action/package.json | 78 ---- .../src/actions/annotator/annotator.test.ts | 301 --------------- .../src/actions/annotator/annotator.ts | 149 -------- .../src/actions/annotator/index.ts | 1 - .../actions/annotator/mocks/catalog-info.yaml | 15 - .../createScaffoldedFromAction.ts | 16 - .../customActions/createTimestampAction.ts | 15 - .../src/actions/customActions/index.ts | 2 - .../src/actions/index.ts | 2 - .../scaffolder-annotator-action/src/index.ts | 9 - .../scaffolder-annotator-action/src/module.ts | 31 -- .../src/utils/getCurrentTimestamp.ts | 4 - .../src/utils/getObjectToAnnotate.ts | 19 - .../src/utils/resolveSpec.ts | 24 -- .../scaffolder-annotator-action/tsconfig.json | 9 - .../scaffolder-annotator-action/turbo.json | 8 - yarn.lock | 55 +-- 51 files changed, 14 insertions(+), 2224 deletions(-) delete mode 100644 plugins/kubernetes-actions/.eslintignore delete mode 100644 plugins/kubernetes-actions/.eslintrc.js delete mode 100644 plugins/kubernetes-actions/.lintstagedrc.json delete mode 100644 plugins/kubernetes-actions/.prettierignore delete mode 100644 plugins/kubernetes-actions/.prettierrc.js delete mode 100644 plugins/kubernetes-actions/.versionhistory.md delete mode 100644 plugins/kubernetes-actions/CHANGELOG.md delete mode 100644 plugins/kubernetes-actions/CONTRIBUTING.md delete mode 100644 plugins/kubernetes-actions/__fixtures__/cluster-entities/bar.json delete mode 100644 plugins/kubernetes-actions/__fixtures__/cluster-entities/foo.json delete mode 100644 plugins/kubernetes-actions/__fixtures__/cluster-entities/qux.json delete mode 100644 plugins/kubernetes-actions/catalog-info.yaml delete mode 100644 plugins/kubernetes-actions/examples/templates/01-kubernetes-template.yaml delete mode 100644 plugins/kubernetes-actions/package.json delete mode 100644 plugins/kubernetes-actions/src/actions/createKubernetesNamespace.test.ts delete mode 100644 plugins/kubernetes-actions/src/actions/createKubernetesNamespace.ts delete mode 100644 plugins/kubernetes-actions/src/actions/index.ts delete mode 100644 plugins/kubernetes-actions/src/index.ts delete mode 100644 plugins/kubernetes-actions/src/module.ts delete mode 100644 plugins/kubernetes-actions/tsconfig.json delete mode 100644 plugins/kubernetes-actions/turbo.json delete mode 100644 plugins/scaffolder-annotator-action/.eslintignore delete mode 100644 plugins/scaffolder-annotator-action/.eslintrc.js delete mode 100644 plugins/scaffolder-annotator-action/.lintstagedrc.json delete mode 100644 plugins/scaffolder-annotator-action/.prettierignore delete mode 100644 plugins/scaffolder-annotator-action/.prettierrc.js delete mode 100644 plugins/scaffolder-annotator-action/.versionhistory.md delete mode 100644 plugins/scaffolder-annotator-action/CHANGELOG.md delete mode 100644 plugins/scaffolder-annotator-action/catalog-info.yaml delete mode 100644 plugins/scaffolder-annotator-action/examples/templates/01-scaffolder-template.yaml delete mode 100644 plugins/scaffolder-annotator-action/package.json delete mode 100644 plugins/scaffolder-annotator-action/src/actions/annotator/annotator.test.ts delete mode 100644 plugins/scaffolder-annotator-action/src/actions/annotator/annotator.ts delete mode 100644 plugins/scaffolder-annotator-action/src/actions/annotator/index.ts delete mode 100644 plugins/scaffolder-annotator-action/src/actions/annotator/mocks/catalog-info.yaml delete mode 100644 plugins/scaffolder-annotator-action/src/actions/customActions/createScaffoldedFromAction.ts delete mode 100644 plugins/scaffolder-annotator-action/src/actions/customActions/createTimestampAction.ts delete mode 100644 plugins/scaffolder-annotator-action/src/actions/customActions/index.ts delete mode 100644 plugins/scaffolder-annotator-action/src/actions/index.ts delete mode 100644 plugins/scaffolder-annotator-action/src/index.ts delete mode 100644 plugins/scaffolder-annotator-action/src/module.ts delete mode 100644 plugins/scaffolder-annotator-action/src/utils/getCurrentTimestamp.ts delete mode 100644 plugins/scaffolder-annotator-action/src/utils/getObjectToAnnotate.ts delete mode 100644 plugins/scaffolder-annotator-action/src/utils/resolveSpec.ts delete mode 100644 plugins/scaffolder-annotator-action/tsconfig.json delete mode 100644 plugins/scaffolder-annotator-action/turbo.json diff --git a/.github/renovate.json b/.github/renovate.json index 3cd36012e3..45f3b775f3 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -182,7 +182,6 @@ { "matchFileNames": [ "plugins/audit-log*/**", - "plugins/scaffolder-annotator-action*/**", "plugins/shared-react*/**", "packages/**", "package.json" @@ -196,7 +195,6 @@ { "matchFileNames": [ "plugins/audit-log*/**", - "plugins/scaffolder-annotator-action*/**", "plugins/shared-react*/**", "packages/**", "package.json" @@ -210,7 +208,6 @@ { "matchFileNames": [ "plugins/aap-backend*/**", - "plugins/kubernetes-actions*/**", "plugins/servicenow-actions*/**", "plugins/sonarqube-actions*/**", "plugins/web-terminal*/**" @@ -225,7 +222,6 @@ "matchFileNames": [ "plugins/aap-backend*/**", "plugins/jfrog-artifactory*/**", - "plugins/kubernetes-actions*/**", "plugins/servicenow-actions*/**", "plugins/sonarqube-actions*/**", "plugins/web-terminal*/**" diff --git a/catalog-info.yaml b/catalog-info.yaml index 5709f25965..200dd407a1 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -42,8 +42,6 @@ spec: - ./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/scaffolder-annotator-action/catalog-info.yaml - ./plugins/shared-react/catalog-info.yaml - ./plugins/web-terminal/catalog-info.yaml - ./packages/cli/catalog-info.yaml diff --git a/plugins/kubernetes-actions/.eslintignore b/plugins/kubernetes-actions/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/kubernetes-actions/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/kubernetes-actions/.eslintrc.js b/plugins/kubernetes-actions/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/kubernetes-actions/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/kubernetes-actions/.lintstagedrc.json b/plugins/kubernetes-actions/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/kubernetes-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/kubernetes-actions/.prettierignore b/plugins/kubernetes-actions/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/kubernetes-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/kubernetes-actions/.prettierrc.js b/plugins/kubernetes-actions/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/kubernetes-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/kubernetes-actions/.versionhistory.md b/plugins/kubernetes-actions/.versionhistory.md deleted file mode 100644 index 3686ed4465..0000000000 --- a/plugins/kubernetes-actions/.versionhistory.md +++ /dev/null @@ -1,3 +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 -- Bumped to 2.3.0 in main branch, in prep for release of 1.4.0 diff --git a/plugins/kubernetes-actions/CHANGELOG.md b/plugins/kubernetes-actions/CHANGELOG.md deleted file mode 100644 index f32d40bde3..0000000000 --- a/plugins/kubernetes-actions/CHANGELOG.md +++ /dev/null @@ -1,354 +0,0 @@ -### Dependencies - -## 2.3.0 - -### Minor Changes - -- 9671df5: Bump plugins/kubernetes-actions to 2.3.0 in main branch, in prep for release of 1.4.0 - -## 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.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. - -## 2.1.1 - -### Patch Changes - -- ffe2546: Fix CVE-2024-21534 by upgrading @kubernetes/client-node package to 0.22.1 - -## 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-kubernetes [1.7.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.6.0...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.6.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.5.2...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.5.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.5.1...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.5.2) (2024-06-25) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.5.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.5.0...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.5.1) (2024-06-19) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.11.1 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.5.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.14...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.4.14](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.13...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.14) (2024-06-13) - -### Bug Fixes - -- missing postversion script is several plugins and missing turbo dependency ([#1811](https://github.com/janus-idp/backstage-plugins/issues/1811)) ([4dfe4f5](https://github.com/janus-idp/backstage-plugins/commit/4dfe4f533e21e79c928c66bfd68684243912be2c)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.1 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.13](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.12...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.13) (2024-06-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.10.0 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.12](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.11...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.12) (2024-06-04) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.10...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.11) (2024-06-03) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.9.0 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.9...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.10) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.10 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.8...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.9) (2024-05-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.9 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.7...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.8) (2024-05-17) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.6...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.7) (2024-05-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.7 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.5...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.6) (2024-05-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.6 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.4...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.5) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.5 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.3...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.4) (2024-05-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.4 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.2...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.3) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.3 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.1...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.2) (2024-04-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.2 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.0...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.4.1) (2024-04-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.8.1 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.4.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.11...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.3.11](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.10...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.11) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.10 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.10](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.9...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.10) (2024-04-09) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.9 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.9](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.8...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.9) (2024-04-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.8 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.8](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.7...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.8) (2024-04-02) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.7 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.6...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.7) (2024-03-29) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.6 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.5...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.6) (2024-03-11) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.4...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.5) (2024-03-04) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.5 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.3...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.4) (2024-02-27) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.4 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.2...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.3) (2024-02-26) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.3 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.1...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.2) (2024-02-21) - -### Bug Fixes - -- **kubernetes-actions:** support adding labels while creating namespace ([#1223](https://github.com/janus-idp/backstage-plugins/issues/1223)) ([2b266bc](https://github.com/janus-idp/backstage-plugins/commit/2b266bc123e3446c18bdaa0dda34fe7e53b16404)) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.2 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.0...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.3.1) (2024-02-05) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.7.1 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.7...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.2.7](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.6...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.7) (2024-01-25) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.6.0 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.2.6](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.5...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.6) (2024-01-16) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.5.0 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.2.5](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.4...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.2.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.3...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.4) (2023-12-07) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.7 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.2.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.2...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.3) (2023-11-30) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.6 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.2.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.1...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.2) (2023-11-22) - -### Dependencies - -- **@janus-idp/cli:** upgraded to 1.4.5 - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.2.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.2.0...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.1.2...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.1.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.1.1...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.1.2) (2023-10-19) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.1.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.1.0...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.1.1) (2023-08-30) - -### Bug Fixes - -- **kubernetes-actions:** fix code smells ([#686](https://github.com/janus-idp/backstage-plugins/issues/686)) ([ea58682](https://github.com/janus-idp/backstage-plugins/commit/ea5868235af3d1e7163ecc5f7c81b91cb08fcd43)) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.4...@janus-idp/backstage-scaffolder-backend-module-kubernetes@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-kubernetes [1.0.4](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.3...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.4) (2023-07-25) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes [1.0.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.2...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.3) (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-kubernetes [1.0.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.1...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.2) (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-kubernetes [1.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.0...@janus-idp/backstage-scaffolder-backend-module-kubernetes@1.0.1) (2023-05-31) - -## @janus-idp/backstage-scaffolder-backend-module-kubernetes 1.0.0 (2023-05-31) - -### Features - -- **k8s-actions:** add create namespace action ([#292](https://github.com/janus-idp/backstage-plugins/issues/292)) ([00ef86f](https://github.com/janus-idp/backstage-plugins/commit/00ef86f0dcc9dec3bc7e2939827459c57b576859)) diff --git a/plugins/kubernetes-actions/CONTRIBUTING.md b/plugins/kubernetes-actions/CONTRIBUTING.md deleted file mode 100644 index 0520181ee5..0000000000 --- a/plugins/kubernetes-actions/CONTRIBUTING.md +++ /dev/null @@ -1,24 +0,0 @@ -# Setting up the development environment for Kubernetes action - -1. Add the local package dependency to the Backstage instance - - ```shell - yarn workspace backend add file:./plugins/kubernetes-actions - ``` - -2. [Register](./README.md#configuration) the Kubernetes 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/kubernetes-actions/examples/templates/01-kubernetes-template.yaml - rules: - - allow: [Template] - ``` - -4. Run `yarn dev` -5. Make sure you have an available kubernetes cluster -6. Start using the Kubernetes actions in your templates diff --git a/plugins/kubernetes-actions/README.md b/plugins/kubernetes-actions/README.md index e66aebacad..dc137e3fbc 100644 --- a/plugins/kubernetes-actions/README.md +++ b/plugins/kubernetes-actions/README.md @@ -1,3 +1,9 @@ +# ❗DEPRECATED❗ + +This package has been deprecated. + +Please use the **[@backstage-community/plugin-scaffolder-backend-module-kubernetes](https://github.com/backstage/community-plugins/tree/main/workspaces/scaffolder-backend-module-kubernetes)** package instead. + # Kubernetes actions for Backstage This module provides [Backstage](https://backstage.io/) template [actions](https://backstage.io/docs/features/software-templates/builtin-actions) for [Kubernetes](https://kubernetes.io/docs/home/). diff --git a/plugins/kubernetes-actions/__fixtures__/cluster-entities/bar.json b/plugins/kubernetes-actions/__fixtures__/cluster-entities/bar.json deleted file mode 100644 index 58355f445d..0000000000 --- a/plugins/kubernetes-actions/__fixtures__/cluster-entities/bar.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "apiVersion": "backstage.io/v1beta1", - "kind": "Resource", - "metadata": { - "annotations": { - "kubernetes.io/api-server": "http://localhost:5000" - }, - "name": "bar" - }, - "spec": { - "type": "db" - } -} diff --git a/plugins/kubernetes-actions/__fixtures__/cluster-entities/foo.json b/plugins/kubernetes-actions/__fixtures__/cluster-entities/foo.json deleted file mode 100644 index 7a5679be19..0000000000 --- a/plugins/kubernetes-actions/__fixtures__/cluster-entities/foo.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "apiVersion": "backstage.io/v1beta1", - "kind": "Resource", - "metadata": { - "annotations": { - "kubernetes.io/api-server": "http://localhost:5000" - }, - "name": "foo" - }, - "spec": { - "type": "kubernetes-cluster" - } -} diff --git a/plugins/kubernetes-actions/__fixtures__/cluster-entities/qux.json b/plugins/kubernetes-actions/__fixtures__/cluster-entities/qux.json deleted file mode 100644 index 0050e640a8..0000000000 --- a/plugins/kubernetes-actions/__fixtures__/cluster-entities/qux.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "apiVersion": "backstage.io/v1beta1", - "kind": "Resource", - "metadata": { - "annotations": {}, - "name": "qux" - }, - "spec": { - "type": "kubernetes-cluster" - } -} diff --git a/plugins/kubernetes-actions/catalog-info.yaml b/plugins/kubernetes-actions/catalog-info.yaml deleted file mode 100644 index e355e07e1c..0000000000 --- a/plugins/kubernetes-actions/catalog-info.yaml +++ /dev/null @@ -1,61 +0,0 @@ -# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: janus-idp-kubernetes-actions-scaffolder - title: Kubernetes scaffolder actions - description: Kubernetes scaffolder actions for Backstage - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/kubernetes-actions - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/kubernetes-actions/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/kubernetes-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: - - kubernetes - - openshift - - scaffolder - - actions - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/kubernetes-actions - title: GitHub Source - icon: source - type: source -spec: - type: backstage-plugin - lifecycle: production - owner: rhdh-ui-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-kubernetes-actions-scaffolder-module - title: '@janus-idp/backstage-scaffolder-backend-module-kubernetes' - description: Kubernetes scaffolder actions for Backstage - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/kubernetes-actions - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/kubernetes-actions/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/kubernetes-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: - - kubernetes - - openshift - - scaffolder - - actions - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/kubernetes-actions - title: GitHub Source - icon: source - type: source -spec: - type: backstage-frontend-plugin-module - lifecycle: production - owner: rhdh-ui-team - system: rhdh - subcomponentOf: janus-idp-kubernetes-actions-scaffolder diff --git a/plugins/kubernetes-actions/examples/templates/01-kubernetes-template.yaml b/plugins/kubernetes-actions/examples/templates/01-kubernetes-template.yaml deleted file mode 100644 index 2dd5f8f1d1..0000000000 --- a/plugins/kubernetes-actions/examples/templates/01-kubernetes-template.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: scaffolder.backstage.io/v1beta3 -kind: Template -metadata: - name: create-kubernetes-namespace - title: Create a kubernetes namespace - description: Create a kubernetes namespace - -spec: - type: service - parameters: - - title: Information - required: [namespace, token] - properties: - namespace: - title: Namespace name - type: string - description: Name of the namespace to be created - clusterRef: - title: Cluster reference - type: string - description: Cluster resource entity reference from the catalog - ui:field: EntityPicker - ui:options: - catalogFilter: - kind: Resource - url: - title: Url - type: string - description: Url of the kubernetes API, will be used if clusterRef is not provided - token: - title: Token - type: string - description: Bearer token to authenticate with - skipTLSVerify: - title: Skip TLS verification - type: boolean - description: Skip TLS certificate verification, not recommended to use in production environment, default to false - caData: - title: CA data - type: string - description: Certificate Authority base64 encoded certificate - labels: - title: Labels - type: string - description: Labels to be applied to the namespace - ui:widget: textarea - ui:options: - rows: 3 - ui:help: 'Hint: Separate multiple labels with a semicolon!' - ui:placeholder: 'kubernetes.io/type=namespace; app.io/managed-by=org' - - - steps: - - id: create-kubernetes-namespace - name: Create kubernetes namespace - action: kubernetes:create-namespace - input: - namespace: ${{ parameters.namespace }} - clusterRef: ${{ parameters.clusterRef }} - url: ${{ parameters.url }} - token: ${{ parameters.token }} - skipTLSVerify: ${{ parameters.skipTLSVerify }} - caData: ${{ parameters.caData }} - labels: ${{ parameters.labels }} diff --git a/plugins/kubernetes-actions/package.json b/plugins/kubernetes-actions/package.json deleted file mode 100644 index f2c2025ae7..0000000000 --- a/plugins/kubernetes-actions/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@janus-idp/backstage-scaffolder-backend-module-kubernetes", - "description": "The kubernetes module for @backstage/plugin-scaffolder-backend", - "version": "2.3.0", - "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": { - "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/backend-plugin-api": "^1.0.1", - "@backstage/catalog-client": "^1.7.1", - "@backstage/plugin-scaffolder-node": "^0.5.0", - "@kubernetes/client-node": "^0.22.1" - }, - "devDependencies": { - "@backstage/catalog-model": "1.7.0", - "@backstage/cli": "0.28.2", - "@backstage/plugin-scaffolder-node-test-utils": "0.1.14", - "msw": "1.3.3", - "prettier": "3.3.3" - }, - "files": [ - "dist", - "dist-dynamic/*.*", - "dist-dynamic/dist/**" - ], - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/kubernetes-actions" - }, - "keywords": [ - "support:tech-preview", - "lifecycle:active", - "backstage", - "backend-plugin-module" - ], - "homepage": "https://red.ht/rhdh", - "bugs": "https://github.com/janus-idp/backstage-plugins/issues", - "maintainers": [ - "@janus-idp/maintainers-plugins" - ], - "author": "The Backstage Community" -} diff --git a/plugins/kubernetes-actions/src/actions/createKubernetesNamespace.test.ts b/plugins/kubernetes-actions/src/actions/createKubernetesNamespace.test.ts deleted file mode 100644 index 165d94815f..0000000000 --- a/plugins/kubernetes-actions/src/actions/createKubernetesNamespace.test.ts +++ /dev/null @@ -1,248 +0,0 @@ -import type { CatalogClient } from '@backstage/catalog-client'; -import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils'; - -import type { V1Namespace } from '@kubernetes/client-node'; -import { rest } from 'msw'; -import { setupServer } from 'msw/node'; - -import { - convertLabelsToObject, - createKubernetesNamespaceAction, -} from './createKubernetesNamespace'; - -const LOCAL_ADDR = 'http://localhost:5000'; -const FIXTURES_DIR = `${__dirname}/../../__fixtures__/cluster-entities`; - -const handlers = [ - rest.post(`${LOCAL_ADDR}/api/v1/namespaces`, async (req, res, ctx) => { - const ns = (await req.json()) as V1Namespace; - if (ns.metadata?.name === 'error') { - const error = { - body: { - kind: 'Status', - apiVersion: 'v1', - metadata: {}, - status: 'Failure', - message: 'Unauthorized', - reason: 'Unauthorized', - code: 401, - }, - statusCode: 401, - message: 'Unauthorized', - }; - return res(ctx.status(401), ctx.json(error)); - } - return res(ctx.status(200), ctx.json({})); - }), -]; - -const server = setupServer(...handlers); - -beforeAll(() => server.listen()); -afterEach(() => server.restoreHandlers()); -afterAll(() => server.close()); - -describe('kubernetes:create-namespace', () => { - afterEach(() => { - jest.clearAllMocks(); - }); - - const catalogClientFn = jest.fn(async (entityRef: string) => { - switch (entityRef) { - case 'resource:foo': - return require(`${FIXTURES_DIR}/foo`); - case 'resource:bar': - return require(`${FIXTURES_DIR}/bar`); - case 'resource:qux': - return require(`${FIXTURES_DIR}/qux`); - default: - return undefined; - } - }); - - const action = createKubernetesNamespaceAction({ - getEntityByRef: catalogClientFn, - } as unknown as CatalogClient); - - const mockContext = createMockActionContext(); - - it('should get the api url from the correct entity', async () => { - await action.handler({ - ...mockContext, - input: { - namespace: 'foo', - clusterRef: 'resource:foo', - token: 'TOKEN', - }, - }); - - expect(catalogClientFn).toHaveBeenCalledTimes(1); - expect(catalogClientFn).toHaveBeenCalledWith('resource:foo'); - }); - - it.each([ - { - entityName: 'foo', - calledWith: 'resource:foo', - warnMsg: 'Cluster reference in the wrong format, attempting to fix it', - name: 'should warn and try to fix the entity name', - }, - { - entityName: 'resource:bar', - calledWith: 'resource:bar', - warnMsg: 'Resource is not of kubernetes-cluster type', - name: 'should warn if the resource is not kubernetes-cluster', - }, - ])('$name', async ({ entityName, calledWith, warnMsg }) => { - const mockedWarn = jest.spyOn(mockContext.logger, 'warn'); - await action.handler({ - ...mockContext, - input: { - namespace: entityName, - clusterRef: entityName, - token: 'TOKEN', - }, - }); - - expect(mockedWarn).toHaveBeenCalledWith(warnMsg); - expect(catalogClientFn).toHaveBeenCalledTimes(1); - expect(catalogClientFn).toHaveBeenCalledWith(calledWith); - }); - - it.each([ - { - entityName: 'resource:missing-entity', - error: 'Resource not found', - name: 'should throw if the entity is not found', - }, - { - entityName: 'resource:qux', - error: 'Cluster resource is missing kubernetes.io/api-server annotation', - name: 'should throw if the api url annotation is not present', - }, - ])('$name', async ({ entityName, error }) => { - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - namespace: entityName, - clusterRef: entityName, - token: 'TOKEN', - }, - }); - }).rejects.toThrow(error); - - expect(catalogClientFn).toHaveBeenCalledTimes(1); - expect(catalogClientFn).toHaveBeenCalledWith(entityName); - }); - - it('should throw if neither url nor clusterRef is provided', async () => { - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - namespace: 'foo', - token: 'TOKEN', - }, - }); - }).rejects.toThrow('Cluster reference or url are required'); - }); - - it('should throw if url and clusterRef are provided', async () => { - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - namespace: 'foo', - url: 'http://example.com', - clusterRef: 'foo', - token: 'TOKEN', - }, - }); - }).rejects.toThrow( - "Cluster reference and url can't be specified at the same time", - ); - }); - - it('should correctly parse a http error', async () => { - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - namespace: 'error', - url: 'http://localhost:5000', - token: 'TOKEN', - }, - }); - }).rejects.toThrow( - 'Failed to create kubernetes namespace, 401 -- Unauthorized', - ); - }); - - it('should throw an error while using an invalid api url', async () => { - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - namespace: 'foo', - token: 'TOKEN', - url: 'bar', - }, - }); - }).rejects.toThrow('"bar" is an invalid url'); - }); - - it('should throw if empty string is provided as api url', async () => { - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - namespace: 'foo', - token: 'TOKEN', - url: '', - }, - }); - }).rejects.toThrow('Cluster reference or url are required'); - }); - - it('should throw if undefined is provided as api url', async () => { - await expect(async () => { - await action.handler({ - ...mockContext, - input: { - namespace: 'foo', - token: 'TOKEN', - url: undefined, - }, - }); - }).rejects.toThrow('Cluster reference or url are required'); - }); -}); - -describe('convertLabelsToObject', () => { - test('converts labels string to object', () => { - const labelsString = 'key1=value1;key2=value2;key3=value3'; - const expectedObject = { - key1: 'value1', - key2: 'value2', - key3: 'value3', - }; - expect(convertLabelsToObject(labelsString)).toEqual(expectedObject); - }); - - test('handles empty string', () => { - expect(convertLabelsToObject('')).toEqual({}); - }); - - test('handles invalid input', () => { - // No '=' in the string - expect(convertLabelsToObject('key1value1;')).toEqual({}); - }); - - test('handles invalid labels', () => { - // Label without '=' - expect(convertLabelsToObject('key1value1;key2=value2;=value3')).toEqual({ - key2: 'value2', - }); - }); -}); diff --git a/plugins/kubernetes-actions/src/actions/createKubernetesNamespace.ts b/plugins/kubernetes-actions/src/actions/createKubernetesNamespace.ts deleted file mode 100644 index 3d88beb651..0000000000 --- a/plugins/kubernetes-actions/src/actions/createKubernetesNamespace.ts +++ /dev/null @@ -1,235 +0,0 @@ -import { CatalogClient } from '@backstage/catalog-client'; -import type { Entity } from '@backstage/catalog-model'; -import { - createTemplateAction, - type ActionContext, -} from '@backstage/plugin-scaffolder-node'; - -import { - CoreV1Api, - KubeConfig, - V1Namespace, - type HttpError, -} from '@kubernetes/client-node'; - -const KUBERNETES_API_URL_ANNOTATION = 'kubernetes.io/api-server'; -const KUBERNETES_CLUSTER_TYPE = 'kubernetes-cluster'; - -export interface HttpErrorBody { - kind: string; - apiVersion: string; - metadata: Object; - status: string; - message: string; - reason: string; - details: { name: string; kind: string }; - code: number; -} - -type TemplateActionParameters = { - namespace: string; - clusterRef?: string; - url?: string; - token: string; - skipTLSVerify?: boolean; - caData?: string; - labels?: string; -}; - -const getUrlFromClusterRef = async ( - ctx: ActionContext, - catalogClient: CatalogClient, - clusterRef: string, -): Promise => { - const isResource = clusterRef.startsWith('resource:'); - if (!isResource) { - ctx.logger.warn( - 'Cluster reference in the wrong format, attempting to fix it', - ); - } - const catalogEntity: Entity | undefined = await catalogClient.getEntityByRef( - isResource ? clusterRef : `resource:${clusterRef}`, - ); - if (!catalogEntity) { - throw new Error('Resource not found'); - } - if (catalogEntity.spec?.type !== KUBERNETES_CLUSTER_TYPE) { - ctx.logger.warn(`Resource is not of ${KUBERNETES_CLUSTER_TYPE} type`); - } - const apiUrl = - catalogEntity.metadata?.annotations?.[KUBERNETES_API_URL_ANNOTATION]; - if (!apiUrl) { - throw new Error( - `Cluster resource is missing ${KUBERNETES_API_URL_ANNOTATION} annotation`, - ); - } - return apiUrl; -}; - -const validateUrl = (url: string | undefined = '') => { - try { - // eslint-disable-next-line no-new - new URL(url); - } catch (error) { - throw new Error(`"${url}" is an invalid url`); - } -}; - -export const convertLabelsToObject = ( - labelsString: string | undefined, -): { [key: string]: string } => { - const result: { [key: string]: string } = {}; - - if (!labelsString || labelsString.indexOf('=') === -1) { - console.error( - "Invalid label string. Label string must contain at least one label separated by '=' character.", - ); - return result; - } - - const labelsArray = labelsString.split(';'); - - labelsArray.forEach(label => { - const separatorIndex = label.indexOf('='); - if (separatorIndex !== -1) { - const key = label.slice(0, separatorIndex).trim(); - const value = label.slice(separatorIndex + 1).trim(); - if (key && value) { - result[key] = value; - } - } else { - console.error( - `Invalid label: '${label}'. Label must contain at least one '=' character.`, - ); - } - }); - - return result; -}; - -export function createKubernetesNamespaceAction(catalogClient: CatalogClient) { - return createTemplateAction({ - id: 'kubernetes:create-namespace', - description: 'Creates a kubernetes namespace', - schema: { - input: { - type: 'object', - oneOf: [ - { required: ['namespace', 'token', 'url'] }, - { required: ['namespace', 'token', 'clusterRef'] }, - ], - properties: { - namespace: { - title: 'Namespace name', - description: 'Name of the namespace to be created', - type: 'string', - }, - clusterRef: { - title: 'Cluster entity reference', - description: 'Cluster resource entity reference from the catalog', - type: 'string', - }, - url: { - title: 'Url', - description: - 'Url of the kubernetes API, will be used if clusterRef is not provided', - type: 'string', - }, - token: { - title: 'Token', - description: 'Bearer token to authenticate with', - type: 'string', - }, - skipTLSVerify: { - title: 'Skip TLS verification', - description: - 'Skip TLS certificate verification, not recommended to use in production environment, defaults to false', - type: 'boolean', - }, - caData: { - title: 'CA Data', - description: 'Certificate Authority base64 encoded certificate', - type: 'string', - }, - labels: { - title: 'Labels', - description: 'Labels that will be applied to the namespace.', - type: 'string', - }, - }, - }, - }, - async handler(ctx) { - const { - namespace, - clusterRef, - token, - url, - skipTLSVerify, - caData, - labels, - } = ctx.input; - const kubeConfig = new KubeConfig(); - const name = 'backstage'; - const cluster = { - server: '', - name, - serviceAccountToken: token, - skipTLSVerify: skipTLSVerify || false, - caData, - }; - - if (clusterRef && url) { - throw new Error( - "Cluster reference and url can't be specified at the same time", - ); - } - - if (!clusterRef && !url) { - throw new Error('Cluster reference or url are required'); - } - - if (clusterRef) { - cluster.server = await getUrlFromClusterRef( - ctx, - catalogClient, - clusterRef, - ); - } else { - validateUrl(url); - cluster.server = url!; - } - - kubeConfig.loadFromOptions({ - clusters: [cluster], - users: [{ name, token }], - contexts: [ - { - name, - user: name, - cluster: name, - }, - ], - currentContext: name, - }); - - const namespaceLabels = convertLabelsToObject(labels); - - const api = kubeConfig.makeApiClient(CoreV1Api); - const k8sNamespace: V1Namespace = { - metadata: { - name: namespace, - labels: namespaceLabels, - }, - }; - await api.createNamespace(k8sNamespace).catch((e: HttpError) => { - const errorBody = e.body as HttpErrorBody; - const statusCode = errorBody?.code || e.statusCode; - const message = errorBody?.message || e.message; - throw new Error( - `Failed to create kubernetes namespace, ${statusCode} -- ${message}`, - ); - }); - }, - }); -} diff --git a/plugins/kubernetes-actions/src/actions/index.ts b/plugins/kubernetes-actions/src/actions/index.ts deleted file mode 100644 index e204493c2c..0000000000 --- a/plugins/kubernetes-actions/src/actions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { createKubernetesNamespaceAction } from './createKubernetesNamespace'; diff --git a/plugins/kubernetes-actions/src/index.ts b/plugins/kubernetes-actions/src/index.ts deleted file mode 100644 index 605f669e33..0000000000 --- a/plugins/kubernetes-actions/src/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/***/ -/** - * The kubernetes module for @backstage/plugin-scaffolder-backend. - * - * @packageDocumentation - */ - -export * from './actions'; -export { scaffolderModuleKubernetesAction as default } from './module'; diff --git a/plugins/kubernetes-actions/src/module.ts b/plugins/kubernetes-actions/src/module.ts deleted file mode 100644 index 570492c8c1..0000000000 --- a/plugins/kubernetes-actions/src/module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { - coreServices, - createBackendModule, -} from '@backstage/backend-plugin-api'; -import { CatalogClient } from '@backstage/catalog-client'; -import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha'; - -import { createKubernetesNamespaceAction } from './actions'; - -export const scaffolderModuleKubernetesAction = createBackendModule({ - moduleId: 'scaffolder-backend-kubernetes', - pluginId: 'scaffolder', - register(env) { - env.registerInit({ - deps: { - scaffolder: scaffolderActionsExtensionPoint, - discovery: coreServices.discovery, - }, - async init({ scaffolder, discovery }) { - const catalogClient = new CatalogClient({ - discoveryApi: discovery, - }); - - scaffolder.addActions(createKubernetesNamespaceAction(catalogClient)); - }, - }); - }, -}); diff --git a/plugins/kubernetes-actions/tsconfig.json b/plugins/kubernetes-actions/tsconfig.json deleted file mode 100644 index 5fb48a812b..0000000000 --- a/plugins/kubernetes-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/kubernetes-actions", - "rootDir": "." - } -} diff --git a/plugins/kubernetes-actions/turbo.json b/plugins/kubernetes-actions/turbo.json deleted file mode 100644 index 72c44f3057..0000000000 --- a/plugins/kubernetes-actions/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/kubernetes-actions/**"] - } - } -} diff --git a/plugins/scaffolder-annotator-action/.eslintignore b/plugins/scaffolder-annotator-action/.eslintignore deleted file mode 100644 index 55289f4a23..0000000000 --- a/plugins/scaffolder-annotator-action/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist-dynamic -dist-scalprum diff --git a/plugins/scaffolder-annotator-action/.eslintrc.js b/plugins/scaffolder-annotator-action/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/plugins/scaffolder-annotator-action/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/scaffolder-annotator-action/.lintstagedrc.json b/plugins/scaffolder-annotator-action/.lintstagedrc.json deleted file mode 100644 index 14b2263def..0000000000 --- a/plugins/scaffolder-annotator-action/.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/scaffolder-annotator-action/.prettierignore b/plugins/scaffolder-annotator-action/.prettierignore deleted file mode 100644 index fc8357d99e..0000000000 --- a/plugins/scaffolder-annotator-action/.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/scaffolder-annotator-action/.prettierrc.js b/plugins/scaffolder-annotator-action/.prettierrc.js deleted file mode 100644 index 84cbac65b5..0000000000 --- a/plugins/scaffolder-annotator-action/.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/scaffolder-annotator-action/.versionhistory.md b/plugins/scaffolder-annotator-action/.versionhistory.md deleted file mode 100644 index 129eb310b5..0000000000 --- a/plugins/scaffolder-annotator-action/.versionhistory.md +++ /dev/null @@ -1,2 +0,0 @@ -- Bumped to 1.4.0 in main branch for next release 1.3.0 -- Bumped to 2.3.0 in main branch, in prep for release of 1.4.0 diff --git a/plugins/scaffolder-annotator-action/CHANGELOG.md b/plugins/scaffolder-annotator-action/CHANGELOG.md deleted file mode 100644 index 0985eac618..0000000000 --- a/plugins/scaffolder-annotator-action/CHANGELOG.md +++ /dev/null @@ -1,82 +0,0 @@ -## @janus-idp/backstage-scaffolder-backend-module-annotator [1.3.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.2.1...@janus-idp/backstage-scaffolder-backend-module-annotator@1.3.0) (2024-07-25) - -## 2.3.0 - -### Minor Changes - -- 9671df5: Bump plugins/scaffolder-annotator-action to 2.3.0 in main branch, in prep for release of 1.4.0 - -## 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: 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 - -### 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-annotator [1.2.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.2.0...@janus-idp/backstage-scaffolder-backend-module-annotator@1.2.1) (2024-07-24) - -### Bug Fixes - -- **deps:** rollback unreleased plugins ([#1951](https://github.com/janus-idp/backstage-plugins/issues/1951)) ([8b77969](https://github.com/janus-idp/backstage-plugins/commit/8b779694f02f8125587296305276b84cdfeeaebe)) - -## @janus-idp/backstage-scaffolder-backend-module-annotator [1.2.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.1.0...@janus-idp/backstage-scaffolder-backend-module-annotator@1.2.0) (2024-07-22) - -### 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-annotator [1.1.0](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.0.3...@janus-idp/backstage-scaffolder-backend-module-annotator@1.1.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)) - -## @janus-idp/backstage-scaffolder-backend-module-annotator [1.0.3](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.0.2...@janus-idp/backstage-scaffolder-backend-module-annotator@1.0.3) (2024-06-13) - -### Bug Fixes - -- missing postversion script is several plugins and missing turbo dependency ([#1811](https://github.com/janus-idp/backstage-plugins/issues/1811)) ([4dfe4f5](https://github.com/janus-idp/backstage-plugins/commit/4dfe4f533e21e79c928c66bfd68684243912be2c)) - -## @janus-idp/backstage-scaffolder-backend-module-annotator [1.0.2](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.0.1...@janus-idp/backstage-scaffolder-backend-module-annotator@1.0.2) (2024-06-04) - -## @janus-idp/backstage-scaffolder-backend-module-annotator [1.0.1](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-scaffolder-backend-module-annotator@1.0.0...@janus-idp/backstage-scaffolder-backend-module-annotator@1.0.1) (2024-05-31) - -### Bug Fixes - -- **scaffolder:** update annotator action readme ([#1638](https://github.com/janus-idp/backstage-plugins/issues/1638)) ([8e3af1b](https://github.com/janus-idp/backstage-plugins/commit/8e3af1b91b1cc874d4e867717eef1dc9eca592fc)) - -## @janus-idp/backstage-scaffolder-backend-module-annotator 1.0.0 (2024-05-09) - -### Features - -- **scaffolder:** create custom action for scaffolder templates ([#1567](https://github.com/janus-idp/backstage-plugins/issues/1567)) ([e30701e](https://github.com/janus-idp/backstage-plugins/commit/e30701ec9c0ba09ad56cbc23fb7f8a8cb9c561c9)) diff --git a/plugins/scaffolder-annotator-action/README.md b/plugins/scaffolder-annotator-action/README.md index 8d40eeba25..149d085952 100644 --- a/plugins/scaffolder-annotator-action/README.md +++ b/plugins/scaffolder-annotator-action/README.md @@ -1,3 +1,9 @@ +# ❗DEPRECATED❗ + +This package has been deprecated. + +Please use the **[@backstage-community/plugin-scaffolder-backend-module-annotator](https://github.com/backstage/community-plugins/tree/main/workspaces/scaffolder-backend-module-annotator)** package instead. + # Annotator custom action for Scaffolder Backstage The annotator module for [@backstage/plugin-scaffolder-backend](https://www.npmjs.com/package/@backstage/plugin-scaffolder-backend). diff --git a/plugins/scaffolder-annotator-action/catalog-info.yaml b/plugins/scaffolder-annotator-action/catalog-info.yaml deleted file mode 100644 index 359f0ce5c1..0000000000 --- a/plugins/scaffolder-annotator-action/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-scaffolder-annotator-action - title: Annotator scaffolder actions - description: The annotator module for @backstage/plugin-scaffolder-backend - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/scaffolder-annotator-action - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/scaffolder-annotator-action/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/scaffolder-annotator-action/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: - - scaffolder - - actions - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/scaffolder-annotator-action - title: GitHub Source - icon: source - type: source -spec: - type: backstage-plugin - lifecycle: production - owner: rhdh-ui-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-scaffolder-annotator-action-module - title: '@janus-idp/backstage-scaffolder-backend-module-annotator' - description: The annotator module for @backstage/plugin-scaffolder-backend - annotations: - backstage.io/source-location: url:https://github.com/janus-idp/backstage-plugins/tree/main/plugins/scaffolder-annotator-action - backstage.io/view-url: https://github.com/janus-idp/backstage-plugins/blob/main/plugins/scaffolder-annotator-action/catalog-info.yaml - backstage.io/edit-url: https://github.com/janus-idp/backstage-plugins/edit/main/plugins/scaffolder-annotator-action/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: - - scaffolder - - actions - links: - - url: https://github.com/janus-idp/backstage-plugins/tree/main/plugins/scaffolder-annotator-action - title: GitHub Source - icon: source - type: source -spec: - type: backstage-frontend-plugin-module - lifecycle: production - owner: rhdh-ui-team - system: rhdh - subcomponentOf: janus-idp-scaffolder-annotator-action diff --git a/plugins/scaffolder-annotator-action/examples/templates/01-scaffolder-template.yaml b/plugins/scaffolder-annotator-action/examples/templates/01-scaffolder-template.yaml deleted file mode 100644 index ac8b15cac1..0000000000 --- a/plugins/scaffolder-annotator-action/examples/templates/01-scaffolder-template.yaml +++ /dev/null @@ -1,106 +0,0 @@ -apiVersion: scaffolder.backstage.io/v1beta3 -kind: Template -metadata: - name: create-react-app-template-with-timestamp-entityRef - title: Create React App Template - description: Create a new CRA website project - tags: - - react - - cra -spec: - owner: web@example.com - type: website - parameters: - - title: Provide some simple information - required: - - component_id - - owner - properties: - component_id: - title: Name - type: string - description: Unique name of the component - ui:field: EntityNamePicker - description: - title: Description - type: string - description: Help others understand what this website is for. - owner: - title: Owner - type: string - description: Owner of the component - ui:field: OwnerPicker - ui:options: - allowedKinds: - - Group - - title: Choose a location - required: - - repoUrl - properties: - repoUrl: - title: Repository Location - type: string - ui:field: RepoUrlPicker - ui:options: - allowedHosts: - - github.com - steps: - - id: template - name: Fetch Skeleton + Template - action: fetch:template - input: - url: https://github.com/backstage/software-templates/tree/main/scaffolder-templates/create-react-app/skeleton - copyWithoutRender: - - .github/workflows/* - values: - component_id: ${{ parameters.component_id }} - description: ${{ parameters.description }} - destination: ${{ parameters.repoUrl | parseRepoUrl }} - owner: ${{ parameters.owner }} - - # this step is an example of using the `catalog:timestamping` action - - id: timestamp - name: Add Timestamp to catalog-info.yaml - action: catalog:timestamping - - # this step is an example of using the `catalog:annotate` action - - id: add-fields-to-catalog-info - name: Add a few fields into `catalog-info.yaml` using the generic action - action: catalog:annotate - input: - labels: - custom: ${{ parameters.label }} - other: "test-label" - annotations: - custom.io/annotation: ${{ parameters.label }} - custom.io/other: "value" - - # this step is an example of using the `catalog:scaffolded-from` action - - id: append-templateRef - name: Append the entityRef of this template to the entityRef - action: catalog:scaffolded-from - - - id: publish - name: Publish - action: publish:github - input: - allowedHosts: - - github.com - description: This is ${{ parameters.component_id }} - repoUrl: ${{ parameters.repoUrl }} - repoVisibility: public - - - id: register - name: Register - action: catalog:register - input: - repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }} - catalogInfoPath: '/catalog-info.yaml' - - output: - links: - - title: Repository - url: ${{ steps.publish.output.remoteUrl }} - - title: Open in catalog - icon: catalog - entityRef: ${{ steps.register.output.entityRef }} \ No newline at end of file diff --git a/plugins/scaffolder-annotator-action/package.json b/plugins/scaffolder-annotator-action/package.json deleted file mode 100644 index 27829d8034..0000000000 --- a/plugins/scaffolder-annotator-action/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "@janus-idp/backstage-scaffolder-backend-module-annotator", - "description": "The annotator module for @backstage/plugin-scaffolder-backend", - "version": "2.3.0", - "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": { - "start": "backstage-cli package start", - "build": "backstage-cli package build", - "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", - "lodash": "^4.17.21", - "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", - "fs-extra": "^11.2.0", - "lodash": "^4.17.21", - "yaml": "^2.0.0" - }, - "devDependencies": { - "@backstage/backend-test-utils": "1.0.2", - "@backstage/cli": "0.28.2", - "prettier": "3.3.3" - }, - "files": [ - "dist", - "config.d.ts", - "dist-dynamic/*.*", - "dist-dynamic/dist/**", - "app-config.janus-idp.yaml" - ], - "repository": { - "type": "git", - "url": "https://github.com/janus-idp/backstage-plugins", - "directory": "plugins/scaffolder-annotator-action" - }, - "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" - ], - "author": "The Backstage Community" -} diff --git a/plugins/scaffolder-annotator-action/src/actions/annotator/annotator.test.ts b/plugins/scaffolder-annotator-action/src/actions/annotator/annotator.test.ts deleted file mode 100644 index 9641b320c9..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/annotator/annotator.test.ts +++ /dev/null @@ -1,301 +0,0 @@ -import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; -import { mockServices } from '@backstage/backend-test-utils'; - -import * as fs from 'fs-extra'; -import * as yaml from 'yaml'; - -import { PassThrough } from 'stream'; - -import { getCurrentTimestamp } from '../../utils/getCurrentTimestamp'; -import { createAnnotatorAction } from './annotator'; - -describe('catalog annotator', () => { - const workspacePath = 'src/actions/annotator/mocks'; - - afterEach(() => { - jest.resetAllMocks(); - }); - - it('should call action to annotate with timestamp', async () => { - const action = createAnnotatorAction( - 'catalog:timestamping', - 'Creates a new `catalog:timestamping` Scaffolder action to annotate scaffolded entities with creation timestamp.', - 'some logger info msg', - () => { - return { - annotations: { 'backstage.io/createdAt': getCurrentTimestamp() }, - }; - }, - ); - - const logger = mockServices.logger.mock(); - jest.spyOn(logger, 'info'); - - await action.handler({ - workspacePath, - logger, - logStream: new PassThrough(), - output: jest.fn(), - createTemporaryDirectory() { - // Usage of createMockDirectory is recommended for testing of filesystem operations - throw new Error('Not implemented'); - }, - } as any); - - const updatedCatalogInfoYaml = await fs.readFile( - resolveSafeChildPath(workspacePath, './catalog-info.yaml'), - 'utf8', - ); - - const entity = yaml.parse(updatedCatalogInfoYaml); - - expect(logger.info).toHaveBeenCalledWith('some logger info msg'); - expect( - entity?.metadata?.annotations?.['backstage.io/createdAt'], - ).toBeTruthy(); - - // undo catalog-info.yaml file changes - delete entity?.metadata?.annotations?.['backstage.io/createdAt']; - await fs.writeFile( - resolveSafeChildPath(workspacePath, './catalog-info.yaml'), - yaml.stringify(entity), - 'utf8', - ); - }); - - it('should call action to annotate catalog-info.yaml', async () => { - const catalogInfoYaml = await fs.readFile( - resolveSafeChildPath(workspacePath, './catalog-info.yaml'), - 'utf8', - ); - const action = createAnnotatorAction( - 'catalog:test-annotate', - 'Creates a new `catalog:test-annotate` Scaffolder action to annotate catalog-info.yaml with labels and annotations.', - '', - () => { - return {}; - }, - ); - - const logger = mockServices.logger.mock(); - jest.spyOn(logger, 'info'); - - const mockContext = { - workspacePath, - logger, - logStream: new PassThrough(), - input: { - labels: { - label1: 'value1', - label2: 'value2', - label3: 'value3', - }, - annotations: { - annotation1: 'value1', - annotation2: 'value2', - annotation3: 'value3', - }, - }, - output: jest.fn(), - createTemporaryDirectory() { - // Usage of createMockDirectory is recommended for testing of filesystem operations - throw new Error('Not implemented'); - }, - }; - - await action.handler(mockContext as any); - - let entity: { [key: string]: any } = yaml.parse(catalogInfoYaml); - entity = { - ...entity, - metadata: { - ...entity.metadata, - labels: { - ...entity.metadata.labels, - ...mockContext.input.labels, - }, - annotations: { - ...entity.metadata.annotations, - ...mockContext.input.annotations, - }, - }, - }; - - expect(logger.info).toHaveBeenCalledWith('Annotating your object'); - expect(mockContext.output).toHaveBeenCalledWith( - 'annotatedObject', - yaml.stringify(entity), - ); - }); - - it('should call action to annotate any obj', async () => { - const action = createAnnotatorAction( - 'catalog:test-annotate-obj', - 'Creates a new `catalog:test-annotate-obj` Scaffolder action to annotate any object yaml with labels and annotations.', - 'some logger info message', - () => { - return {}; - }, - ); - - const logger = mockServices.logger.mock(); - jest.spyOn(logger, 'info'); - - const obj: { [key: string]: any } = { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Component', - metadata: { - name: 'n', - namespace: 'ns', - annotations: { - ['backstage.io/managed-by-origin-location']: - 'url:https://example.com', - }, - }, - spec: {}, - }; - - const mockContext = { - workspacePath, - logger, - logStream: new PassThrough(), - input: { - labels: { - label1: 'value1', - label2: 'value2', - label3: 'value3', - }, - annotations: { - annotation1: 'value1', - annotation2: 'value2', - annotation3: 'value3', - }, - objectYaml: obj, - }, - output: jest.fn(), - createTemporaryDirectory() { - // Usage of createMockDirectory is recommended for testing of filesystem operations - throw new Error('Not implemented'); - }, - }; - - await action.handler(mockContext as any); - - const entity = { - ...obj, - metadata: { - ...obj.metadata, - labels: { - ...(obj.metadata.labels || {}), - ...mockContext.input.labels, - }, - annotations: { - ...(obj.metadata.annotations || {}), - ...mockContext.input.annotations, - }, - }, - }; - - expect(logger.info).toHaveBeenCalledWith('some logger info message'); - expect(mockContext.output).toHaveBeenCalledWith( - 'annotatedObject', - yaml.stringify(entity), - ); - }); - - it('should call action to annotate with template entityRef', async () => { - const action = createAnnotatorAction( - 'catalog:entityRef', - 'Some description', - 'some logger info msg', - () => { - return { spec: { scaffoldedFrom: 'testt-ref' } }; - }, - ); - - const logger = mockServices.logger.mock(); - jest.spyOn(logger, 'info'); - - await action.handler({ - workspacePath, - logger, - logStream: new PassThrough(), - templateInfo: { - entityRef: 'test-entityRef', - }, - output: jest.fn(), - createTemporaryDirectory() { - // Usage of createMockDirectory is recommended for testing of filesystem operations - throw new Error('Not implemented'); - }, - } as any); - - const updatedCatalogInfoYaml = await fs.readFile( - resolveSafeChildPath(workspacePath, './catalog-info.yaml'), - 'utf8', - ); - - const entity = yaml.parse(updatedCatalogInfoYaml); - - expect(logger.info).toHaveBeenCalledWith('some logger info msg'); - expect(entity?.spec?.scaffoldedFrom).toBe('testt-ref'); - - // undo catalog-info.yaml file changes - delete entity?.spec?.scaffoldedFrom; - await fs.writeFile( - resolveSafeChildPath(workspacePath, './catalog-info.yaml'), - yaml.stringify(entity), - 'utf8', - ); - }); - - it('should call action to annotate with template entityRef where the entityRef is read from the context', async () => { - const action = createAnnotatorAction( - 'catalog:entityRef', - 'Some description', - 'some logger info msg', - () => { - return { - spec: { - scaffoldedFrom: { readFromContext: 'templateInfo.entityRef' }, - }, - }; - }, - ); - - const logger = mockServices.logger.mock(); - jest.spyOn(logger, 'info'); - - await action.handler({ - workspacePath, - logger, - logStream: new PassThrough(), - templateInfo: { - entityRef: 'test-entityRef', - }, - output: jest.fn(), - createTemporaryDirectory() { - // Usage of createMockDirectory is recommended for testing of filesystem operations - throw new Error('Not implemented'); - }, - } as any); - - const updatedCatalogInfoYaml = await fs.readFile( - resolveSafeChildPath(workspacePath, './catalog-info.yaml'), - 'utf8', - ); - - const entity = yaml.parse(updatedCatalogInfoYaml); - - expect(logger.info).toHaveBeenCalledWith('some logger info msg'); - expect(entity?.spec?.scaffoldedFrom).toBe('test-entityRef'); - - // undo catalog-info.yaml file changes - delete entity?.spec?.scaffoldedFrom; - await fs.writeFile( - resolveSafeChildPath(workspacePath, './catalog-info.yaml'), - yaml.stringify(entity), - 'utf8', - ); - }); -}); diff --git a/plugins/scaffolder-annotator-action/src/actions/annotator/annotator.ts b/plugins/scaffolder-annotator-action/src/actions/annotator/annotator.ts deleted file mode 100644 index 2e9b95e5a4..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/annotator/annotator.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; -import { createTemplateAction } from '@backstage/plugin-scaffolder-node'; - -import * as fs from 'fs-extra'; -import * as yaml from 'yaml'; - -import { getObjectToAnnotate } from '../../utils/getObjectToAnnotate'; -import { resolveSpec, Value } from '../../utils/resolveSpec'; - -/** - * Creates a new Scaffolder action to annotate an entity object with specified label(s), annotation(s) and spec property(ies). - * - */ - -export const createAnnotatorAction = ( - actionId: string = 'catalog:annotate', - actionDescription?: string, - loggerInfoMsg?: string, - annotateEntityObjectProvider?: () => { - annotations?: { [key: string]: string }; - labels?: { [key: string]: string }; - spec?: { [key: string]: Value }; - }, -) => { - return createTemplateAction<{ - labels?: { [key: string]: string }; - annotations?: { [key: string]: string }; - spec?: { [key: string]: string }; - entityFilePath?: string; - objectYaml?: { [key: string]: string }; - writeToFile?: string; - }>({ - id: actionId, - description: - actionDescription || - 'Creates a new scaffolder action to annotate the entity object with specified label(s), annotation(s) and spec property(ies).', - schema: { - input: { - type: 'object', - properties: { - labels: { - title: 'Labels', - description: - 'Labels that will be applied to the `metadata.labels` of the entity object', - type: 'object', - }, - annotations: { - title: 'Annotations', - description: - 'Annotations that will be applied to the `metadata.annotations` of the entity object', - type: 'object', - }, - spec: { - title: 'Spec', - description: - 'Key-Value pair(s) that will be applied to the `spec` of the entity object', - type: 'object', - }, - entityFilePath: { - title: 'Entity File Path', - description: 'Path to the entity yaml you want to annotate', - type: 'string', - }, - objectYaml: { - title: 'Object Yaml', - description: 'Entity object yaml you want to annotate', - type: 'object', - }, - writeToFile: { - title: 'Write To File', - description: - 'Path to the file you want to write. Default path `./catalog-info.yaml`', - type: 'string', - }, - }, - }, - output: { - type: 'object', - properties: { - annotatedObject: { - type: 'object', - title: - 'The entity object annotated with your desired annotation(s), label(s) and spec property(ies)', - }, - }, - }, - }, - async handler(ctx) { - const annotateEntityObject = annotateEntityObjectProvider?.(); - let objToAnnotate: { [key: string]: any }; - - if (ctx.input?.objectYaml) { - objToAnnotate = { ...ctx.input?.objectYaml }; - } else { - objToAnnotate = await getObjectToAnnotate( - ctx.workspacePath, - ctx.input?.entityFilePath, - ); - } - const annotatedObj = { - ...objToAnnotate, - metadata: { - ...objToAnnotate.metadata, - annotations: { - ...(objToAnnotate.metadata.annotations || {}), - ...(annotateEntityObject?.annotations || {}), - ...(ctx.input?.annotations || {}), - }, - labels: { - ...(objToAnnotate.metadata.labels || {}), - ...(annotateEntityObject?.labels || {}), - ...(ctx.input?.labels || {}), - }, - }, - spec: { - ...(objToAnnotate.spec || {}), - ...resolveSpec(annotateEntityObject?.spec, ctx), - ...(ctx.input?.spec || {}), - }, - }; - - const result = yaml.stringify(annotatedObj); - if ( - Object.keys( - annotateEntityObject?.labels || - annotateEntityObject?.annotations || - annotateEntityObject?.spec || - ctx.input?.labels || - ctx.input?.annotations || - ctx.input?.spec || - {}, - ).length > 0 - ) { - ctx.logger.info(loggerInfoMsg || 'Annotating your object'); - - await fs.writeFile( - resolveSafeChildPath( - ctx.workspacePath, - ctx.input?.writeToFile || './catalog-info.yaml', - ), - result, - 'utf8', - ); - } - - ctx.output('annotatedObject', result); - }, - }); -}; diff --git a/plugins/scaffolder-annotator-action/src/actions/annotator/index.ts b/plugins/scaffolder-annotator-action/src/actions/annotator/index.ts deleted file mode 100644 index 8720222965..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/annotator/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './annotator'; diff --git a/plugins/scaffolder-annotator-action/src/actions/annotator/mocks/catalog-info.yaml b/plugins/scaffolder-annotator-action/src/actions/annotator/mocks/catalog-info.yaml deleted file mode 100644 index 6a0a5ba9b1..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/annotator/mocks/catalog-info.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - name: n - namespace: ns - annotations: - backstage.io/managed-by-origin-location: url:https://example.com - annotation1: value1 - annotation2: value2 - annotation3: value3 - labels: - label1: value1 - label2: value2 - label3: value3 -spec: {} diff --git a/plugins/scaffolder-annotator-action/src/actions/customActions/createScaffoldedFromAction.ts b/plugins/scaffolder-annotator-action/src/actions/customActions/createScaffoldedFromAction.ts deleted file mode 100644 index 8af429de3e..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/customActions/createScaffoldedFromAction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { createAnnotatorAction } from '../annotator/annotator'; - -export const createScaffoldedFromAction = () => { - return createAnnotatorAction( - 'catalog:scaffolded-from', - 'Creates a new `catalog:scaffolded-from` scaffolder action to update a catalog-info.yaml with the entityRef of the template that created it.', - 'Annotating catalog-info.yaml with template entityRef', - () => { - return { - spec: { - scaffoldedFrom: { readFromContext: 'templateInfo.entityRef' }, - }, - }; - }, - ); -}; diff --git a/plugins/scaffolder-annotator-action/src/actions/customActions/createTimestampAction.ts b/plugins/scaffolder-annotator-action/src/actions/customActions/createTimestampAction.ts deleted file mode 100644 index f887f62777..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/customActions/createTimestampAction.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { getCurrentTimestamp } from '../../utils/getCurrentTimestamp'; -import { createAnnotatorAction } from '../annotator/annotator'; - -export const createTimestampAction = () => { - return createAnnotatorAction( - 'catalog:timestamping', - 'Creates a new `catalog:timestamping` Scaffolder action to annotate scaffolded entities with creation timestamp.', - 'Annotating catalog-info.yaml with current timestamp', - () => { - return { - annotations: { 'backstage.io/createdAt': getCurrentTimestamp() }, - }; - }, - ); -}; diff --git a/plugins/scaffolder-annotator-action/src/actions/customActions/index.ts b/plugins/scaffolder-annotator-action/src/actions/customActions/index.ts deleted file mode 100644 index 044b0da16b..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/customActions/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './createTimestampAction'; -export * from './createScaffoldedFromAction'; diff --git a/plugins/scaffolder-annotator-action/src/actions/index.ts b/plugins/scaffolder-annotator-action/src/actions/index.ts deleted file mode 100644 index d7a6df9d2e..0000000000 --- a/plugins/scaffolder-annotator-action/src/actions/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './annotator'; -export * from './customActions'; diff --git a/plugins/scaffolder-annotator-action/src/index.ts b/plugins/scaffolder-annotator-action/src/index.ts deleted file mode 100644 index bff5ac8086..0000000000 --- a/plugins/scaffolder-annotator-action/src/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/***/ -/** - * The annotator module for @backstage/plugin-scaffolder-backend. - * - * @packageDocumentation - */ - -export * from './actions'; -export { scaffolderCustomActionsScaffolderModule as default } from './module'; diff --git a/plugins/scaffolder-annotator-action/src/module.ts b/plugins/scaffolder-annotator-action/src/module.ts deleted file mode 100644 index 1bd1e2c0db..0000000000 --- a/plugins/scaffolder-annotator-action/src/module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { createBackendModule } from '@backstage/backend-plugin-api'; -import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha'; - -import { - createAnnotatorAction, - createScaffoldedFromAction, - createTimestampAction, -} from './actions'; - -/***/ -/** - * The annotator module for @backstage/plugin-scaffolder-backend. - * - * @alpha - */ -export const scaffolderCustomActionsScaffolderModule = createBackendModule({ - moduleId: 'scaffolder-backend-scaffolder-annotator', - pluginId: 'scaffolder', - register(env) { - env.registerInit({ - deps: { - scaffolder: scaffolderActionsExtensionPoint, - }, - async init({ scaffolder }) { - scaffolder.addActions(createScaffoldedFromAction()); - scaffolder.addActions(createTimestampAction()); - scaffolder.addActions(createAnnotatorAction()); - }, - }); - }, -}); diff --git a/plugins/scaffolder-annotator-action/src/utils/getCurrentTimestamp.ts b/plugins/scaffolder-annotator-action/src/utils/getCurrentTimestamp.ts deleted file mode 100644 index 7e7c717de1..0000000000 --- a/plugins/scaffolder-annotator-action/src/utils/getCurrentTimestamp.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const getCurrentTimestamp = (date?: Date) => { - const dateObj = date || new Date(Date.now()); - return `${dateObj.toLocaleDateString()}, ${dateObj.toLocaleTimeString('en-US')}`; -}; diff --git a/plugins/scaffolder-annotator-action/src/utils/getObjectToAnnotate.ts b/plugins/scaffolder-annotator-action/src/utils/getObjectToAnnotate.ts deleted file mode 100644 index 8049027286..0000000000 --- a/plugins/scaffolder-annotator-action/src/utils/getObjectToAnnotate.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; - -import * as fs from 'fs-extra'; -import * as yaml from 'yaml'; - -export const getObjectToAnnotate = async ( - workspacePath: string, - objectFilePath: string | undefined, -): Promise<{ [key: string]: any }> => { - const obj = await fs.readFile( - resolveSafeChildPath( - workspacePath, - objectFilePath || './catalog-info.yaml', - ), - 'utf8', - ); - - return yaml.parse(obj); -}; diff --git a/plugins/scaffolder-annotator-action/src/utils/resolveSpec.ts b/plugins/scaffolder-annotator-action/src/utils/resolveSpec.ts deleted file mode 100644 index eb93f9d3d8..0000000000 --- a/plugins/scaffolder-annotator-action/src/utils/resolveSpec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { ActionContext } from '@backstage/plugin-scaffolder-node'; - -import { get } from 'lodash'; - -export type Value = string | { readFromContext: string }; - -export const resolveSpec = ( - spec: { [key: string]: Value } | undefined, - ctx: ActionContext, -) => { - if (!spec || Object.keys(spec).length === 0) { - return {}; - } - return Object.keys(spec).reduce((acc, s) => { - const val = spec[s]; - return { - ...acc, - ...{ - [`${s}`]: - typeof val === 'string' ? spec[s] : get(ctx, val.readFromContext), - }, - }; - }, {}); -}; diff --git a/plugins/scaffolder-annotator-action/tsconfig.json b/plugins/scaffolder-annotator-action/tsconfig.json deleted file mode 100644 index cd2c17d43b..0000000000 --- a/plugins/scaffolder-annotator-action/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/scaffolder-annotator-action", - "rootDir": "." - } -} diff --git a/plugins/scaffolder-annotator-action/turbo.json b/plugins/scaffolder-annotator-action/turbo.json deleted file mode 100644 index 6ef1af54e6..0000000000 --- a/plugins/scaffolder-annotator-action/turbo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["//"], - "tasks": { - "tsc": { - "outputs": ["../../dist-types/plugins/scaffolder-annotator-action/**"] - } - } -} diff --git a/yarn.lock b/yarn.lock index 68b39a9c02..c89676e3e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3040,7 +3040,7 @@ __metadata: languageName: node linkType: hard -"@backstage/backend-test-utils@npm:1.0.2, @backstage/backend-test-utils@npm:^1.0.2": +"@backstage/backend-test-utils@npm:1.0.2": version: 1.0.2 resolution: "@backstage/backend-test-utils@npm:1.0.2" dependencies: @@ -3090,7 +3090,7 @@ __metadata: languageName: node linkType: hard -"@backstage/catalog-model@npm:1.7.0, @backstage/catalog-model@npm:^1.7.0": +"@backstage/catalog-model@npm:^1.7.0": version: 1.7.0 resolution: "@backstage/catalog-model@npm:1.7.0" dependencies: @@ -4765,26 +4765,6 @@ __metadata: languageName: node linkType: hard -"@backstage/plugin-scaffolder-node-test-utils@npm:0.1.14": - version: 0.1.14 - resolution: "@backstage/plugin-scaffolder-node-test-utils@npm:0.1.14" - dependencies: - "@backstage/backend-common": ^0.25.0 - "@backstage/backend-test-utils": ^1.0.2 - "@backstage/plugin-scaffolder-node": ^0.5.0 - "@backstage/types": ^1.1.1 - 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: 0aa7c0dd0a618821eb288bc60358cf1d5abe28792d305b6e0c25f8169dc9a6598f4ff1c9e1c8c76f1187ce69bea72095001ee01a5560bf20b5384f473a4093aa - languageName: node - linkType: hard - "@backstage/plugin-scaffolder-node@npm:^0.5.0": version: 0.5.0 resolution: "@backstage/plugin-scaffolder-node@npm:0.5.0" @@ -7838,37 +7818,6 @@ __metadata: languageName: unknown linkType: soft -"@janus-idp/backstage-scaffolder-backend-module-annotator@workspace:plugins/scaffolder-annotator-action": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-scaffolder-backend-module-annotator@workspace:plugins/scaffolder-annotator-action" - dependencies: - "@backstage/backend-plugin-api": ^1.0.1 - "@backstage/backend-test-utils": 1.0.2 - "@backstage/cli": 0.28.2 - "@backstage/plugin-scaffolder-node": ^0.5.0 - fs-extra: ^11.2.0 - lodash: ^4.17.21 - prettier: 3.3.3 - yaml: ^2.0.0 - languageName: unknown - linkType: soft - -"@janus-idp/backstage-scaffolder-backend-module-kubernetes@workspace:plugins/kubernetes-actions": - version: 0.0.0-use.local - resolution: "@janus-idp/backstage-scaffolder-backend-module-kubernetes@workspace:plugins/kubernetes-actions" - dependencies: - "@backstage/backend-plugin-api": ^1.0.1 - "@backstage/catalog-client": ^1.7.1 - "@backstage/catalog-model": 1.7.0 - "@backstage/cli": 0.28.2 - "@backstage/plugin-scaffolder-node": ^0.5.0 - "@backstage/plugin-scaffolder-node-test-utils": 0.1.14 - "@kubernetes/client-node": ^0.22.1 - msw: 1.3.3 - 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"