Skip to content

Commit

Permalink
Fix system property resolution at configuration time (elastic#78669)
Browse files Browse the repository at this point in the history
This fixes system property resolution when running the build with --configuration-cache

One step closer to make use of configuration cache
  • Loading branch information
breskeby authored Oct 5, 2021
1 parent 310b4ac commit 545eb1a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,17 @@ protected static void loadBuildSrcVersion(Properties loadedProps, ProviderFactor
);
}
String qualifier = providers.systemProperty("build.version_qualifier")
.orElse("")
.forUseAtConfigurationTime()
.get();
.getOrElse("");
if (qualifier.isEmpty() == false) {
if (qualifier.matches("(alpha|beta|rc)\\d+") == false) {
throw new IllegalStateException("Invalid qualifier: " + qualifier);
}
elasticsearch += "-" + qualifier;
}
final String buildSnapshotSystemProperty = providers.systemProperty("build.snapshot")
.orElse("true")
.forUseAtConfigurationTime()
.get();
.getOrElse("true");
switch (buildSnapshotSystemProperty) {
case "true":
elasticsearch += "-SNAPSHOT";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tasks.withType(StandaloneRestIntegTestTask).configureEach {
systemProperty 'tests.rest.cluster.password', clusterCredentials.password
}

testClusters.all {
testClusters.configureEach {
setting 'xpack.security.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
user clusterCredentials
Expand Down
4 changes: 2 additions & 2 deletions build-tools-internal/src/main/groovy/elasticsearch.run.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import org.elasticsearch.gradle.testclusters.RunTask

testClusters.register("runTask") {
testDistribution = providers.systemProperty('run.distribution').orElse('default').forUseAtConfigurationTime().get()
if (providers.systemProperty('run.distribution').orElse('default').forUseAtConfigurationTime().get() == 'default') {
String licenseType = providers.systemProperty("run.license_type").orElse("basic").forUseAtConfigurationTime().get()
if (providers.systemProperty('run.distribution').forUseAtConfigurationTime().getOrElse('default') == 'default') {
String licenseType = providers.systemProperty("run.license_type").forUseAtConfigurationTime().getOrElse("basic")
if (licenseType == 'trial') {
setting 'xpack.ml.enabled', 'true'
setting 'xpack.graph.enabled', 'true'
Expand Down
2 changes: 1 addition & 1 deletion qa/remote-clusters/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ tasks.named("preProcessFixture").configure {

dockerCompose {
tcpPortsToIgnoreWhenWaiting = [9600, 9601]
if ('default'.equalsIgnoreCase(providers.systemProperty('tests.distribution').orElse('default').forUseAtConfigurationTime().get())) {
if ('default'.equalsIgnoreCase(providers.systemProperty('tests.distribution').forUseAtConfigurationTime().getOrElse('default'))) {
useComposeFiles = ['docker-compose.yml']
} else {
useComposeFiles = ['docker-compose-oss.yml']
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugin/ml/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
forRepository {
ivy {
name "ml-cpp"
url providers.systemProperty('build.ml_cpp.repo').orElse('https://prelert-artifacts.s3.amazonaws.com').forUseAtConfigurationTime().get()
url providers.systemProperty('build.ml_cpp.repo').forUseAtConfigurationTime().orElse('https://prelert-artifacts.s3.amazonaws.com').get()
metadataSources {
// no repository metadata, look directly for the artifact
artifact()
Expand Down

0 comments on commit 545eb1a

Please sign in to comment.