[7.x] Permit EQL feature flag in release builds (#52201) (#52214)

7.x backport of #52201

Provides a path to set register the EQL feature flag in release builds.
This enables EQL in release builds so that release docs tests pass.

Release docs tests do not have infrastructure in place to only register
snippets from included portions of the docs, they instead include all
docs snippets.

Since EQL can not be enabled in release builds, this meant that the EQL
snippets fail in the release docs tests.

This adds the ability to enable EQL in the release docs tests. This
system property will be removed when EQL is ready for release.
This commit is contained in:
James Rodewig 2020-02-11 11:49:49 -05:00 committed by GitHub
parent 098380e483
commit d68a4ec82e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -47,11 +47,10 @@ testClusters.integTest {
setting 'indices.lifecycle.history_index_enabled', 'false' setting 'indices.lifecycle.history_index_enabled', 'false'
if (BuildParams.isSnapshotBuild() == false) { if (BuildParams.isSnapshotBuild() == false) {
systemProperty 'es.autoscaling_feature_flag_registered', 'true' systemProperty 'es.autoscaling_feature_flag_registered', 'true'
systemProperty 'es.eql_feature_flag_registered', 'true'
} }
setting 'xpack.autoscaling.enabled', 'true' setting 'xpack.autoscaling.enabled', 'true'
if (BuildParams.isSnapshotBuild()) { setting 'xpack.eql.enabled', 'true'
setting 'xpack.eql.enabled', 'true'
}
} }
// enable regexes in painless so our tests don't complain about example snippets that use them // enable regexes in painless so our tests don't complain about example snippets that use them

View File

@ -45,6 +45,24 @@ import java.util.function.Supplier;
public class EqlPlugin extends Plugin implements ActionPlugin { public class EqlPlugin extends Plugin implements ActionPlugin {
private static final boolean EQL_FEATURE_FLAG_REGISTERED;
static {
final String property = System.getProperty("es.eql_feature_flag_registered");
if (Build.CURRENT.isSnapshot() && property != null) {
throw new IllegalArgumentException("es.eql_feature_flag_registered is only supported in non-snapshot builds");
}
if ("true".equals(property)) {
EQL_FEATURE_FLAG_REGISTERED = true;
} else if ("false".equals(property) || property == null) {
EQL_FEATURE_FLAG_REGISTERED = false;
} else {
throw new IllegalArgumentException(
"expected es.eql_feature_flag_registered to be unset or [true|false] but was [" + property + "]"
);
}
}
public static final Setting<Boolean> EQL_ENABLED_SETTING = Setting.boolSetting( public static final Setting<Boolean> EQL_ENABLED_SETTING = Setting.boolSetting(
"xpack.eql.enabled", "xpack.eql.enabled",
false, false,
@ -87,7 +105,7 @@ public class EqlPlugin extends Plugin implements ActionPlugin {
*/ */
@Override @Override
public List<Setting<?>> getSettings() { public List<Setting<?>> getSettings() {
if (isSnapshot()) { if (isSnapshot() || EQL_FEATURE_FLAG_REGISTERED) {
return Collections.singletonList(EQL_ENABLED_SETTING); return Collections.singletonList(EQL_ENABLED_SETTING);
} else { } else {
return Collections.emptyList(); return Collections.emptyList();