Skip to content

Commit 74ae1d6

Browse files
authored
Permit EQL feature flag in release builds (#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.
1 parent ec9d044 commit 74ae1d6

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

docs/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ testClusters.integTest {
4747
setting 'indices.lifecycle.history_index_enabled', 'false'
4848
if (BuildParams.isSnapshotBuild() == false) {
4949
systemProperty 'es.autoscaling_feature_flag_registered', 'true'
50+
systemProperty 'es.eql_feature_flag_registered', 'true'
5051
}
5152
setting 'xpack.autoscaling.enabled', 'true'
52-
if (BuildParams.isSnapshotBuild()) {
53-
setting 'xpack.eql.enabled', 'true'
54-
}
53+
setting 'xpack.eql.enabled', 'true'
5554
}
5655

5756
// enable regexes in painless so our tests don't complain about example snippets that use them

x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlPlugin.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@
4545

4646
public class EqlPlugin extends Plugin implements ActionPlugin {
4747

48+
private static final boolean EQL_FEATURE_FLAG_REGISTERED;
49+
50+
static {
51+
final String property = System.getProperty("es.eql_feature_flag_registered");
52+
if (Build.CURRENT.isSnapshot() && property != null) {
53+
throw new IllegalArgumentException("es.eql_feature_flag_registered is only supported in non-snapshot builds");
54+
}
55+
if ("true".equals(property)) {
56+
EQL_FEATURE_FLAG_REGISTERED = true;
57+
} else if ("false".equals(property) || property == null) {
58+
EQL_FEATURE_FLAG_REGISTERED = false;
59+
} else {
60+
throw new IllegalArgumentException(
61+
"expected es.eql_feature_flag_registered to be unset or [true|false] but was [" + property + "]"
62+
);
63+
}
64+
}
65+
4866
public static final Setting<Boolean> EQL_ENABLED_SETTING = Setting.boolSetting(
4967
"xpack.eql.enabled",
5068
false,
@@ -83,7 +101,7 @@ private Collection<Object> createComponents(Client client, String clusterName, N
83101
*/
84102
@Override
85103
public List<Setting<?>> getSettings() {
86-
if (isSnapshot()) {
104+
if (isSnapshot() || EQL_FEATURE_FLAG_REGISTERED) {
87105
return List.of(EQL_ENABLED_SETTING);
88106
} else {
89107
return List.of();

0 commit comments

Comments
 (0)