Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinispan Dev Services image configuration #27012

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.stream.Collectors;

import org.infinispan.client.hotrod.impl.ConfigurationProperties;
import org.infinispan.commons.util.Version;
import org.infinispan.server.test.core.InfinispanContainer;
import org.jboss.logging.Logger;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -153,9 +154,8 @@ private RunningDevService startContainer(DockerStatusBuildItem dockerStatusBuild
}

Supplier<RunningDevService> defaultInfinispanServerSupplier = () -> {
QuarkusInfinispanContainer infinispanContainer = new QuarkusInfinispanContainer(devServicesConfig.port,
launchMode == DEVELOPMENT ? devServicesConfig.serviceName : null, useSharedNetwork,
devServicesConfig.artifacts);
QuarkusInfinispanContainer infinispanContainer = new QuarkusInfinispanContainer(devServicesConfig, launchMode,
useSharedNetwork);
timeout.ifPresent(infinispanContainer::withStartupTimeout);
infinispanContainer.start();

Expand Down Expand Up @@ -191,17 +191,17 @@ private static class QuarkusInfinispanContainer extends InfinispanContainer {

private String hostName = null;

public QuarkusInfinispanContainer(OptionalInt fixedExposedPort, String serviceName, boolean useSharedNetwork,
Optional<List<String>> artifacts) {
super();
this.fixedExposedPort = fixedExposedPort;
public QuarkusInfinispanContainer(InfinispanDevServicesConfig config,
LaunchMode launchMode, boolean useSharedNetwork) {
super(config.imageName.orElse(IMAGE_BASENAME + ":" + Version.getMajorMinor()));
this.fixedExposedPort = config.port;
this.useSharedNetwork = useSharedNetwork;
if (serviceName != null) {
withLabel(DEV_SERVICE_LABEL, serviceName);
if (launchMode == DEVELOPMENT) {
withLabel(DEV_SERVICE_LABEL, config.serviceName);
}
withUser(DEFAULT_USERNAME);
withPassword(InfinispanDevServiceProcessor.DEFAULT_PASSWORD);
artifacts.ifPresent(a -> withArtifacts(a.toArray(new String[0])));
config.artifacts.ifPresent(a -> withArtifacts(a.toArray(new String[0])));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ public class InfinispanDevServicesConfig {
@ConfigItem(defaultValue = "infinispan")
public String serviceName;

/**
* The image to use.
* Note that only official Infinispan images are supported.
*/
@ConfigItem
public Optional<String> imageName = Optional.empty();

/**
* List of the artifacts to automatically download and add to the Infinispan server libraries.
* <p>
Expand All @@ -78,11 +85,12 @@ public boolean equals(Object o) {
Objects.equals(port, that.port) &&
Objects.equals(shared, that.shared) &&
Objects.equals(serviceName, that.serviceName) &&
Objects.equals(imageName, that.imageName) &&
Objects.equals(artifacts, this.artifacts);
}

@Override
public int hashCode() {
return Objects.hash(enabled, port, shared, serviceName, artifacts);
return Objects.hash(enabled, port, shared, serviceName, imageName, artifacts);
}
}