Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE - MMF-3636 POC #168

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .cirrus.yml
Expand Up @@ -14,7 +14,7 @@
ARTIFACTORY_DEPLOY_PASSWORD: VAULT[development/artifactory/token/SonarSource-sonar-scanner-cli-qa-deployer access_token]
ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa
ARTIFACTORY_PROMOTE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]

BURGR_URL: VAULT[development/kv/data/burgr data.url]
BURGR_USERNAME: VAULT[development/kv/data/burgr data.cirrus_username]
BURGR_PASSWORD: VAULT[development/kv/data/burgr data.cirrus_password]
Expand Down Expand Up @@ -76,7 +76,7 @@
env:
matrix:
- SQ_VERSION: LATEST_RELEASE[9.9]
- SQ_VERSION: DEV
# - SQ_VERSION: DEV
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
qa_script:
Expand All @@ -102,7 +102,7 @@
CIRRUS_SHELL: bash
matrix:
- SQ_VERSION: LATEST_RELEASE[9.9]
- SQ_VERSION: DEV
# - SQ_VERSION: DEV
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
qa_script:
Expand All @@ -113,7 +113,7 @@
cleanup_before_cache_script:
- cleanup_maven_repository

promote_task:

Check warning on line 116 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L116

task "promote" depends on task "linux_qa_java17", but their only_if conditions are different

Check warning on line 116 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L116

task "promote" depends on task "win_qa_java17", but their only_if conditions are different

Check warning on line 116 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L116

task "promote" depends on task "linux_qa_java17", but their only_if conditions are different

Check warning on line 116 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L116

task "promote" depends on task "win_qa_java17", but their only_if conditions are different
depends_on:
- linux_qa_java17
- win_qa_java17
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Expand Up @@ -64,9 +64,9 @@

<dependencies>
<dependency>
<groupId>org.sonarsource.scanner.api</groupId>
<artifactId>sonar-scanner-api</artifactId>
<version>2.16.3.1081</version>
<groupId>org.sonarsource.scanner.commons</groupId>
<artifactId>sonar-scanner-commons</artifactId>
<version>2.17.0.1464</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down Expand Up @@ -179,8 +179,8 @@
<configuration>
<rules>
<requireFilesSize>
<minsize>560000</minsize>
<maxsize>600000</maxsize>
<minsize>1300000</minsize>
<maxsize>1370000</maxsize>
<files>
<file>${project.build.directory}/sonar-scanner-${project.version}.zip</file>
</files>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/sonarsource/scanner/cli/Conf.java
Expand Up @@ -43,6 +43,7 @@ class Conf {
private static final String PROPERTY_PROJECT_CONFIG_FILE = "sonar.projectConfigFile";
private static final String SONAR_PROJECT_PROPERTIES_FILENAME = "sonar-project.properties";
static final String PROPERTY_SONAR_HOST_URL = "sonar.host.url";
static final String PROPERTY_SONARCLOUD_URL = "sonar.scanner.sonarcloud.url";

private final Cli cli;
private final Logs logger;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/sonarsource/scanner/cli/Main.java
Expand Up @@ -90,12 +90,14 @@ void execute() {
}

static boolean isSonarCloud(Properties props) {
if (props.containsKey(Conf.PROPERTY_SONARCLOUD_URL)) {
return true;
}
String hostUrl = props.getProperty(Conf.PROPERTY_SONAR_HOST_URL);
if (hostUrl != null) {
return hostUrl.toLowerCase(Locale.ENGLISH).contains("sonarcloud");
}

return false;
return true;
}

private void checkSkip(Properties properties) {
Expand Down
9 changes: 4 additions & 5 deletions src/test/java/org/sonarsource/scanner/cli/ConfTest.java
Expand Up @@ -19,6 +19,7 @@
*/
package org.sonarsource.scanner.cli;

import com.google.gson.JsonObject;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
Expand All @@ -33,7 +34,6 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.sonarsource.scanner.api.internal.shaded.minimaljson.Json;
ericg138 marked this conversation as resolved.
Show resolved Hide resolved

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
Expand Down Expand Up @@ -327,11 +327,10 @@ public void should_load_project_settings_using_env() throws Exception {
Properties properties = conf.properties();
assertThat(properties.get("sonar.prop")).isEqualTo("default");

String jsonString = Json.object()
.add("project.settings", home.resolve("conf/sq-project.properties").toAbsolutePath().toString())
.toString();
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("project.settings", home.resolve("conf/sq-project.properties").toAbsolutePath().toString());

env.put("SONARQUBE_SCANNER_PARAMS", jsonString);
env.put("SONARQUBE_SCANNER_PARAMS", jsonObject.toString());

properties = conf.properties();
assertThat(properties.get("sonar.prop")).isEqualTo("expected");
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/org/sonarsource/scanner/cli/MainTest.java
Expand Up @@ -241,6 +241,7 @@ public void should_skip() {
public void shouldLogServerVersion() {
when(scanner.serverVersion()).thenReturn("5.5");
Properties p = new Properties();
p.put(Conf.PROPERTY_SONAR_HOST_URL, "http://localhost:9000");
when(cli.isDisplayVersionOnly()).thenReturn(true);
when(cli.getInvokedFrom()).thenReturn("");
when(conf.properties()).thenReturn(p);
Expand Down Expand Up @@ -283,8 +284,8 @@ public void should_return_false_is_sonar_cloud() {

// SQSCANNER-57
@Test
public void should_return_false_is_sonar_cloud_host_is_null() {
assertThat(Main.isSonarCloud(new Properties())).isFalse();
public void should_return_true_is_sonar_cloud_host_is_null() {
assertThat(Main.isSonarCloud(new Properties())).isTrue();
}

@Test
Expand Down