From 0bb0b19b0da28492bc9596c97ef504c14d3edbd2 Mon Sep 17 00:00:00 2001 From: David Weber Date: Wed, 17 May 2023 20:32:09 +0200 Subject: [PATCH] fix: provide full schema definition for sonarqube plugin Signed-off-by: David Weber --- .changeset/few-pugs-jam.md | 5 +++ plugins/sonarqube-backend/config.d.ts | 56 ++++++++++++++++++++++++++ plugins/sonarqube-backend/package.json | 6 ++- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 .changeset/few-pugs-jam.md create mode 100644 plugins/sonarqube-backend/config.d.ts diff --git a/.changeset/few-pugs-jam.md b/.changeset/few-pugs-jam.md new file mode 100644 index 0000000000..83908a2cc1 --- /dev/null +++ b/.changeset/few-pugs-jam.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-sonarqube-backend': patch +--- + +Provide full schema definition for sonarqube plugin, especially to protect api keys. diff --git a/plugins/sonarqube-backend/config.d.ts b/plugins/sonarqube-backend/config.d.ts new file mode 100644 index 0000000000..9e612b6984 --- /dev/null +++ b/plugins/sonarqube-backend/config.d.ts @@ -0,0 +1,56 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface Config { + /** Optional configurations for the SonarQube plugin */ + sonarQube?: { + /** + * The base url of the sonarqube installation. Defaults to https://sonarcloud.io. + * @visibility frontend + */ + baseUrl: string; + + /** + * The api key to access the sonarqube instance under baseUrl. + * @visibility secret + */ + apiKey: string; + + /** + * The optional sonarqube instances. + * @visibility frontend + */ + instances?: Array<{ + /** + * The name of the sonarqube instance. + * @visibility frontend + */ + name: string; + + /** + * The base url of the sonarqube instance. + * @visibility frontend + */ + baseUrl: string; + + /** + * The api key to access the sonarqube instance. + * @visibility secret + */ + apiKey: string; + }>; + }; +} diff --git a/plugins/sonarqube-backend/package.json b/plugins/sonarqube-backend/package.json index 28b61aa1be..5db81a09fd 100644 --- a/plugins/sonarqube-backend/package.json +++ b/plugins/sonarqube-backend/package.json @@ -40,6 +40,8 @@ "supertest": "^6.2.4" }, "files": [ - "dist" - ] + "dist", + "config.d.ts" + ], + "configSchema": "config.d.ts" }