From 1c223a3e31b378ba16dff454182c40941c08af3c Mon Sep 17 00:00:00 2001 From: Dion Date: Fri, 21 Jul 2023 16:31:00 +0200 Subject: [PATCH] sonarqube changes --- .../docs/developer-guide/azure-devops/readme.md | 2 +- starsky/build/helpers/SonarQube.cs | 16 ++++++++-------- starsky/readme.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/documentation/docs/developer-guide/azure-devops/readme.md b/documentation/docs/developer-guide/azure-devops/readme.md index d5f50f54bd..4fec3e24e3 100644 --- a/documentation/docs/developer-guide/azure-devops/readme.md +++ b/documentation/docs/developer-guide/azure-devops/readme.md @@ -28,7 +28,7 @@ So **no** desktop application is build. This is referenced by: `pipelines/azure/ The following variables are used: - `$(STARSKY_SONAR_KEY)` - project key for sonarcloud -- `$(STARSKY_SONAR_LOGIN)` - login key for sonarcloud +- `$(STARSKY_SONAR_TOKEN)` - login key for sonarcloud - `$(STARSKY_SONAR_ORGANISATION)` - organisation in sonarcloud ### azure-pipelines-starsky-shared-web-only diff --git a/starsky/build/helpers/SonarQube.cs b/starsky/build/helpers/SonarQube.cs index 5913eb4797..fe9bbf5934 100644 --- a/starsky/build/helpers/SonarQube.cs +++ b/starsky/build/helpers/SonarQube.cs @@ -86,7 +86,7 @@ private static void IsJavaInstalled() public static bool SonarBegin(bool noUnitTest, bool noSonar, string branchName, string clientAppProject, string coverageFile) { var key = EnvironmentVariable("STARSKY_SONAR_KEY"); - var login = EnvironmentVariable("STARSKY_SONAR_LOGIN"); + var sonarToken = EnvironmentVariable("STARSKY_SONAR_TOKEN"); var organisation = EnvironmentVariable("STARSKY_SONAR_ORGANISATION"); var url = EnvironmentVariable("STARSKY_SONAR_URL"); @@ -94,8 +94,8 @@ public static bool SonarBegin(bool noUnitTest, bool noSonar, string branchName, url = "https://sonarcloud.io"; } - if( string.IsNullOrEmpty(key) || string.IsNullOrEmpty(login) || string.IsNullOrEmpty(organisation) ) { - Information($">> SonarQube is disabled $ key={key}|login={login}|organisation={organisation}"); + if( string.IsNullOrEmpty(key) || string.IsNullOrEmpty(sonarToken) || string.IsNullOrEmpty(organisation) ) { + Information($">> SonarQube is disabled $ key={key}|login={sonarToken}|organisation={organisation}"); return false; } @@ -152,7 +152,7 @@ public static bool SonarBegin(bool noUnitTest, bool noSonar, string branchName, .Append($"/d:sonar.host.url=\"{url}\" ") .Append($"/k:\"{key}\" ") .Append($"/n:\"Starsky\" ") - .Append($"/d:sonar.login=\"{login}\" ") + .Append($"/d:sonar.token=\"{sonarToken}\" ") .Append($"/o:" + organisation +" ") .Append($"/d:sonar.typescript.tsconfigPath={tsconfig} ") .Append($"/d:sonar.coverageReportPaths={sonarQubeCoverageFile} ") @@ -200,9 +200,9 @@ public static bool SonarBegin(bool noUnitTest, bool noSonar, string branchName, public static void SonarEnd(bool noUnitTest, bool noSonar) { - var login = EnvironmentVariable("STARSKY_SONAR_LOGIN"); - if( string.IsNullOrEmpty(login) ) { - Information($">> SonarQube is disabled $ login={login}"); + var sonarToken = EnvironmentVariable("STARSKY_SONAR_TOKEN"); + if( string.IsNullOrEmpty(sonarToken) ) { + Information($">> SonarQube is disabled $ login={sonarToken}"); return; } @@ -219,7 +219,7 @@ public static void SonarEnd(bool noUnitTest, bool noSonar) var sonarArguments = new StringBuilder() .Append($"sonarscanner ") .Append($"end ") - .Append($"/d:sonar.login=\"{login}\" "); + .Append($"/d:sonar.token=\"{sonarToken}\" "); DotNet(sonarArguments.ToString()); diff --git a/starsky/readme.md b/starsky/readme.md index 60b8cadc80..8bc39ee67f 100644 --- a/starsky/readme.md +++ b/starsky/readme.md @@ -159,7 +159,7 @@ For SonarScanner you need to additionally install: To enable SonarScanner you need to set the following environment variables: - `STARSKY_SONAR_KEY` - the public name of the project -- `STARSKY_SONAR_LOGIN` - the token to login +- `STARSKY_SONAR_TOKEN` - the token to login - `STARSKY_SONAR_ORGANISATION` - the name of the organisation - `STARSKY_SONAR_URL` - defaults to sonarcloud.io