Skip to content

Commit

Permalink
Migrate hardcoded images to Maven properties
Browse files Browse the repository at this point in the history
  • Loading branch information
gtroitsk committed Dec 19, 2023
1 parent ba91e34 commit 8cb13a5
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 209 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@Tag("podman-incompatible") //TODO: https://github.com/quarkusio/quarkus/issues/28721
public class DockerBuildIT {

// Local container build, no need in tracking image in properties
private static final String DOCKER_IMG_NAME = "hello-world-app";
private static final String DOCKER_IMG_VERSION = "1.0.0";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ReactiveRestClientProxyIT {
private static final String USER = "proxyuser";
private static final String PASSWORD = "proxypassword";

@Container(image = "docker.io/library/nginx:1-alpine", port = 8090, expectedLog = "Configuration complete; ready for start up")
@Container(image = "${nginx.image}", port = 8090, expectedLog = "Configuration complete; ready for start up")
static RestService proxy = new RestService()
.withProperty("_whatever", "resource_with_destination::/etc/nginx/|nginx.conf");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package io.quarkus.ts.messaging.amqpreactive;

import static io.quarkus.test.utils.ImageUtil.getImageName;
import static io.quarkus.test.utils.ImageUtil.getImageVersion;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand All @@ -15,15 +18,15 @@
@QuarkusScenario
public class DevModeAmqpDevServiceUserExperienceIT {

private static final String AMQP_VERSION = "0.1.3";
private static final String AMQP_IMAGE = "quay.io/artemiscloud/activemq-artemis-broker";
private static final String AMQP_VERSION = getImageVersion("amqbroker.1.0x.image");
private static final String AMQP_IMAGE = getImageName("amqbroker.1.0x.image");

/**
* AMQP must be started using DEV services when running in DEV mode
*/
@DevModeQuarkusApplication
static RestService app = new RestService()
.withProperty("quarkus.amqp.devservices.image-name", String.format("%s:%s", AMQP_IMAGE, AMQP_VERSION))
.withProperty("quarkus.amqp.devservices.image-name", "${amqbroker.1.0x.image}")
.onPreStart(s -> DockerUtils.removeImage(AMQP_IMAGE, AMQP_VERSION));

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package io.quarkus.ts.messaging.kafka.reactive.streams;

import static io.quarkus.test.utils.ImageUtil.getImageName;
import static io.quarkus.test.utils.ImageUtil.getImageVersion;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand All @@ -15,18 +18,18 @@
@QuarkusScenario
public class DevModeRedPandaDevServiceUserExperienceIT {

private static final String RED_PANDA_VERSION = "v22.3.4";
private static final String RED_PANDA_IMAGE = "vectorized/redpanda";
private static final String RED_PANDA_VERSION = getImageVersion("redpanda.image");;
private static final String RED_PANDA_IMAGE = getImageName("redpanda.image");

@DevModeQuarkusApplication
static RestService app = new RestService()
.withProperty("quarkus.kafka.devservices.enabled", Boolean.TRUE.toString())
.withProperty("quarkus.kafka.devservices.image-name", String.format("%s:%s", RED_PANDA_IMAGE, RED_PANDA_VERSION))
.withProperty("quarkus.kafka.devservices.image-name", "${redpanda.image}")
.onPreStart(s -> DockerUtils.removeImage(RED_PANDA_IMAGE, RED_PANDA_VERSION));

@Test
public void verifyIfUserIsInformedAboutRedPandaDevServicePulling() {
app.logs().assertContains("Pulling docker image: vectorized/redpanda");
app.logs().assertContains("Pulling docker image: redpandadata/redpanda");
app.logs().assertContains("Please be patient; this may take some time but only needs to be done once");
app.logs().assertContains("Starting to pull image");
app.logs().assertContains("Dev Services for Kafka started");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
@Tag("QUARKUS-1087")
@QuarkusScenario
public class DevModeApicurioDevServiceUserExperienceIT {

// Use container image and version defined in KafkaRegistry
private static final String APICURIO_VERSION = KafkaRegistry.APICURIO.getDefaultVersion();
private static final String APICURIO_IMAGE = "apicurio/apicurio-registry-mem";
private static final String APICURIO_IMAGE = KafkaRegistry.APICURIO.getImage();

@DevModeQuarkusApplication
static RestService appDevServices = new RestService()
Expand All @@ -28,7 +30,7 @@ public class DevModeApicurioDevServiceUserExperienceIT {

@Test
public void verifyIfUserIsInformedAboutApicurioServicePulling() {
appDevServices.logs().assertContains("Pulling docker image: apicurio/apicurio-registry-mem");
appDevServices.logs().assertContains("Pulling docker image: quay.io/apicurio/apicurio-registry-mem");
appDevServices.logs().assertContains("Please be patient; this may take some time but only needs to be done once");
appDevServices.logs().assertContains("Starting to pull image");
appDevServices.logs().assertContains("Dev Services for Apicurio Registry started");
Expand Down
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<exclude.quarkus.devmode.tests>no</exclude.quarkus.devmode.tests>
<!-- Docker images used by both surefire and failsafe plugin -->
<postgresql.latest.image>docker.io/library/postgres:15</postgresql.latest.image>
<mysql.80.image>registry.access.redhat.com/rhscl/mysql-80-rhel7</mysql.80.image>
<rhbk.image>registry.redhat.io/rhbk/keycloak-rhel9:22-6</rhbk.image>
<wiremock-jre8.version>2.35.1</wiremock-jre8.version>
<build-reporter-maven-extension.version>3.3.1</build-reporter-maven-extension.version>
Expand Down Expand Up @@ -229,6 +230,7 @@
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<!-- Services used in test suite -->
<postgresql.latest.image>${postgresql.latest.image}</postgresql.latest.image>
<mysql.80.image>${mysql.80.image}</mysql.80.image>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down Expand Up @@ -258,12 +260,15 @@
<quarkus.s2i.base-jvm-image>${quarkus.s2i.base-jvm-image}</quarkus.s2i.base-jvm-image>
<quarkus.s2i.base-native-image>${quarkus.s2i.base-native-image}</quarkus.s2i.base-native-image>
<!-- Services used in test suite -->
<nginx.image>docker.io/library/nginx:1-alpine</nginx.image>
<amqbroker.image>registry.access.redhat.com/amq-broker-7/amq-broker-72-openshift:latest</amqbroker.image>
<amqbroker.1.0x.image>quay.io/artemiscloud/activemq-artemis-broker:1.0.23</amqbroker.1.0x.image>
<redpanda.image>redpandadata/redpanda:v23.2.16</redpanda.image>
<postgresql.latest.image>${postgresql.latest.image}</postgresql.latest.image>
<elastic.7x.image>docker.io/library/elasticsearch:7.17.12</elastic.7x.image>
<mysql.57.image>docker.io/library/mysql:5.7.42</mysql.57.image>
<mysql.upstream.80.image>docker.io/library/mysql:8.0</mysql.upstream.80.image>
<mysql.80.image>registry.access.redhat.com/rhscl/mysql-80-rhel7</mysql.80.image>
<mysql.80.image>${mysql.80.image}</mysql.80.image>
<mariadb.10.image>docker.io/library/mariadb:10.10</mariadb.10.image>
<mssql.image>mcr.microsoft.com/mssql/rhel/server:2022-latest</mssql.image>
<!-- Oracle image - we aim to use same version as Dev Services for Oracle so that we only download one image -->
Expand All @@ -277,6 +282,7 @@
<infinispan.image>quay.io/infinispan/server:14.0</infinispan.image>
<infinispan.expected-log>Infinispan Server.*started in</infinispan.expected-log>
<spring.cloud.server.image>quay.io/quarkusqeteam/spring-cloud-config-server:3.0</spring.cloud.server.image>
<keycloak.image>quay.io/keycloak/keycloak:22.0.5</keycloak.image>
<bouncycastle.bctls-fips.version>1.0.12.2</bouncycastle.bctls-fips.version>
</systemPropertyVariables>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package io.quarkus.ts.security.keycloak;

import static io.quarkus.test.utils.ImageUtil.getImageName;
import static io.quarkus.test.utils.ImageUtil.getImageVersion;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand All @@ -15,16 +18,16 @@
@QuarkusScenario
public class DevModeKeycloakDevServiceUserExperienceIT {

private static final String KEYCLOAK_VERSION = "19.0.0";
private static final String KEYCLOAK_IMAGE = "quay.io/keycloak/keycloak";
private static final String KEYCLOAK_VERSION = getImageVersion("keycloak.image");
private static final String KEYCLOAK_IMAGE = getImageName("keycloak.image");
private static final String SECRET_KEYS_MISSING = "Secret key for encrypting tokens in a session cookie is missing, auto-generating it";

/**
* Keycloak must be started using DEV services when running in DEV mode
*/
@DevModeQuarkusApplication
static RestService app = new RestService()
.withProperty("quarkus.keycloak.devservices.image-name", String.format("%s:%s", KEYCLOAK_IMAGE, KEYCLOAK_VERSION))
.withProperty("quarkus.keycloak.devservices.image-name", "${keycloak.image}")
.withProperty("quarkus.oidc.credentials.secret", "") // we don't want to use client secret for encryption secret
.onPreStart(s -> DockerUtils.removeImage(KEYCLOAK_IMAGE, KEYCLOAK_VERSION));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: hippo
spec:
openshift: true
# Image is used only in this configuration, no need in tracking the image in Maven properties
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.2-1
postgresVersion: 14
instances:
Expand All @@ -16,6 +17,7 @@ spec:
storage: 150Mi
backups:
pgbackrest:
# Image is used only in this configuration, no need in tracking the image in Maven properties
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.38-0
repos:
- name: repo1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public class MySqlDatabaseTestResource implements QuarkusTestResourceLifecycleMa

@Override
public Map<String, String> start() {
String image = System.getProperty("mysql.80.image");

container = new MySQLContainer<>(
DockerImageName.parse("registry.access.redhat.com/rhscl/mysql-80-rhel7").asCompatibleSubstituteFor(MYSQL));
DockerImageName.parse(image).asCompatibleSubstituteFor(MYSQL));
container.withUrlParam("currentSchema", DEFAULT_SCHEMA);
container.start();

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.quarkus.ts.reactive.db.clients;

import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageName;
import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageVersion;
import static io.quarkus.test.utils.ImageUtil.getImageName;
import static io.quarkus.test.utils.ImageUtil.getImageVersion;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.quarkus.ts.reactive.db.clients;

import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageName;
import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageVersion;
import static io.quarkus.test.utils.ImageUtil.getImageName;
import static io.quarkus.test.utils.ImageUtil.getImageVersion;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.quarkus.ts.reactive.db.clients;

import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageName;
import static io.quarkus.ts.reactive.db.clients.DbUtil.getImageVersion;
import static io.quarkus.test.utils.ImageUtil.getImageName;
import static io.quarkus.test.utils.ImageUtil.getImageVersion;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8cb13a5

Please sign in to comment.