exclude 'commons-logging:commons-logging' | exclude 'commons-logging:commons-logging' | ||||
} | } | ||||
// Be aware that Log4j is used by Elasticsearch client | // Be aware that Log4j is used by Elasticsearch client | ||||
dependencySet(group: 'org.apache.logging.log4j', version: '2.15.0') { | |||||
dependencySet(group: 'org.apache.logging.log4j', version: '2.16.0') { | |||||
entry 'log4j-core' | entry 'log4j-core' | ||||
entry 'log4j-api' | entry 'log4j-api' | ||||
entry 'log4j-to-slf4j' | entry 'log4j-to-slf4j' | ||||
entry 'jetty-server' | entry 'jetty-server' | ||||
entry 'jetty-servlet' | entry 'jetty-servlet' | ||||
} | } | ||||
dependency('org.elasticsearch.client:elasticsearch-rest-high-level-client:7.14.1') { | |||||
dependency('org.elasticsearch.client:elasticsearch-rest-high-level-client:7.16.0') { | |||||
exclude 'org.apache.logging.log4j:log4j-core' | exclude 'org.apache.logging.log4j:log4j-core' | ||||
} | } | ||||
dependency 'org.elasticsearch.plugin:transport-netty4-client:7.14.1' | |||||
dependency 'org.elasticsearch.plugin:transport-netty4-client:7.16.0' | |||||
dependency 'org.elasticsearch:mocksocket:1.0' | dependency 'org.elasticsearch:mocksocket:1.0' | ||||
dependency 'org.codelibs.elasticsearch.module:analysis-common:7.14.1' | |||||
dependency 'org.codelibs.elasticsearch.module:analysis-common:7.16.0' | |||||
dependency 'org.eclipse.jgit:org.eclipse.jgit:5.11.0.202103091610-r' | dependency 'org.eclipse.jgit:org.eclipse.jgit:5.11.0.202103091610-r' | ||||
dependency 'org.tmatesoft.svnkit:svnkit:1.10.1' | dependency 'org.tmatesoft.svnkit:svnkit:1.10.1' | ||||
dependency 'org.hamcrest:hamcrest-all:1.3' | dependency 'org.hamcrest:hamcrest-all:1.3' | ||||
ext.osAdaptiveCommand = { commands -> | ext.osAdaptiveCommand = { commands -> | ||||
def newCommands = [] | def newCommands = [] | ||||
if (System.properties['os.name'].toLowerCase().contains('windows')) { | if (System.properties['os.name'].toLowerCase().contains('windows')) { | ||||
newCommands = ['cmd', '/c'] | newCommands = ['cmd', '/c'] | ||||
} | } |
# https://www.elastic.co/downloads/elasticsearch-no-jdk | # https://www.elastic.co/downloads/elasticsearch-no-jdk | ||||
elasticsearchDownloadUrlPath=https://artifacts.elastic.co/downloads/elasticsearch/ | elasticsearchDownloadUrlPath=https://artifacts.elastic.co/downloads/elasticsearch/ | ||||
elasticsearchDownloadRepoxUrlPath=https://repox.jfrog.io/artifactory/sonarsource-bucket/sonarqube/elasticsearch/ | elasticsearchDownloadRepoxUrlPath=https://repox.jfrog.io/artifactory/sonarsource-bucket/sonarqube/elasticsearch/ | ||||
elasticsearchDownloadUrlFile=elasticsearch-7.14.1-no-jdk-linux-x86_64.tar.gz | |||||
elasticsearchDownloadSha512=77dca78ba865ae74863b3b2a3cd61e8a8e4478cd02eb020184dbf89fa32cf145a6bbd1d11a1cb88c2236a3b8cdb8b0047e3c0f1a40f609f31b898c905b2c211d | |||||
elasticsearchDownloadUrlFile=elasticsearch-7.16.1-no-jdk-linux-x86_64.tar.gz | |||||
elasticsearchDownloadSha512=529280741a3fe87df267abfa0fa03e79c24d0403f293f3604ddfddf01980efdc654cbb4586513d8424186298707bfd6fcbd21027d345262d6418e6021a9c4f88 |
import org.sonar.process.Props; | import org.sonar.process.Props; | ||||
import org.sonar.process.System2; | import org.sonar.process.System2; | ||||
import static org.sonar.process.ProcessProperties.parseTimeoutMs; | |||||
import static org.sonar.process.ProcessProperties.Property.CE_GRACEFUL_STOP_TIMEOUT; | import static org.sonar.process.ProcessProperties.Property.CE_GRACEFUL_STOP_TIMEOUT; | ||||
import static org.sonar.process.ProcessProperties.Property.CE_JAVA_ADDITIONAL_OPTS; | import static org.sonar.process.ProcessProperties.Property.CE_JAVA_ADDITIONAL_OPTS; | ||||
import static org.sonar.process.ProcessProperties.Property.CE_JAVA_OPTS; | import static org.sonar.process.ProcessProperties.Property.CE_JAVA_OPTS; | ||||
import static org.sonar.process.ProcessProperties.Property.WEB_GRACEFUL_STOP_TIMEOUT; | import static org.sonar.process.ProcessProperties.Property.WEB_GRACEFUL_STOP_TIMEOUT; | ||||
import static org.sonar.process.ProcessProperties.Property.WEB_JAVA_ADDITIONAL_OPTS; | import static org.sonar.process.ProcessProperties.Property.WEB_JAVA_ADDITIONAL_OPTS; | ||||
import static org.sonar.process.ProcessProperties.Property.WEB_JAVA_OPTS; | import static org.sonar.process.ProcessProperties.Property.WEB_JAVA_OPTS; | ||||
import static org.sonar.process.ProcessProperties.parseTimeoutMs; | |||||
public class CommandFactoryImpl implements CommandFactory { | public class CommandFactoryImpl implements CommandFactory { | ||||
private static final String ENV_VAR_JAVA_TOOL_OPTIONS = "JAVA_TOOL_OPTIONS"; | private static final String ENV_VAR_JAVA_TOOL_OPTIONS = "JAVA_TOOL_OPTIONS"; | ||||
.setEnvVariable("ES_PATH_CONF", esInstallation.getConfDirectory().getAbsolutePath()) | .setEnvVariable("ES_PATH_CONF", esInstallation.getConfDirectory().getAbsolutePath()) | ||||
.setEnvVariable("ES_JVM_OPTIONS", esInstallation.getJvmOptions().getAbsolutePath()) | .setEnvVariable("ES_JVM_OPTIONS", esInstallation.getJvmOptions().getAbsolutePath()) | ||||
.setEnvVariable("ES_JAVA_HOME", System.getProperties().getProperty("java.home")) | .setEnvVariable("ES_JAVA_HOME", System.getProperties().getProperty("java.home")) | ||||
.setEnvVariable("LIBFFI_TMPDIR", this.tempDir.getAbsolutePath()) | |||||
.suppressEnvVariable(ENV_VAR_JAVA_TOOL_OPTIONS) | .suppressEnvVariable(ENV_VAR_JAVA_TOOL_OPTIONS) | ||||
.suppressEnvVariable(ENV_VAR_ES_JAVA_OPTS); | .suppressEnvVariable(ENV_VAR_ES_JAVA_OPTS); | ||||
} | } |
private static Map<String, String> mandatoryOptions(File tmpDir, Props props) { | private static Map<String, String> mandatoryOptions(File tmpDir, Props props) { | ||||
Map<String, String> res = new LinkedHashMap<>(30); | Map<String, String> res = new LinkedHashMap<>(30); | ||||
fromJvmDotOptionsFile(tmpDir, res); | fromJvmDotOptionsFile(tmpDir, res); | ||||
fromSystemJvmOptionsClass(res); | |||||
fromSystemJvmOptionsClass(tmpDir, res); | |||||
if (!props.value("sonar.jdbc.url", "").contains("jdbc:h2") && !props.valueAsBoolean("sonar.es.bootstrap.checks.disable")) { | if (!props.value("sonar.jdbc.url", "").contains("jdbc:h2") && !props.valueAsBoolean("sonar.es.bootstrap.checks.disable")) { | ||||
res.put("-Des.enforce.bootstrap.checks=", "true"); | res.put("-Des.enforce.bootstrap.checks=", "true"); | ||||
/** | /** | ||||
* JVM options from class "org.elasticsearch.tools.launchers.SystemJvmOptions" | * JVM options from class "org.elasticsearch.tools.launchers.SystemJvmOptions" | ||||
*/ | */ | ||||
private static void fromSystemJvmOptionsClass(Map<String, String> res) { | |||||
private static void fromSystemJvmOptionsClass(File tmpDir, Map<String, String> res) { | |||||
/* | /* | ||||
* Cache ttl in seconds for positive DNS lookups noting that this overrides the JDK security property networkaddress.cache.ttl; | * Cache ttl in seconds for positive DNS lookups noting that this overrides the JDK security property networkaddress.cache.ttl; | ||||
* can be set to -1 to cache forever. | * can be set to -1 to cache forever. | ||||
res.put("-Dfile.encoding=", "UTF-8"); | res.put("-Dfile.encoding=", "UTF-8"); | ||||
// use our provided JNA always versus the system one | // use our provided JNA always versus the system one | ||||
res.put("-Djna.nosys=", "true"); | res.put("-Djna.nosys=", "true"); | ||||
res.put("-Djna.tmpdir=", tmpDir.getAbsolutePath()); | |||||
/* | /* | ||||
* Turn off a JDK optimization that throws away stack traces for common exceptions because stack traces are important for | * Turn off a JDK optimization that throws away stack traces for common exceptions because stack traces are important for | ||||
* debugging. | * debugging. |
"-Djava.awt.headless=true", | "-Djava.awt.headless=true", | ||||
"-Dfile.encoding=UTF-8", | "-Dfile.encoding=UTF-8", | ||||
"-Djna.nosys=true", | "-Djna.nosys=true", | ||||
"-Djna.tmpdir=" + tmpDir.getAbsolutePath(), | |||||
"-XX:-OmitStackTraceInFastThrow", | "-XX:-OmitStackTraceInFastThrow", | ||||
"-Dio.netty.noUnsafe=true", | "-Dio.netty.noUnsafe=true", | ||||
"-Dio.netty.noKeySetOptimization=true", | "-Dio.netty.noKeySetOptimization=true", | ||||
"-Djava.awt.headless=true\n" + | "-Djava.awt.headless=true\n" + | ||||
"-Dfile.encoding=UTF-8\n" + | "-Dfile.encoding=UTF-8\n" + | ||||
"-Djna.nosys=true\n" + | "-Djna.nosys=true\n" + | ||||
"-Djna.tmpdir=" + tmpDir.getAbsolutePath() + "\n" + | |||||
"-XX:-OmitStackTraceInFastThrow\n" + | "-XX:-OmitStackTraceInFastThrow\n" + | ||||
"-Dio.netty.noUnsafe=true\n" + | "-Dio.netty.noUnsafe=true\n" + | ||||
"-Dio.netty.noKeySetOptimization=true\n" + | "-Dio.netty.noKeySetOptimization=true\n" + |
+ " ignore_throttled=true], types=[type], routing='null', preference='null', requestCache=null," | + " ignore_throttled=true], types=[type], routing='null', preference='null', requestCache=null," | ||||
+ " scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=null," | + " scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=null," | ||||
+ " allowPartialSearchResults=null, localClusterAlias=null, getOrCreateAbsoluteStartMillis=-1," | + " allowPartialSearchResults=null, localClusterAlias=null, getOrCreateAbsoluteStartMillis=-1," | ||||
+ " ccsMinimizeRoundtrips=true, source={}}' on indices '[index]' on types '[type]'"); | |||||
+ " ccsMinimizeRoundtrips=true, enableFieldsEmulation=false, source={}}' on indices '[index]' on types '[type]'"); | |||||
} | } | ||||
@Test | @Test |
exclude '**/modules/transform/**' | exclude '**/modules/transform/**' | ||||
exclude '**/modules/unsigned-long/**' | exclude '**/modules/unsigned-long/**' | ||||
exclude '**/modules/vectors/**' | exclude '**/modules/vectors/**' | ||||
exclude '**/modules/vector-tile/**' | |||||
exclude '**/modules/wildcard/**' | exclude '**/modules/wildcard/**' | ||||
exclude '**/modules/x-pack-*/**' | exclude '**/modules/x-pack-*/**' | ||||
includeEmptyDirs = false | includeEmptyDirs = false |