]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SQSCANNER-60 Upgrade embedded JRE to 11 4.0.0.1744
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 25 Jun 2019 14:33:56 +0000 (16:33 +0200)
committerGitHub <noreply@github.com>
Tue, 25 Jun 2019 14:33:56 +0000 (16:33 +0200)
Move QA to use Jenkinsfile

Jenkinsfile [new file with mode: 0644]
it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java
pom.xml

diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644 (file)
index 0000000..a01e687
--- /dev/null
@@ -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
index fa147ac5a5d12237db29979fee510fdca2a1111e..f003df28bb8e9ceb9bddd794be96b0f4edf8e259 100644 (file)
@@ -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");
   }
 
 }
diff --git a/pom.xml b/pom.xml
index ce6802e54ffbada3791ec85c4a5bfdb6a4659658..ce5b040b51c12cf42f88bfe36ca5b5aa580118f8 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <!-- 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>
       <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>
       <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>
         </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>