123
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
Stephan Schnabel 2025-05-30 10:16:41 +02:00
parent 5fb11b34bd
commit c71cd891bd
Signed by: stephan.schnabel
SSH key fingerprint: SHA256:99zuzxNGFb5/5P+E/O7ONU2qhUojUe/D8rIPTW+9Xp0
3 changed files with 34 additions and 15 deletions

View file

@ -9,9 +9,19 @@ services:
ports: [2375, 8080] ports: [2375, 8080]
steps: steps:
build: build:
image: maven:3.9.9-eclipse-temurin-17 image: maven:3.9.9-eclipse-temurin-17
commands: mvn deploy --settings=.woodpecker/maven/settings.xml commands: mvn deploy --settings=.woodpecker/maven/settings.xml -Dmaven.test.redirectTestOutputToFile=true -X
environment: environment:
NEXUS_USERNAME: {from_secret: nexus_username} NEXUS_USERNAME: {from_secret: nexus_username}
NEXUS_PASSWORD: {from_secret: nexus_password} NEXUS_PASSWORD: {from_secret: nexus_password}
debug:
image: kokuwaio/dockerd
commands:
- docker ps --all
- docker logs keylcoak
- exit 1
when:
status: failure

View file

@ -1,17 +1,16 @@
when: when:
event: [manual, pull_request, push] event: [manual, pull_request]
branch: main
path: [.woodpecker/verify.yaml, pom.xml, src/**] path: [.woodpecker/verify.yaml, pom.xml, src/**]
matrix: matrix:
KEYCLOAK_VERSION: KEYCLOAK_VERSION:
# - 22.0.5 - 22.0.5
# - 23.0.7 - 23.0.7
# - 24.0.5 - 24.0.5
# - 25.0.6 - 25.0.6
# - 26.0.8 - 26.0.8
# - 26.1.5 - 26.1.5
- 26.2.1 - 26.2.5
services: services:
- name: dockerd - name: dockerd

View file

@ -30,6 +30,7 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
private static KeycloakClient client; private static KeycloakClient client;
private static Prometheus prometheus; private static Prometheus prometheus;
@SuppressWarnings({ "resource", "deprecation" })
@Override @Override
public void beforeAll(ExtensionContext context) throws Exception { public void beforeAll(ExtensionContext context) throws Exception {
@ -52,11 +53,14 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
// create and start container // create and start container
@SuppressWarnings({ "resource", "deprecation" }) var container = new GenericContainer<>(image).withExposedPorts(8080);
var container = (System.getenv("CI") == null if (System.getenv("CI") != null) {
? new GenericContainer<>(image).withExposedPorts(8080) // use fixed port and hostname in ci
: new FixedHostPortGenericContainer<>(image).withFixedExposedPort(8080, 8080)) container = new FixedHostPortGenericContainer<>(image)
.withEnv("KEYCLOAK_ADMIN", "admin") .withFixedExposedPort(8080, 8080)
.withCreateContainerCmdModifier(c -> c.withName("keycloak"));
}
container.withEnv("KEYCLOAK_ADMIN", "admin")
.withEnv("KEYCLOAK_ADMIN_PASSWORD", "password") .withEnv("KEYCLOAK_ADMIN_PASSWORD", "password")
.withEnv("KC_LOG_LEVEL", "io.kokuwa:trace") .withEnv("KC_LOG_LEVEL", "io.kokuwa:trace")
// otherwise port 9000 will be used, with this config we can test different keycloak versions // otherwise port 9000 will be used, with this config we can test different keycloak versions
@ -79,6 +83,12 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
// create client for keycloak container // create client for keycloak container
var url = "http://" + container.getHost() + ":" + container.getMappedPort(8080); var url = "http://" + container.getHost() + ":" + container.getMappedPort(8080);
System.out.println(container.getHost());
System.out.println(container.getHost());
System.out.println(container.getHost());
System.out.println(container.getExtraHosts());
System.out.println(container.getExtraHosts());
System.out.println(container.getExtraHosts());
var keycloak = Keycloak.getInstance(url, "master", "admin", "password", "admin-cli"); var keycloak = Keycloak.getInstance(url, "master", "admin", "password", "admin-cli");
assertEquals(version, keycloak.serverInfo().getInfo().getSystemInfo().getVersion(), "version invalid"); assertEquals(version, keycloak.serverInfo().getInfo().getSystemInfo().getVersion(), "version invalid");
var target = ClientBuilder.newClient().target(url); var target = ClientBuilder.newClient().target(url);