From 7260a9d5b4d0f62e1002f7e2323cecaa883f2f07 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Fri, 27 Jun 2025 11:21:50 -0400 Subject: [PATCH] Make FoundationDB versions available at runtime --- pom.xml | 1 + service/pom.xml | 1 - .../storage/FoundationDbVersion.java | 20 +++++++++++++++++++ .../storage/FoundationDbExtension.java | 2 +- ...sFoundationDbDatabaseLifecycleManager.java | 3 +-- 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 service/src/main/java-templates/org/whispersystems/textsecuregcm/storage/FoundationDbVersion.java diff --git a/pom.xml b/pom.xml index a296473ae..39f5bc73b 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,7 @@ with even-numbered patch versions). Also when updating FoundationDB, make sure to update the version of FoundationDB used by GitHub Actions. --> 7.3.62 + 730 bfed237b787fae3cde1222676e6bfbb0d218fc27bf9e903397a7a7aa96fb2d33 26.57.0 1.70.0 diff --git a/service/pom.xml b/service/pom.xml index 12113caef..42203ff60 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -761,7 +761,6 @@ -javaagent:${org.mockito:mockito-core:jar} --add-opens=java.base/java.net=ALL-UNNAMED - ${foundationdb.version} ${localstack.image} diff --git a/service/src/main/java-templates/org/whispersystems/textsecuregcm/storage/FoundationDbVersion.java b/service/src/main/java-templates/org/whispersystems/textsecuregcm/storage/FoundationDbVersion.java new file mode 100644 index 000000000..3d9b0aa22 --- /dev/null +++ b/service/src/main/java-templates/org/whispersystems/textsecuregcm/storage/FoundationDbVersion.java @@ -0,0 +1,20 @@ +/* + * Copyright 2025 Signal Messenger, LLC + * SPDX-License-Identifier: AGPL-3.0-only + */ + +package org.whispersystems.textsecuregcm.storage; + +public class FoundationDbVersion { + + private static final String VERSION = "${foundationdb.version}"; + private static final int API_VERSION = ${foundationdb.api-version}; + + public static String getFoundationDbVersion() { + return VERSION; + } + + public static int getFoundationDbApiVersion() { + return API_VERSION; + } +} diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/FoundationDbExtension.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/FoundationDbExtension.java index 9c87e471d..4cc352af6 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/FoundationDbExtension.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/FoundationDbExtension.java @@ -24,7 +24,7 @@ class FoundationDbExtension implements BeforeAllCallback, ExtensionContext.Store ? new ServiceContainerFoundationDbDatabaseLifecycleManager(serviceContainerName) : new TestcontainersFoundationDbDatabaseLifecycleManager(); - databaseLifecycleManager.initializeDatabase(FDB.selectAPIVersion(730)); + databaseLifecycleManager.initializeDatabase(FDB.selectAPIVersion(FoundationDbVersion.getFoundationDbApiVersion())); context.getRoot().getStore(ExtensionContext.Namespace.GLOBAL).put(getClass().getName(), this); } diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/TestcontainersFoundationDbDatabaseLifecycleManager.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/TestcontainersFoundationDbDatabaseLifecycleManager.java index cf458d8ad..18b57ff96 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/TestcontainersFoundationDbDatabaseLifecycleManager.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/TestcontainersFoundationDbDatabaseLifecycleManager.java @@ -17,8 +17,7 @@ class TestcontainersFoundationDbDatabaseLifecycleManager implements FoundationDb private FoundationDBContainer foundationDBContainer; private Database database; - private static final String FOUNDATIONDB_IMAGE_NAME = "foundationdb/foundationdb:" + - System.getProperty("foundationdb.version", "7.3.62"); + private static final String FOUNDATIONDB_IMAGE_NAME = "foundationdb/foundationdb:" + FoundationDbVersion.getFoundationDbVersion(); private static final Logger log = LoggerFactory.getLogger(TestcontainersFoundationDbDatabaseLifecycleManager.class);