From 827a7dafe1c7229fa759966b1c6fc016d77a37c8 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 2 Dec 2024 10:50:04 +0100 Subject: [PATCH] Fix authentication issue in QA With the latest scanner, thr SONAR_TOKEN env variable has higher priority than sonar.login/sonar.password --- .cirrus.yml | 6 ++++-- .../src/test/java/its/SonarQubeDeveloperEditionTests.java | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c8062a6559..bfc2eea024 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,8 +6,6 @@ env: ARTIFACTORY_PRIVATE_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader ARTIFACTORY_PRIVATE_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token] ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token] - SONAR_HOST_URL: VAULT[development/kv/data/next data.url] - SONAR_TOKEN: VAULT[development/kv/data/next data.token] auto_cancellation: $CIRRUS_BRANCH != $CIRRUS_DEFAULT_BRANCH @@ -77,6 +75,8 @@ build_task: ARTIFACTORY_DEPLOY_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token] SIGN_KEY: VAULT[development/kv/data/sign data.key] PGP_PASSPHRASE: VAULT[development/kv/data/sign data.passphrase] + SONAR_HOST_URL: "not_used_but_needed_by_regular_mvn_build_deploy_analyze" + SONAR_TOKEN: "not_used_but_needed_by_regular_mvn_build_deploy_analyze" eks_container: <<: *CONTAINER_DEFINITION memory: 2G @@ -98,6 +98,8 @@ test_linux_task: env: JDK_VERSION: "17" DEPLOY_PULL_REQUEST: "false" + SONAR_HOST_URL: VAULT[development/kv/data/next data.url] + SONAR_TOKEN: VAULT[development/kv/data/next data.token] <<: *MAVEN_CACHE_DEFINITION script: - source cirrus-env QA diff --git a/its/tests/src/test/java/its/SonarQubeDeveloperEditionTests.java b/its/tests/src/test/java/its/SonarQubeDeveloperEditionTests.java index 955a4eb53f..df379de44b 100644 --- a/its/tests/src/test/java/its/SonarQubeDeveloperEditionTests.java +++ b/its/tests/src/test/java/its/SonarQubeDeveloperEditionTests.java @@ -155,7 +155,6 @@ class SonarQubeDeveloperEditionTests extends AbstractConnectedTests { public static final String CONNECTION_ID = "orchestrator"; public static final String CONNECTION_ID_WRONG_CREDENTIALS = "wrong-credentials"; - private static final String SCANNER_VERSION = "6.0.0.4432"; @RegisterExtension static OrchestratorExtension ORCHESTRATOR = OrchestratorUtils.defaultEnvBuilder() @@ -1396,7 +1395,6 @@ private static void waitForAnalysisToBeReady(String configScopeId) { private void analyzeProject(String projectDirName, String projectKey, String... properties) { var projectDir = Paths.get("projects/" + projectDirName).toAbsolutePath(); ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir.toFile()) - .setScannerVersion(SCANNER_VERSION) .setProjectKey(projectKey) .setSourceDirs("src") .setProperties(properties)