Rewrite build config to kokuwa.io infrastructure
Some checks failed
ci/woodpecker/push/lint Pipeline failed
ci/woodpecker/push/build Pipeline failed
ci/woodpecker/manual/lint Pipeline failed
ci/woodpecker/manual/verify/3 Pipeline failed
ci/woodpecker/manual/verify/2 Pipeline failed
ci/woodpecker/manual/verify/1 Pipeline was successful
ci/woodpecker/manual/build Pipeline failed

This commit is contained in:
Stephan Schnabel 2025-06-23 17:25:33 +02:00
parent 61e7955732
commit 57d15369d6
Signed by: stephan.schnabel
SSH key fingerprint: SHA256:99zuzxNGFb5/5P+E/O7ONU2qhUojUe/D8rIPTW+9Xp0
17 changed files with 310 additions and 400 deletions

View file

@ -50,28 +50,29 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
var jar = properties.getProperty("jar");
var timeout = properties.getProperty("timeout");
// create and start container
// create and start container - use fixed port in ci
@SuppressWarnings({ "resource", "deprecation" })
var container = (System.getenv("CI") == null
? new GenericContainer<>(image).withExposedPorts(8080)
: new FixedHostPortGenericContainer<>(image).withFixedExposedPort(8080, 8080))
.withEnv("KEYCLOAK_ADMIN", "admin")
.withEnv("KEYCLOAK_ADMIN_PASSWORD", "password")
.withEnv("KC_LOG_LEVEL", "io.kokuwa:trace")
// otherwise port 9000 will be used, with this config we can test different keycloak versions
.withEnv("KC_LEGACY_OBSERVABILITY_INTERFACE", "true")
.withEnv("KC_HEALTH_ENABLED", "true")
.withEnv("KC_METRICS_ENABLED", "true")
.withEnv("KC_METRICS_STATS_ENABLED", "true")
.withEnv("KC_METRICS_STATS_INTERVAL", "PT1s")
.withCopyFileToContainer(MountableFile.forHostPath(jar), "/opt/keycloak/providers/metrics.jar")
.withLogConsumer(out -> System.out.print(out.getUtf8String()))
.withStartupTimeout(Duration.parse(timeout))
.waitingFor(Wait.forHttp("/health").forPort(8080).withStartupTimeout(Duration.ofMinutes(10)))
.withCommand("start-dev");
: new FixedHostPortGenericContainer<>(image).withFixedExposedPort(8080, 8080));
try {
container.start();
container
.withEnv("KEYCLOAK_ADMIN", "admin")
.withEnv("KEYCLOAK_ADMIN_PASSWORD", "password")
.withEnv("KC_LOG_LEVEL", "io.kokuwa:trace")
// otherwise port 9000 will be used, with this config we can test different keycloak versions
.withEnv("KC_LEGACY_OBSERVABILITY_INTERFACE", "true")
.withEnv("KC_HEALTH_ENABLED", "true")
.withEnv("KC_METRICS_ENABLED", "true")
.withEnv("KC_METRICS_STATS_ENABLED", "true")
.withEnv("KC_METRICS_STATS_INTERVAL", "PT1s")
.withCopyFileToContainer(MountableFile.forHostPath(jar), "/opt/keycloak/providers/metrics.jar")
.withLogConsumer(out -> System.out.print(out.getUtf8String()))
.withStartupTimeout(Duration.parse(timeout))
.waitingFor(Wait.forHttp("/health").forPort(8080).withStartupTimeout(Duration.ofMinutes(10)))
.withCommand("start-dev")
.start();
} catch (RuntimeException e) {
throw new Exception("Failed to start keycloak", e);
}