Skip to content

Commit 8b1d2c5

Browse files
committed
Permit autoscaling feature flag in release builds (#52088)
This commit provides a path to set register the autoscaling feature flag in release builds, and therefore enabling autoscaling in release builds. The primary reason that we add this is so that our release docs tests can pass. Our 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 autoscaling can not be enabled in release builds, this meant that the autoscaling snippets would fail in the release docs tests. To address then, we need the ability to enable autoscaling in the release docs tests which we can now do with the system property added here. This system property will be removed when autoscaling is ready for release.
1 parent ff56e44 commit 8b1d2c5

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

docs/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ testClusters.integTest {
4545
if (singleNode().testDistribution == DEFAULT) {
4646
setting 'xpack.license.self_generated.type', 'trial'
4747
setting 'indices.lifecycle.history_index_enabled', 'false'
48+
if (BuildParams.isSnapshotBuild() == false) {
49+
systemProperty 'es.autoscaling_feature_flag_registered', 'true'
50+
}
51+
setting 'xpack.autoscaling.enabled', 'true'
4852
if (BuildParams.isSnapshotBuild()) {
49-
setting 'xpack.autoscaling.enabled', 'true'
5053
setting 'xpack.eql.enabled', 'true'
5154
}
5255
}

x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@
3333
*/
3434
public class Autoscaling extends Plugin implements ActionPlugin {
3535

36+
private static final boolean AUTOSCALING_FEATURE_FLAG_REGISTERED;
37+
38+
static {
39+
final String property = System.getProperty("es.autoscaling_feature_flag_registered");
40+
if (Build.CURRENT.isSnapshot() && property != null) {
41+
throw new IllegalArgumentException("es.autoscaling_feature_flag_registered is only supported in non-snapshot builds");
42+
}
43+
if ("true".equals(property)) {
44+
AUTOSCALING_FEATURE_FLAG_REGISTERED = true;
45+
} else if ("false".equals(property) || property == null) {
46+
AUTOSCALING_FEATURE_FLAG_REGISTERED = false;
47+
} else {
48+
throw new IllegalArgumentException(
49+
"expected es.autoscaling_feature_flag_registered to be unset or [true|false] but was [" + property + "]"
50+
);
51+
}
52+
}
53+
3654
public static final Setting<Boolean> AUTOSCALING_ENABLED_SETTING = Setting.boolSetting(
3755
"xpack.autoscaling.enabled",
3856
false,
@@ -52,7 +70,7 @@ public Autoscaling(final Settings settings) {
5270
*/
5371
@Override
5472
public List<Setting<?>> getSettings() {
55-
if (isSnapshot()) {
73+
if (isSnapshot() || AUTOSCALING_FEATURE_FLAG_REGISTERED) {
5674
return Collections.singletonList(AUTOSCALING_ENABLED_SETTING);
5775
} else {
5876
return Collections.emptyList();

0 commit comments

Comments
 (0)