diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2019-06-25 16:33:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-25 16:33:56 +0200 |
commit | 23615069db2863f45dba4b9df50b30cf6fb7b792 (patch) | |
tree | 38470e3866b2cc78797c7d98bf15502d22809a8f | |
parent | ec4642444b5902a4aeb5c8b509e1f4060d54cfe4 (diff) | |
download | sonar-scanner-cli-23615069db2863f45dba4b9df50b30cf6fb7b792.tar.gz sonar-scanner-cli-23615069db2863f45dba4b9df50b30cf6fb7b792.zip |
SQSCANNER-60 Upgrade embedded JRE to 114.0.0.1744
Move QA to use Jenkinsfile
-rw-r--r-- | Jenkinsfile | 136 | ||||
-rw-r--r-- | it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java | 17 | ||||
-rw-r--r-- | pom.xml | 80 |
3 files changed, 169 insertions, 64 deletions
diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..a01e687 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,136 @@ +@Library('SonarSource@2.2') _ +pipeline { + agent { + label 'linux' + } + parameters { + string(name: 'GIT_SHA1', description: 'Git SHA1 (provided by travisci hook job)') + string(name: 'CI_BUILD_NAME', defaultValue: 'sonar-scanner-cli', description: 'Build Name (provided by travisci hook job)') + string(name: 'CI_BUILD_NUMBER', description: 'Build Number (provided by travisci hook job)') + string(name: 'GITHUB_BRANCH', defaultValue: 'master', description: 'Git branch (provided by travisci hook job)') + string(name: 'GITHUB_REPOSITORY_OWNER', defaultValue: 'SonarSource', description: 'Github repository owner(provided by travisci hook job)') + } + environment { + SONARSOURCE_QA = 'true' + MAVEN_TOOL = 'Maven 3.6.x' + JDK_VERSION = 'Java 11' + } + stages { + stage('Notify') { + steps { + sendAllNotificationQaStarted() + } + } + stage('QA') { + parallel { + stage('DOGFOOD/linux') { + agent { + label 'linux' + } + steps { + runITs("DOGFOOD") + } + } + stage('LATEST_RELEASE[6.7]/linux') { + agent { + label 'linux' + } + environment { + JDK_VERSION = 'Java 8' + } + steps { + runITs("LATEST_RELEASE[6.7]") + } + } + stage('LATEST_RELEASE/linux') { + agent { + label 'linux' + } + steps { + runITs("LATEST_RELEASE") + } + } + + stage('DOGFOOD/windows') { + agent { + label 'windows' + } + steps { + runITs("DOGFOOD") + } + } + stage('LATEST_RELEASE[6.7]/windows') { + agent { + label 'windows' + } + environment { + JDK_VERSION = 'Java 8' + } + steps { + runITs("LATEST_RELEASE[6.7]") + } + } + stage('LATEST_RELEASE/windows') { + agent { + label 'windows' + } + steps { + runITs("LATEST_RELEASE") + } + } + + stage('DOGFOOD/macosx') { + agent { + label 'macosx' + } + steps { + runITs("DOGFOOD") + } + } + stage('LATEST_RELEASE[6.7]/macosx') { + agent { + label 'macosx' + } + environment { + JDK_VERSION = 'Java 8' + } + steps { + runITs("LATEST_RELEASE[6.7]") + } + } + stage('LATEST_RELEASE/macosx') { + agent { + label 'macosx' + } + steps { + runITs("LATEST_RELEASE") + } + } + } + post { + always { + sendAllNotificationQaResult() + } + } + + } + stage('Promote') { + steps { + repoxPromoteBuild() + } + post { + always { + sendAllNotificationPromote() + } + } + } + } +} + +def runITs(SQ_VERSION) { + withMaven(maven: MAVEN_TOOL) { + dir("it") { + runMavenOrch(JDK_VERSION,"verify -Dsonar.runtimeVersion=$SQ_VERSION -U") + } + } +}
\ No newline at end of file diff --git a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java index fa147ac..f003df2 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java +++ b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java @@ -25,7 +25,6 @@ import java.io.File; import java.io.IOException; import java.util.Map; import java.util.stream.Collectors; -import org.assertj.core.api.Condition; import org.junit.After; import org.junit.Rule; import org.junit.Test; @@ -188,19 +187,15 @@ public class ScannerTest extends ScannerTestCase { } @Test - public void verify_env_variable() { + public void verify_scanner_opts_env_variable_passed_as_jvm_argument() { SonarScanner build = newScanner(new File("projects/simple-sample")) - .setEnvironmentVariable("SONAR_SCANNER_OPTS", "-Xmx2m"); + .setEnvironmentVariable("SONAR_SCANNER_OPTS", "-Xmx1k"); BuildResult executeBuild = orchestrator.executeBuildQuietly(build); - assertThat(executeBuild.getStatus()).isNotEqualTo(0); + assertThat(executeBuild.getLastStatus()).isNotEqualTo(0); String logs = executeBuild.getLogs(); - assertThat(logs).is(new Condition<String>("Contain error message about OOM") { - @Override - public boolean matches(String value) { - return value.contains("java.lang.OutOfMemoryError") - || value.contains("GC overhead limit exceeded") || value.contains("Java heap space"); - } - }); + assertThat(logs).contains("Error occurred during initialization of VM"); + // Not the same message with JRE 8 and 11 + assertThat(logs).containsPattern("Too small (initial|maximum) heap"); } } @@ -48,10 +48,9 @@ <!-- configuration for assembly of distributions --> <unpack.dir>${project.build.directory}/unpack</unpack.dir> <scanner.jar>${project.build.finalName}.jar</scanner.jar> - <jre.version>8u202</jre.version> - <jre.dirname.linux>jre1.8.0_202</jre.dirname.linux> - <jre.dirname.windows>jre1.8.0_202</jre.dirname.windows> - <jre.dirname.macosx>jre1.8.0_202.jre/Contents/Home</jre.dirname.macosx> + <jre.dirname.linux>jdk-11.0.3+7-jre</jre.dirname.linux> + <jre.dirname.windows>jdk-11.0.3+7-jre</jre.dirname.windows> + <jre.dirname.macosx>jdk-11.0.3+7-jre/Contents/Home</jre.dirname.macosx> <!-- Release: enable publication to Bintray --> <artifactsToPublish>${project.groupId}:${project.artifactId}:zip,${project.groupId}:${project.artifactId}:zip:linux,${project.groupId}:${project.artifactId}:zip:windows,${project.groupId}:${project.artifactId}:zip:macosx</artifactsToPublish> @@ -207,33 +206,25 @@ <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>3.0.0</version> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <version>1.4.2</version> <executions> <execution> <id>unpack-linux</id> <phase>package</phase> <goals> - <goal>unpack</goal> + <goal>wget</goal> </goals> <configuration> - <artifactItems> - <artifactItem> - <groupId>com.oracle</groupId> - <artifactId>jre</artifactId> - <version>${jre.version}</version> - <classifier>linux-x64</classifier> - <type>tar.gz</type> - <overWrite>true</overWrite> - </artifactItem> - </artifactItems> + <url>https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_linux_hotspot_11.0.3_7.tar.gz</url> + <unpack>true</unpack> <outputDirectory>${unpack.dir}/linux</outputDirectory> + <sha512>b7232a3c75a8c4e67f51bd95c8441026b2bfef29cc779768a5f2d300208dc569d672402e06a2d6c6f512450723bc0631c5a18cde80cbc1ec2028c123607df30f</sha512> </configuration> </execution> </executions> </plugin> - <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> @@ -265,33 +256,25 @@ <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>3.0.0</version> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <version>1.4.2</version> <executions> <execution> <id>unpack-windows</id> <phase>package</phase> <goals> - <goal>unpack</goal> + <goal>wget</goal> </goals> <configuration> - <artifactItems> - <artifactItem> - <groupId>com.oracle</groupId> - <artifactId>jre</artifactId> - <version>${jre.version}</version> - <classifier>windows-x64</classifier> - <type>tar.gz</type> - <overWrite>true</overWrite> - </artifactItem> - </artifactItems> + <url>https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_windows_hotspot_11.0.3_7.zip</url> + <unpack>true</unpack> <outputDirectory>${unpack.dir}/windows</outputDirectory> + <sha512>370100688282a5c43fe0ac736980eeff64cf212a0fb573181fff8039c121097cbbbd540a652cc6d17397789b894c820b802b875bbd1743eb2b8469009d5fa8f9</sha512> </configuration> </execution> </executions> </plugin> - <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> @@ -317,39 +300,30 @@ </plugins> </build> </profile> - <profile> <id>dist-macosx</id> <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>3.0.0</version> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <version>1.4.2</version> <executions> <execution> <id>unpack-macosx</id> <phase>package</phase> <goals> - <goal>unpack</goal> + <goal>wget</goal> </goals> + <configuration> + <url>https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jre_x64_mac_hotspot_11.0.3_7.tar.gz</url> + <unpack>true</unpack> + <outputDirectory>${unpack.dir}/macosx</outputDirectory> + <sha512>5995c18fa0f2ef9d74c9fb38401d497b16e78b57eaf5b795f19724a8c1f6609add96355627b8cb0564d29421a63d830df11f932b76436a713a535a1253e745e6</sha512> + </configuration> </execution> </executions> - <configuration> - <artifactItems> - <artifactItem> - <groupId>com.oracle</groupId> - <artifactId>jre</artifactId> - <version>${jre.version}</version> - <classifier>macosx-x64</classifier> - <type>tar.gz</type> - <overWrite>true</overWrite> - </artifactItem> - </artifactItems> - <outputDirectory>${unpack.dir}/macosx</outputDirectory> - </configuration> </plugin> - <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> |