123
This commit is contained in:
parent
5fb11b34bd
commit
c71cd891bd
3 changed files with 34 additions and 15 deletions
|
@ -9,9 +9,19 @@ services:
|
|||
ports: [2375, 8080]
|
||||
|
||||
steps:
|
||||
|
||||
build:
|
||||
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:
|
||||
NEXUS_USERNAME: {from_secret: nexus_username}
|
||||
NEXUS_PASSWORD: {from_secret: nexus_password}
|
||||
|
||||
debug:
|
||||
image: kokuwaio/dockerd
|
||||
commands:
|
||||
- docker ps --all
|
||||
- docker logs keylcoak
|
||||
- exit 1
|
||||
when:
|
||||
status: failure
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
when:
|
||||
event: [manual, pull_request, push]
|
||||
branch: main
|
||||
event: [manual, pull_request]
|
||||
path: [.woodpecker/verify.yaml, pom.xml, src/**]
|
||||
|
||||
matrix:
|
||||
KEYCLOAK_VERSION:
|
||||
# - 22.0.5
|
||||
# - 23.0.7
|
||||
# - 24.0.5
|
||||
# - 25.0.6
|
||||
# - 26.0.8
|
||||
# - 26.1.5
|
||||
- 26.2.1
|
||||
- 22.0.5
|
||||
- 23.0.7
|
||||
- 24.0.5
|
||||
- 25.0.6
|
||||
- 26.0.8
|
||||
- 26.1.5
|
||||
- 26.2.5
|
||||
|
||||
services:
|
||||
- name: dockerd
|
||||
|
|
|
@ -30,6 +30,7 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
|
|||
private static KeycloakClient client;
|
||||
private static Prometheus prometheus;
|
||||
|
||||
@SuppressWarnings({ "resource", "deprecation" })
|
||||
@Override
|
||||
public void beforeAll(ExtensionContext context) throws Exception {
|
||||
|
||||
|
@ -52,11 +53,14 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
|
|||
|
||||
// create and start container
|
||||
|
||||
@SuppressWarnings({ "resource", "deprecation" })
|
||||
var container = (System.getenv("CI") == null
|
||||
? new GenericContainer<>(image).withExposedPorts(8080)
|
||||
: new FixedHostPortGenericContainer<>(image).withFixedExposedPort(8080, 8080))
|
||||
.withEnv("KEYCLOAK_ADMIN", "admin")
|
||||
var container = new GenericContainer<>(image).withExposedPorts(8080);
|
||||
if (System.getenv("CI") != null) {
|
||||
// use fixed port and hostname in ci
|
||||
container = new FixedHostPortGenericContainer<>(image)
|
||||
.withFixedExposedPort(8080, 8080)
|
||||
.withCreateContainerCmdModifier(c -> c.withName("keycloak"));
|
||||
}
|
||||
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
|
||||
|
@ -79,6 +83,12 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
|
|||
// create client for keycloak container
|
||||
|
||||
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");
|
||||
assertEquals(version, keycloak.serverInfo().getInfo().getSystemInfo().getVersion(), "version invalid");
|
||||
var target = ClientBuilder.newClient().target(url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue