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

Adjust image name substitution for Elasticsearch Dev Services #31347

Merged
merged 2 commits into from
Feb 22, 2023
Merged
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 @@ -84,7 +84,7 @@ public DevServicesResultBuildItem startElasticsearchDevService(
}

StartupLogCompressor compressor = new StartupLogCompressor(
(launchMode.isTest() ? "(test) " : "") + "Elasticsearch Dev Services Starting:",
(launchMode.isTest() ? "(test) " : "") + "Dev Services for Elasticsearch starting:",
consoleInstalledBuildItem, loggingSetupBuildItem);
try {
devService = startElasticsearch(dockerStatusBuildItem, configuration, buildItemsConfig, launchMode,
Expand Down Expand Up @@ -153,14 +153,14 @@ private DevServicesResultBuildItem.RunningDevService startElasticsearch(
LaunchModeBuildItem launchMode, boolean useSharedNetwork, Optional<Duration> timeout) throws BuildException {
if (!config.enabled.orElse(true)) {
// explicitly disabled
log.debug("Not starting dev services for Elasticsearch, as it has been disabled in the config.");
log.debug("Not starting Dev Services for Elasticsearch, as it has been disabled in the config.");
return null;
}

for (String hostsConfigProperty : buildItemConfig.hostsConfigProperties) {
// Check if elasticsearch hosts property is set
if (ConfigUtils.isPropertyPresent(hostsConfigProperty)) {
log.debugf("Not starting dev services for Elasticsearch, the %s property is configured.", hostsConfigProperty);
log.debugf("Not starting Dev Services for Elasticsearch, the %s property is configured.", hostsConfigProperty);
return null;
}
}
Expand All @@ -173,7 +173,7 @@ private DevServicesResultBuildItem.RunningDevService startElasticsearch(

// We only support ELASTIC container for now
if (buildItemConfig.distribution == DevservicesElasticsearchBuildItem.Distribution.OPENSEARCH) {
throw new BuildException("Dev services for Elasticsearch didn't support Opensearch", Collections.emptyList());
throw new BuildException("Dev Services for Elasticsearch doesn't support OpenSearch", Collections.emptyList());
}

// Hibernate Search Elasticsearch have a version configuration property, we need to check that it is coherent
Expand All @@ -182,9 +182,9 @@ private DevServicesResultBuildItem.RunningDevService startElasticsearch(
String containerTag = config.imageName.substring(config.imageName.indexOf(':') + 1);
if (!containerTag.startsWith(buildItemConfig.version)) {
throw new BuildException(
"Dev services for Elasticsearch detected a version mismatch, container image is " + config.imageName
"Dev Services for Elasticsearch detected a version mismatch, container image is " + config.imageName
+ " but the configured version is " + buildItemConfig.version +
". Either configure a different image or disable dev services for Elasticsearch.",
". Either configure a different image or disable Dev Services for Elasticsearch.",
Collections.emptyList());
}
}
Expand All @@ -197,7 +197,8 @@ private DevServicesResultBuildItem.RunningDevService startElasticsearch(
// Starting the server
final Supplier<DevServicesResultBuildItem.RunningDevService> defaultElasticsearchSupplier = () -> {
ElasticsearchContainer container = new ElasticsearchContainer(
DockerImageName.parse(config.imageName).asCompatibleSubstituteFor("elasticsearch/elasticsearch"));
DockerImageName.parse(config.imageName)
.asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch"));
ConfigureUtil.configureSharedNetwork(container, "elasticsearch");
if (config.serviceName != null) {
container.withLabel(DEV_SERVICE_LABEL, config.serviceName);
Expand Down Expand Up @@ -254,7 +255,8 @@ private DevservicesElasticsearchBuildItemsConfiguration(List<DevservicesElastics
version = buildItem.getVersion();
} else if (!version.equals(buildItem.getVersion())) {
// safety guard but should never occur as only Hibernate Search ORM Elasticsearch configure the version
throw new BuildException("Multiple extensions request Elasticsearch Dev Services on different version.",
throw new BuildException(
"Multiple extensions request different versions of Elasticsearch for Dev Services.",
Collections.emptyList());
}

Expand All @@ -263,7 +265,7 @@ private DevservicesElasticsearchBuildItemsConfiguration(List<DevservicesElastics
} else if (!distribution.equals(buildItem.getDistribution())) {
// safety guard but should never occur as only Hibernate Search ORM Elasticsearch configure the distribution
throw new BuildException(
"Multiple extensions request Elasticsearch Dev Services on different distribution.",
"Multiple extensions request different distributions of Elasticsearch for Dev Services.",
Collections.emptyList());
}

Expand Down