From b01e55e877278afc5de8d28a4c687a6989566bdc Mon Sep 17 00:00:00 2001 From: Tom Coufal <7453394+tumido@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:06:55 +0100 Subject: [PATCH] fix: add config partials for dynamic frontend plugins (#965) Signed-off-by: Tomas Coufal --- plugins/aap-backend/app-config.janus-idp.yaml | 2 - plugins/acr/README.md | 17 ++++---- plugins/acr/app-config.janus-idp.yaml | 23 +++++++++++ plugins/acr/package.json | 3 +- .../app-config.janus-idp.yaml | 6 +++ .../analytics-provider-segment/package.json | 3 +- plugins/jfrog-artifactory/README.md | 13 ++++--- .../app-config.janus-idp.yaml | 21 ++++++++++ plugins/jfrog-artifactory/package.json | 3 +- plugins/matomo-backend/README.md | 2 +- .../matomo-backend/app-config.janus-idp.yaml | 3 ++ plugins/matomo/app-config.janus-idp.yaml | 3 ++ plugins/matomo/package.json | 3 +- plugins/nexus-repository-manager/README.md | 19 ++++----- .../app-config.janus-idp.yaml | 27 +++++++++++++ plugins/nexus-repository-manager/package.json | 3 +- plugins/ocm-backend/app-config.janus-idp.yaml | 2 - plugins/ocm/app-config.janus-idp.yaml | 39 +++++++++++++++++++ plugins/ocm/package.json | 3 +- plugins/openshift-image-registry/README.md | 17 ++++---- .../app-config.janus-idp.yaml | 20 ++++++++++ plugins/openshift-image-registry/package.json | 3 +- plugins/quay/app-config.janus-idp.yaml | 12 ++++++ plugins/tekton/README.md | 7 +++- plugins/tekton/app-config.janus-idp.yaml | 12 ++++++ plugins/tekton/package.json | 3 +- plugins/topology/app-config.janus-idp.yaml | 14 +++++++ plugins/topology/package.json | 3 +- 28 files changed, 239 insertions(+), 47 deletions(-) create mode 100644 plugins/acr/app-config.janus-idp.yaml create mode 100644 plugins/analytics-provider-segment/app-config.janus-idp.yaml create mode 100644 plugins/jfrog-artifactory/app-config.janus-idp.yaml create mode 100644 plugins/matomo-backend/app-config.janus-idp.yaml create mode 100644 plugins/matomo/app-config.janus-idp.yaml create mode 100644 plugins/nexus-repository-manager/app-config.janus-idp.yaml create mode 100644 plugins/ocm/app-config.janus-idp.yaml create mode 100644 plugins/openshift-image-registry/app-config.janus-idp.yaml create mode 100644 plugins/quay/app-config.janus-idp.yaml create mode 100644 plugins/tekton/app-config.janus-idp.yaml create mode 100644 plugins/topology/app-config.janus-idp.yaml diff --git a/plugins/aap-backend/app-config.janus-idp.yaml b/plugins/aap-backend/app-config.janus-idp.yaml index e5bb1254f1..ac9049ab51 100644 --- a/plugins/aap-backend/app-config.janus-idp.yaml +++ b/plugins/aap-backend/app-config.janus-idp.yaml @@ -1,5 +1,3 @@ -enabled: - aap: true catalog: providers: aap: diff --git a/plugins/acr/README.md b/plugins/acr/README.md index 8ff0ec66f8..4a584aa38e 100644 --- a/plugins/acr/README.md +++ b/plugins/acr/README.md @@ -17,14 +17,15 @@ The Azure Container Registry (ACR) plugin displays information about your contai ```yaml # app-config.yaml proxy: - '/acr/api': - target: 'https://mycontainerregistry.azurecr.io/acr/v1/' - changeOrigin: true - headers: - # If you use Bearer Token for authorization, please replace the 'Basic' with 'Bearer' in the following line. - Authorization: 'Basic ${ACR_AUTH_TOKEN}' - # Change to "false" in case of using self hosted artifactory instance with a self-signed certificate - secure: true + endpoints: + '/acr/api': + target: 'https://mycontainerregistry.azurecr.io/acr/v1/' + changeOrigin: true + headers: + # If you use Bearer Token for authorization, please replace the 'Basic' with 'Bearer' in the following line. + Authorization: 'Basic ${ACR_AUTH_TOKEN}' + # Change to "false" in case of using self hosted artifactory instance with a self-signed certificate + secure: true ``` 1. Set the authorization using one of the following options: diff --git a/plugins/acr/app-config.janus-idp.yaml b/plugins/acr/app-config.janus-idp.yaml new file mode 100644 index 0000000000..0c52266c66 --- /dev/null +++ b/plugins/acr/app-config.janus-idp.yaml @@ -0,0 +1,23 @@ +proxy: + endpoints: + '/acr/api': + target: ${ACR_URL} + changeOrigin: true + headers: + # If you use Bearer Token for authorization, please replace the 'Basic' with 'Bearer' in the following line. + Authorization: 'Bearer ${ACR_AUTH_TOKEN}' + # Change to "false" in case of using self hosted artifactory instance with a self-signed certificate + secure: true + +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-acr: + mountPoints: + - mountPoint: entity.page.image-registry/cards + importName: AcrPage + config: + layout: + gridColumn: 1 / -1 + if: + anyOf: + - isAcrAvailable diff --git a/plugins/acr/package.json b/plugins/acr/package.json index 1b74733179..080ff2d22d 100644 --- a/plugins/acr/package.json +++ b/plugins/acr/package.json @@ -55,7 +55,8 @@ }, "files": [ "dist", - "dist-scalprum" + "dist-scalprum", + "app-config.janus-idp.yaml" ], "repository": "github:janus-idp/backstage-plugins", "keywords": [ diff --git a/plugins/analytics-provider-segment/app-config.janus-idp.yaml b/plugins/analytics-provider-segment/app-config.janus-idp.yaml new file mode 100644 index 0000000000..127c2a448d --- /dev/null +++ b/plugins/analytics-provider-segment/app-config.janus-idp.yaml @@ -0,0 +1,6 @@ +app: + analytics: + segment: + writeKey: ${SEGMENT_WRITE_KEY} + maskIP: true # prevents IP addresses from being sent if true + testMode: false # prevents data from being sent if true diff --git a/plugins/analytics-provider-segment/package.json b/plugins/analytics-provider-segment/package.json index b8f7651696..37cb94118e 100644 --- a/plugins/analytics-provider-segment/package.json +++ b/plugins/analytics-provider-segment/package.json @@ -58,7 +58,8 @@ "files": [ "dist", "dist-scalprum", - "config.d.ts" + "config.d.ts", + "app-config.janus-idp.yaml" ], "configSchema": "config.d.ts" } diff --git a/plugins/jfrog-artifactory/README.md b/plugins/jfrog-artifactory/README.md index 8b2ee6d514..e60dc044b0 100644 --- a/plugins/jfrog-artifactory/README.md +++ b/plugins/jfrog-artifactory/README.md @@ -18,12 +18,13 @@ The Jfrog Artifactory plugin displays information about your container images wi ```yaml title="app-config.yaml" proxy: - '/jfrog-artifactory/api': - target: 'http://:8082' # or https://.jfrog.io - headers: - # Authorization: 'Bearer ' - # Change to "false" in case of using self hosted artifactory instance with a self-signed certificate - secure: true + endpoints: + '/jfrog-artifactory/api': + target: 'http://:8082' # or https://.jfrog.io + headers: + # Authorization: 'Bearer ' + # Change to "false" in case of using self hosted artifactory instance with a self-signed certificate + secure: true ``` 1. Enable the **JFROG ARTIFACTORY** tab on the entity view page in `packages/app/src/components/catalog/EntityPage.tsx`: diff --git a/plugins/jfrog-artifactory/app-config.janus-idp.yaml b/plugins/jfrog-artifactory/app-config.janus-idp.yaml new file mode 100644 index 0000000000..1827f3cc1b --- /dev/null +++ b/plugins/jfrog-artifactory/app-config.janus-idp.yaml @@ -0,0 +1,21 @@ +proxy: + endpoints: + '/jfrog-artifactory/api': + target: ${ARTIFACTORY_URL} + headers: + Authorization: Bearer ${ARTIFACTORY_TOKEN} + # Change to "false" in case of using self hosted artifactory instance with a self-signed certificate + secure: true + +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-jfrog-artifactory: + mountPoints: + - mountPoint: entity.page.image-registry/cards + importName: JfrogArtifactoryPage + config: + layout: + gridColumn: 1 / -1 + if: + anyOf: + - isJfrogArtifactoryAvailable diff --git a/plugins/jfrog-artifactory/package.json b/plugins/jfrog-artifactory/package.json index ef8069b149..85200da2d0 100644 --- a/plugins/jfrog-artifactory/package.json +++ b/plugins/jfrog-artifactory/package.json @@ -57,7 +57,8 @@ "files": [ "dist", "dist-scalprum", - "config.d.ts" + "config.d.ts", + "app-config.janus-idp.yaml" ], "configSchema": "config.d.ts", "repository": "github:janus-idp/backstage-plugins", diff --git a/plugins/matomo-backend/README.md b/plugins/matomo-backend/README.md index 7ec30bff7d..7715e941d2 100644 --- a/plugins/matomo-backend/README.md +++ b/plugins/matomo-backend/README.md @@ -49,7 +49,7 @@ async function main() { 4. Now you need to add in app-config.yaml file -``` +```yaml matomo: apiToken: ${MATOMO_API_TOKEN} apiUrl: ${MATOMO_API_URL} diff --git a/plugins/matomo-backend/app-config.janus-idp.yaml b/plugins/matomo-backend/app-config.janus-idp.yaml new file mode 100644 index 0000000000..819af1e1c8 --- /dev/null +++ b/plugins/matomo-backend/app-config.janus-idp.yaml @@ -0,0 +1,3 @@ +matomo: + apiToken: ${MATOMO_API_TOKEN} + apiUrl: ${MATOMO_API_URL} diff --git a/plugins/matomo/app-config.janus-idp.yaml b/plugins/matomo/app-config.janus-idp.yaml new file mode 100644 index 0000000000..1a0a3153fa --- /dev/null +++ b/plugins/matomo/app-config.janus-idp.yaml @@ -0,0 +1,3 @@ +matomo: + frontendBaseUrl: ${MATOMO_INSTANCE_URL} + contactUsLink: mailto:${MATOMO_CONTACT_EMAIL} diff --git a/plugins/matomo/package.json b/plugins/matomo/package.json index dbddda0ba3..3fa75724a2 100644 --- a/plugins/matomo/package.json +++ b/plugins/matomo/package.json @@ -58,7 +58,8 @@ "files": [ "dist", "dist-scalprum", - "config.d.ts" + "config.d.ts", + "app-config.janus-idp.yaml" ], "repository": "github:janus-idp/backstage-plugins", "keywords": [ diff --git a/plugins/nexus-repository-manager/README.md b/plugins/nexus-repository-manager/README.md index 61201ca43c..4eff59da36 100644 --- a/plugins/nexus-repository-manager/README.md +++ b/plugins/nexus-repository-manager/README.md @@ -16,15 +16,16 @@ The Nexus Repository Manager plugin displays the information about your build ar ```yaml title="app-config.yaml" proxy: - '/nexus-repository-manager': - target: 'https://' - headers: - X-Requested-With: 'XMLHttpRequest' - # Uncomment the following line to access a private Nexus Repository Manager using a token - # Authorization: 'Bearer ' - changeOrigin: true - # Change to "false" in case of using self hosted Nexus Repository Manager instance with a self-signed certificate - secure: true + endpoints: + '/nexus-repository-manager': + target: 'https://' + headers: + X-Requested-With: 'XMLHttpRequest' + # Uncomment the following line to access a private Nexus Repository Manager using a token + # Authorization: 'Bearer ' + changeOrigin: true + # Change to "false" in case of using self hosted Nexus Repository Manager instance with a self-signed certificate + secure: true ``` 1. Optional: Change the base URL of Nexus Repository Manager proxy as follows: diff --git a/plugins/nexus-repository-manager/app-config.janus-idp.yaml b/plugins/nexus-repository-manager/app-config.janus-idp.yaml new file mode 100644 index 0000000000..a1ba24b03b --- /dev/null +++ b/plugins/nexus-repository-manager/app-config.janus-idp.yaml @@ -0,0 +1,27 @@ +proxy: + endpoints: + '/nexus-repository-manager': + target: ${NEXUS_REPOSITORY_MANAGER_URL} + headers: + X-Requested-With: 'XMLHttpRequest' + # Uncomment the following line to access a private Nexus Repository Manager using a token + # Authorization: 'Bearer ' + changeOrigin: true + # Change to "false" in case of using self hosted Nexus Repository Manager instance with a self-signed certificate + secure: true + +nexusRepositoryManager: + experimentalAnnotations: true + +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-nexus-repository-manager: + mountPoints: + - mountPoint: entity.page.image-registry/cards + importName: NexusRepositoryManagerPage + config: + layout: + gridColumn: 1 / -1 + if: + anyOf: + - isNexusRepositoryManagerAvailable diff --git a/plugins/nexus-repository-manager/package.json b/plugins/nexus-repository-manager/package.json index 6db2de050d..9fe18dae23 100644 --- a/plugins/nexus-repository-manager/package.json +++ b/plugins/nexus-repository-manager/package.json @@ -61,7 +61,8 @@ "files": [ "dist", "dist-scalprum", - "config.d.ts" + "config.d.ts", + "app-config.janus-idp.yaml" ], "configSchema": "config.d.ts", "repository": "github:janus-idp/backstage-plugins", diff --git a/plugins/ocm-backend/app-config.janus-idp.yaml b/plugins/ocm-backend/app-config.janus-idp.yaml index 8f3589f0c9..b01750601a 100644 --- a/plugins/ocm-backend/app-config.janus-idp.yaml +++ b/plugins/ocm-backend/app-config.janus-idp.yaml @@ -1,5 +1,3 @@ -enabled: - ocm: true catalog: providers: ocm: diff --git a/plugins/ocm/app-config.janus-idp.yaml b/plugins/ocm/app-config.janus-idp.yaml new file mode 100644 index 0000000000..9d0c5e26e4 --- /dev/null +++ b/plugins/ocm/app-config.janus-idp.yaml @@ -0,0 +1,39 @@ +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-ocm: + appIcons: + - name: ocmIcon + importName: OcmIcon + dynamicRoutes: + - path: /ocm + importName: OcmPage + menuItem: + icon: ocmIcon + text: Clusters + mountPoints: + - mountPoint: entity.page.overview/context + importName: ClusterContextProvider + - mountPoint: entity.page.overview/cards + importName: ClusterAvailableResourceCard + config: + layout: + gridColumnEnd: + lg: 'span 4' + md: 'span 6' + xs: 'span 12' + if: + allOf: + - isKind: resource + - isType: kubernetes-cluster + - mountPoint: entity.page.overview/cards + importName: ClusterInfoCard + config: + layout: + gridColumnEnd: + lg: 'span 4' + md: 'span 6' + xs: 'span 12' + if: + allOf: + - isKind: resource + - isType: kubernetes-cluster diff --git a/plugins/ocm/package.json b/plugins/ocm/package.json index 4bc3909090..70a3c31e83 100644 --- a/plugins/ocm/package.json +++ b/plugins/ocm/package.json @@ -62,7 +62,8 @@ }, "files": [ "dist", - "dist-scalprum" + "dist-scalprum", + "app-config.janus-idp.yaml" ], "repository": "github:janus-idp/backstage-plugins", "keywords": [ diff --git a/plugins/openshift-image-registry/README.md b/plugins/openshift-image-registry/README.md index 775c5af4f0..bf1dabf449 100644 --- a/plugins/openshift-image-registry/README.md +++ b/plugins/openshift-image-registry/README.md @@ -18,14 +18,15 @@ yarn workspace app add @janus-idp/backstage-plugin-openshift-image-registry ```yaml title="app-config.yaml" proxy: - '/openshift-image-registry/api': - target: - headers: - X-Requested-With: 'XMLHttpRequest' - Authorization: Bearer - changeOrigin: true - # Change to "false" in case of using self hosted OpenShift cluster with a self-signed certificate - secure: true + endpoints: + '/openshift-image-registry/api': + target: + headers: + X-Requested-With: 'XMLHttpRequest' + Authorization: Bearer + changeOrigin: true + # Change to "false" in case of using self hosted OpenShift cluster with a self-signed certificate + secure: true ``` 2. Enable an additional sidebar-item on the app sidebar in the `packages/app/src/components/Root/Root.tsx` file: diff --git a/plugins/openshift-image-registry/app-config.janus-idp.yaml b/plugins/openshift-image-registry/app-config.janus-idp.yaml new file mode 100644 index 0000000000..096dd51fba --- /dev/null +++ b/plugins/openshift-image-registry/app-config.janus-idp.yaml @@ -0,0 +1,20 @@ +proxy: + endpoints: + '/openshift-image-registry/api': + target: ${OCP_API_ENDPOINT} + headers: + X-Requested-With: 'XMLHttpRequest' + Authorization: Bearer ${OCP_API_TOKEN} + changeOrigin: true + # Change to "false" in case of using self hosted OpenShift cluster with a self-signed certificate + secure: true + +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-acr: + dynamicRoutes: + - path: /openshift-image-registry + importName: OpenshiftImageRegistryPage + menuItem: + icon: dashboard + text: Image Registry diff --git a/plugins/openshift-image-registry/package.json b/plugins/openshift-image-registry/package.json index 53c3b277df..1bab95a70e 100644 --- a/plugins/openshift-image-registry/package.json +++ b/plugins/openshift-image-registry/package.json @@ -55,7 +55,8 @@ "files": [ "dist", "dist-scalprum", - "config.d.ts" + "config.d.ts", + "app-config.janus-idp.yaml" ], "configSchema": "config.d.ts" } diff --git a/plugins/quay/app-config.janus-idp.yaml b/plugins/quay/app-config.janus-idp.yaml new file mode 100644 index 0000000000..dd8495870d --- /dev/null +++ b/plugins/quay/app-config.janus-idp.yaml @@ -0,0 +1,12 @@ +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-quay: + mountPoints: + - mountPoint: entity.page.image-registry/cards + importName: QuayPage + config: + layout: + gridColumn: 1 / -1 + if: + anyOf: + - isQuayAvailable diff --git a/plugins/tekton/README.md b/plugins/tekton/README.md index 58be136277..5846c3127b 100644 --- a/plugins/tekton/README.md +++ b/plugins/tekton/README.md @@ -123,10 +123,13 @@ The Tekton plugin enables you to visualize the `PipelineRun` resources available ```tsx title="packages/app/src/components/catalog/EntityPage.tsx" /* highlight-add-next-line */ - import { TektonCI, isTektonCIAvailable } from '@janus-idp/backstage-plugin-tekton'; + import { + isTektonCIAvailable, + TektonCI, + } from '@janus-idp/backstage-plugin-tekton'; const cicdContent = ( - > + {/* ... */} {/* highlight-add-start */} diff --git a/plugins/tekton/app-config.janus-idp.yaml b/plugins/tekton/app-config.janus-idp.yaml new file mode 100644 index 0000000000..65affeda61 --- /dev/null +++ b/plugins/tekton/app-config.janus-idp.yaml @@ -0,0 +1,12 @@ +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-tekton: + mountPoints: + - mountPoint: entity.page.ci/cards + importName: TektonCI + config: + layout: + gridColumn: '1 / -1' + if: + allOf: + - isTektonCIAvailable diff --git a/plugins/tekton/package.json b/plugins/tekton/package.json index e3a6dcc46c..f40ea2f26e 100644 --- a/plugins/tekton/package.json +++ b/plugins/tekton/package.json @@ -71,7 +71,8 @@ }, "files": [ "dist", - "dist-scalprum" + "dist-scalprum", + "app-config.janus-idp.yaml" ], "repository": "github:janus-idp/backstage-plugins", "keywords": [ diff --git a/plugins/topology/app-config.janus-idp.yaml b/plugins/topology/app-config.janus-idp.yaml new file mode 100644 index 0000000000..1e83dd855e --- /dev/null +++ b/plugins/topology/app-config.janus-idp.yaml @@ -0,0 +1,14 @@ +dynamicPlugins: + frontend: + janus-idp.backstage-plugin-topology: + mountPoints: + - mountPoint: entity.page.topology/cards + importName: TopologyPage + config: + layout: + gridColumn: '1 / -1' + height: 75vh + if: + anyOf: + - hasAnnotation: backstage.io/kubernetes-id + - hasAnnotation: backstage.io/kubernetes-namespace diff --git a/plugins/topology/package.json b/plugins/topology/package.json index 11a5e733d8..3eda3fba6f 100644 --- a/plugins/topology/package.json +++ b/plugins/topology/package.json @@ -76,7 +76,8 @@ }, "files": [ "dist", - "dist-scalprum" + "dist-scalprum", + "app-config.janus-idp.yaml" ], "repository": "github:janus-idp/backstage-plugins", "keywords": [