Skip to content

Commit

Permalink
Fix authentication issue in QA
Browse files Browse the repository at this point in the history
With the latest scanner, thr SONAR_TOKEN env variable has higher priority than sonar.login/sonar.password
  • Loading branch information
henryju committed Dec 3, 2024
1 parent f42a6ef commit 827a7da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 827a7da

Please sign in to comment.