Skip to content

Commit d68a4ec

Browse files
authored
[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.
1 parent 098380e commit d68a4ec

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

docs/build.gradle

+2-3
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

+19-1
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,
@@ -87,7 +105,7 @@ public Collection<Module> createGuiceModules() {
87105
*/
88106
@Override
89107
public List<Setting<?>> getSettings() {
90-
if (isSnapshot()) {
108+
if (isSnapshot() || EQL_FEATURE_FLAG_REGISTERED) {
91109
return Collections.singletonList(EQL_ENABLED_SETTING);
92110
} else {
93111
return Collections.emptyList();

0 commit comments

Comments
 (0)