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

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

2
.github/CODEOWNERS vendored
View file

@ -1,2 +0,0 @@
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
* @sschnabe @rpahli @fabian-schlegel @jschwarze @wistefan @monotek

View file

@ -1,14 +0,0 @@
version: 2
updates:
- package-ecosystem: maven
directory: /
schedule:
interval: daily
allow:
- dependency-name: io.kokuwa.maven:maven-parent
- dependency-name: org.keycloak:keycloak-quarkus-server
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
day: monday

16
.github/settings.xml vendored
View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://github.com/actions/setup-java/issues/85 -->
<settings>
<servers>
<server>
<id>sonatype-nexus</id>
<username>${env.SERVER_USERNAME}</username>
<password>${env.SERVER_PASSWORD}</password>
</server>
<server>
<id>github.com</id>
<username>nope</username>
<password>${env.GIT_ACTION_TOKEN}</password>
</server>
</servers>
</settings>

View file

@ -1,50 +1,42 @@
name: Build name: Verify
on: on:
push: - pull_request
branches: [main] - push:
branches: [main]
env:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress --settings=.github/settings.xml
steps: steps:
- name: docker/login-action docker.io - uses: actions/checkout@main
uses: docker/login-action@v3.4.0 - uses: actions/setup-java@main
with:
registry: docker.io
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
- name: docker/login-action ghcr.io
uses: docker/login-action@v3.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GIT_ACTION_TOKEN }}
- run: git config --global user.name "${{ vars.KOKUWA_IO_BOT_NAME }}"
- run: git config --global user.email "${{ vars.KOKUWA_IO_BOT_EMAIL }}"
- uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_ACTION_TOKEN }}
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- uses: actions/setup-java@v4
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 17
cache: maven cache: maven
server-id: sonatype-nexus - run: mvn verify
server-username: SERVER_USERNAME
server-password: SERVER_PASSWORD versions:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} runs-on: ubuntu-latest
gpg-passphrase: GPG_PASSPHRASE strategy:
- run: mvn $MAVEN_ARGS deploy fail-fast: false
env: matrix:
SERVER_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} version:
SERVER_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - 22.0.5
- 23.0.7
- 24.0.5
- 25.0.6
- 26.2.5
steps:
- uses: actions/checkout@main
- uses: actions/setup-java@main
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn verify -Dversion.org.keycloak.test=${{ matrix.version }}

23
.github/workflows/lint.yaml vendored Normal file
View file

@ -0,0 +1,23 @@
name: Lint
on: push
jobs:
renovate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: docker://kokuwaio/renovate-config-validator
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: docker://kokuwaio/markdownlint
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: docker://kokuwaio/yamllint

View file

@ -1,58 +0,0 @@
name: PullRequest
on: pull_request
env:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress
jobs:
yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ibiqlik/action-yamllint@v3
with:
format: colored
strict: true
markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: avto-dev/markdown-lint@v1
with:
args: /github/workspace
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn $MAVEN_ARGS verify
versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 22.0.5
- 23.0.7
- 24.0.5
- 25.0.6
- 26.0.8
- 26.1.5
- 26.2.5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn $MAVEN_ARGS verify -Dcheck.skip -Dversion.org.keycloak.test=${{ matrix.version }}

View file

@ -1,50 +0,0 @@
name: Release
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
env:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress --settings=.github/settings.xml
steps:
- name: docker/login-action docker.io
uses: docker/login-action@v3.4.0
with:
registry: docker.io
username: ${{ secrets.DOCKERIO_USERNAME }}
password: ${{ secrets.DOCKERIO_TOKEN }}
- name: docker/login-action ghcr.io
uses: docker/login-action@v3.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GIT_ACTION_TOKEN }}
- run: git config --global user.name "${{ vars.KOKUWA_IO_BOT_NAME }}"
- run: git config --global user.email "${{ vars.KOKUWA_IO_BOT_EMAIL }}"
- uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_ACTION_TOKEN }}
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
server-id: sonatype-nexus
server-username: SERVER_USERNAME
server-password: SERVER_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- run: mvn $MAVEN_ARGS release:prepare -Darguments="$MAVEN_ARGS"
- run: mvn $MAVEN_ARGS release:perform -Darguments="$MAVEN_ARGS"
env:
SERVER_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SERVER_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
GIT_ACTION_TOKEN: ${{ secrets.GIT_ACTION_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

39
.woodpecker/build.yaml Normal file
View file

@ -0,0 +1,39 @@
when:
instance: ci.kokuwa.io
repo: keycloak/keycloak-event-metrics
event: [manual, push]
branch: main
path: [.woodpecker/build.yaml, pom.xml, src/main/**]
services:
- name: dockerd
image: kokuwaio/dockerd
privileged: true
ports: [2375, 8080]
steps:
deploy:
image: maven:3.9.9-eclipse-temurin-17
commands: mvn deploy
environment:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress=true --settings=.woodpecker/maven/settings.xml
MAVEN_GPG_KEY: {from_secret: woodpecker_gpg_key}
SONATYPE_ORG_USERNAME: {from_secret: sonatype_org_username}
SONATYPE_ORG_PASSWORD: {from_secret: sonatype_org_password}
release:
image: maven:3.9.9-eclipse-temurin-17
commands:
- git config user.email "$GIT_USER_EMAIL"
- git config user.name "$GIT_USER_NAME"
- mvn release:prepare release:perform --settings=.woodpecker/maven/settings.xml
environment:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress -DskipTests -DautoPublish=false
MAVEN_GPG_KEY: {from_secret: woodpecker_gpg_key}
SONATYPE_ORG_USERNAME: {from_secret: sonatype_org_username}
SONATYPE_ORG_PASSWORD: {from_secret: sonatype_org_password}
DOCKER_IO_USERNAME: {from_secret: docker_io_username}
DOCKER_IO_PASSWORD: {from_secret: docker_io_password}
GHCR_IO_USERNAME: {from_secret: ghcr_io_username}
GHCR_IO_PASSWORD: {from_secret: ghcr_io_password}

21
.woodpecker/lint.yaml Normal file
View file

@ -0,0 +1,21 @@
when:
event: [manual, pull_request, push]
branch: main
path: [.woodpecker/lint.yaml, renovate.json, "**/*.y*ml", "**/*.md"]
steps:
renovate:
image: kokuwaio/renovate-config-validator
depends_on: []
when: [path: [.woodpecker/lint.yaml, renovate.json]]
yaml:
image: kokuwaio/yamllint
depends_on: []
when: [path: [.woodpecker/lint.yaml, .yamllint.yaml, "**/*.y*ml"]]
markdown:
image: kokuwaio/markdownlint
depends_on: []
when: [path: [.woodpecker/lint.yaml, .markdownlint.yaml, "**/*.md"]]

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<interactiveMode>false</interactiveMode>
<localRepository>/woodpecker/.m2</localRepository>
<servers>
<server>
<id>sonatype.org</id>
<username>${env.SONATYPE_ORG_USERNAME}</username>
<password>${env.SONATYPE_ORG_PASSWORD}</password>
</server>
<server>
<id>docker.io</id>
<username>${env.DOCKER_IO_USERNAME}</username>
<password>${env.DOCKER_IO_PASSWORD}</password>
</server>
<server>
<id>ghcr.io</id>
<username>${env.GHCR_IO_USERNAME}</username>
<password>${env.GHCR_IO_PASSWORD}</password>
</server>
</servers>
<mirrors>
<mirror>
<url>http://mirror.woodpecker.svc.cluster.local/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>

25
.woodpecker/release.yaml Normal file
View file

@ -0,0 +1,25 @@
when:
instance: ci.kokuwa.io
repo: keycloak/keycloak-event-metrics
event: deployment
branch: main
services:
- name: dockerd
image: kokuwaio/dockerd
ports: [2375, 8080]
steps:
deploy:
image: maven:3.9.9-eclipse-temurin-17
commands: mvn release:prepare release:perform --settings=.woodpecker/maven/settings.xml
environment:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress -DskipTests -DautoPublish=false
MAVEN_GPG_KEY: {from_secret: woodpecker_gpg_key}
SONATYPE_ORG_USERNAME: {from_secret: sonatype_org_username}
SONATYPE_ORG_PASSWORD: {from_secret: sonatype_org_password}
DOCKER_IO_USERNAME: {from_secret: docker_io_username}
DOCKER_IO_PASSWORD: {from_secret: docker_io_password}
GHCR_IO_USERNAME: {from_secret: ghcr_io_username}
GHCR_IO_PASSWORD: {from_secret: ghcr_io_password}

31
.woodpecker/verify.yaml Normal file
View file

@ -0,0 +1,31 @@
when:
event: [manual, pull_request]
path: [.woodpecker/verify.yaml, pom.xml, src/main/**]
matrix:
KEYCLOAK_VERSION:
# - 22.0.5
# - 23.0.7
# - 24.0.5
# - 25.0.6
# - 26.2.5
- $version.org.keycloak
- $$version.org.keycloak
- \$version.org.keycloak
- \$$version.org.keycloak
services:
- name: dockerd
image: kokuwaio/dockerd
privileged: true
ports: [2375, 8080]
steps:
veraify:
image: maven:3.9.9-eclipse-temurin-17
commands: echo $KEYCLOAK_VERSION
test:
image: maven:3.9.9-eclipse-temurin-17
commands: mvn test -Dversion.org.keycloak.test="$KEYCLOAK_VERSION" --batch-mode --color=always --no-transfer-progress=true --settings=.woodpecker/maven/settings.xml
environment:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress=true --settings=.woodpecker/maven/settings.xml

31
Dockerfile Normal file
View file

@ -0,0 +1,31 @@
FROM docker.io/library/maven:3.9.9-eclipse-temurin-17 AS mvn
WORKDIR /app
ARG MAVEN_ARGS="--batch-mode --color=always --no-transfer-progress -DskipTests -P=-dev"
ARG MAVEN_MIRROR_CENTRAL=https://mirror.grayc.io/maven2
RUN mkdir "$HOME/.m2" && printf "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
<settings>\n\
<localRepository>/tmp/mvn-repo</localRepository>\n\
<mirrors>\n\
<mirror>\n\
<url>%s</url>\n\
<mirrorOf>central</mirrorOf>\n\
</mirror>\n\
</mirrors>\n\
</settings>" "$MAVEN_MIRROR_CENTRAL" > "$HOME/.m2/settings.xml" && cat "$HOME/.m2/settings.xml"
COPY pom.xml lombok.config ./
COPY api/pom.xml api/pom.xml
COPY service/pom.xml service/pom.xml
RUN mvn install -N
COPY .git /
COPY api/ api/
RUN mvn install -pl api
COPY service/ service/
RUN mvn install -pl service
FROM docker.io/library/eclipse-temurin:21.0.7_6-jre@sha256:031eb6ccad828004407c0a41f6a4009a08289961d55e9119287c28756522a945
COPY service/target/libs /app/libs
COPY service/target/minoa-service-*.jar /app/minoa.jar
COPY api/openapi.yaml /static/openapi.yaml
COPY --from=app /app/dist /static
COPY --from=mkdocs-user-manual /mkdocs/site /static/docs
ENTRYPOINT ["java", "-XX:+ExitOnOutOfMemoryError", "-jar", "/app/minoa.jar"]

View file

@ -1,10 +1,15 @@
# Keycloak Metrics # Keycloak Event Metrics
Provides metrics for Keycloak user/admin events and user/client/session count. Tested on Keycloak [22-26](.github/workflows/pr.yaml#L48-L53). Provides metrics for Keycloak user/admin events and user/client/session count. Tested on Keycloak [22-26](.woodpecker/verify.yaml#L7-L11).
[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/kokuwaio/keycloak-event-metrics.svg?label=License)](http://www.apache.org/licenses/) [![Maven Central](https://img.shields.io/maven-central/v/io.kokuwa.keycloak/ww-event-metrics.svg?label=Maven%20Central)](https://central.sonatype.com/search?namespace=io.kokuwa.keycloak&q=keycloak-event-metrics)
[![Maven Central](https://img.shields.io/maven-central/v/io.kokuwa.keycloak/keycloak-event-metrics.svg?label=Maven%20Central)](https://central.sonatype.com/search?namespace=io.kokuwa.keycloak&q=keycloak-event-metrics) [![pulls](https://img.shields.io/docker/pulls/kokuwaio/keycloak-event-metrics)](https://hub.docker.com/r/kokuwaio/keycloak-event-metrics)
[![Build](https://img.shields.io/github/actions/workflow/status/kokuwaio/keycloak-event-metrics/build.yaml?label=Build)](https://github.com/kokuwaio/keycloak-event-metrics/actions/workflows/build.yaml) [![size](https://img.shields.io/docker/image-size/kokuwaio/keycloak-event-metrics)](https://hub.docker.com/r/kokuwaio/keycloak-event-metrics)
[![dockerfile](https://img.shields.io/badge/source-Dockerfile%20-blue)](https://git.kokuwa.io/keycloak/keycloak-event-metrics/src/branch/main/Dockerfile)
[![license](https://img.shields.io/badge/License-EUPL%201.2-blue)](https://git.kokuwa.io/keycloak/keycloak-event-metrics/src/branch/main/LICENSE)
[![prs](https://img.shields.io/gitea/pull-requests/open/keycloak/keycloak-event-metrics?gitea_url=https%3A%2F%2Fgit.kokuwa.io)](https://git.kokuwa.io/keycloak/keycloak-event-metrics/pulls)
[![issues](https://img.shields.io/gitea/issues/open/keycloak/keycloak-event-metrics?gitea_url=https%3A%2F%2Fgit.kokuwa.io)](https://git.kokuwa.io/keycloak/keycloak-event-metrics/issues)
[![build](https://ci.kokuwa.io/api/badges/keycloak/keycloak-event-metrics/status.svg)](https://ci.kokuwa.io/api/badges/keycloak/keycloak-event-metrics/)
## Why? ## Why?
@ -114,7 +119,7 @@ If scrapping takes less than `KC_METRICS_STATS_INFO_THRESHOLD` duration will be
### Grafana Dashboard ### Grafana Dashboard
Can be found here: [kokuwaio/keycloak keycloak-metrics.json](https://github.com/kokuwaio/keycloak/blob/main/src/test/k3s/dev/grafana/files/dashboards/keycloak-metrics.json) Can be found here: [keycloak-metrics.json](https://git.kokuwa.io/keycloak/keycloak/blob/main/src/test/k3s/dev/grafana/files/dashboards/keycloak-metrics.json)
### Testcontainers ### Testcontainers
@ -131,7 +136,7 @@ This images are based on busybox, so you can use cp to copy the jar into your ke
### Docker ### Docker
Check: [kokuwaio/keycloak](https://github.com/kokuwaio/keycloak) Check: [kowaio/keycloak](https://git.kokuwa.io/keycloak/keycloak)
Dockerfile: Dockerfile:
@ -145,7 +150,7 @@ FROM debian:stable-slim AS metrics
RUN apt-get -qq update RUN apt-get -qq update
RUN apt-get -qq install --yes --no-install-recommends ca-certificates wget RUN apt-get -qq install --yes --no-install-recommends ca-certificates wget
ARG METRICS_VERSION=1.0.0 ARG METRICS_VERSION=2.0.0
ARG METRICS_FILE=keycloak-event-metrics-${METRICS_VERSION}.jar ARG METRICS_FILE=keycloak-event-metrics-${METRICS_VERSION}.jar
ARG METRICS_URL=https://repo1.maven.org/maven2/io/kokuwa/keycloak/keycloak-event-metrics/${METRICS_VERSION} ARG METRICS_URL=https://repo1.maven.org/maven2/io/kokuwa/keycloak/keycloak-event-metrics/${METRICS_VERSION}
@ -159,7 +164,7 @@ RUN mv ${METRICS_FILE} /opt/keycloak/providers
### build keycloak with metrics ### build keycloak with metrics
### ###
FROM quay.io/keycloak/keycloak:25.0.1 FROM quay.io/keycloak/keycloak:25.2.5
ENV KEYCLOAK_ADMIN=admin ENV KEYCLOAK_ADMIN=admin
ENV KEYCLOAK_ADMIN_PASSWORD=password ENV KEYCLOAK_ADMIN_PASSWORD=password

246
pom.xml
View file

@ -4,11 +4,11 @@
<groupId>io.kokuwa.keycloak</groupId> <groupId>io.kokuwa.keycloak</groupId>
<artifactId>keycloak-event-metrics</artifactId> <artifactId>keycloak-event-metrics</artifactId>
<version>1.1.2-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
<name>Keycloak Metrics</name> <name>Keycloak Metrics</name>
<description>Provides metrics for Keycloak user/admin events</description> <description>Provides metrics for Keycloak user/admin events</description>
<url>https://github.com/kokuwaio/keycloak-event-metrics</url> <url>https://git.kokuwa.io/keycloak/keycloak-event-metrics</url>
<inceptionYear>2023</inceptionYear> <inceptionYear>2023</inceptionYear>
<organization> <organization>
<name>Kokuwa.io</name> <name>Kokuwa.io</name>
@ -33,27 +33,23 @@
</developers> </developers>
<scm> <scm>
<url>https://github.com/kokuwaio/keycloak-event-metrics</url> <url>https://git.kokuwa.io/keycloak/keycloak-event-metrics</url>
<connection>scm:git:https://github.com/kokuwaio/keycloak-event-metrics.git</connection> <connection>scm:git:https://git.kokuwa.io/keycloak/keycloak-event-metrics.git</connection>
<developerConnection>scm:git:https://github.com/kokuwaio/keycloak-event-metrics.git</developerConnection> <developerConnection>scm:git:https://git.kokuwa.io/keycloak/keycloak-event-metrics.git</developerConnection>
<tag>HEAD</tag> <tag>HEAD</tag>
</scm> </scm>
<issueManagement> <issueManagement>
<system>github</system> <system>forgejo</system>
<url>https://github.com/kokuwaio/keycloak-event-metrics/issues</url> <url>https://git.kokuwa.io/keycloak/keycloak-event-metrics/issues</url>
</issueManagement> </issueManagement>
<ciManagement> <ciManagement>
<system>github</system> <system>woodpecker</system>
<url>https://github.com/kokuwaio/keycloak-event-metrics/actions</url> <url>https://ci.kokuwa.io/repos/keycloak/keycloak-event-metrics</url>
</ciManagement> </ciManagement>
<distributionManagement> <distributionManagement>
<repository>
<id>sonatype-nexus</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository> <snapshotRepository>
<id>sonatype-nexus</id> <id>sonatype.org</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> <url>https://central.sonatype.com/repository/maven-snapshots/</url>
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
@ -83,28 +79,8 @@
<!-- ============================= Versions ============================== --> <!-- ============================= Versions ============================== -->
<!-- ===================================================================== --> <!-- ===================================================================== -->
<version.org.apache.maven.plugins.clean>3.4.1</version.org.apache.maven.plugins.clean>
<version.org.apache.maven.plugins.compiler>3.14.0</version.org.apache.maven.plugins.compiler>
<version.org.apache.maven.plugins.deploy>3.1.4</version.org.apache.maven.plugins.deploy>
<version.org.apache.maven.plugins.gpg>3.2.7</version.org.apache.maven.plugins.gpg>
<version.org.apache.maven.plugins.install>3.1.4</version.org.apache.maven.plugins.install>
<version.org.apache.maven.plugins.jar>3.4.2</version.org.apache.maven.plugins.jar>
<version.org.apache.maven.plugins.javadoc>3.11.2</version.org.apache.maven.plugins.javadoc>
<version.org.apache.maven.plugins.release>3.1.1</version.org.apache.maven.plugins.release>
<version.org.apache.maven.plugins.resources>3.3.1</version.org.apache.maven.plugins.resources>
<version.org.apache.maven.plugins.site>3.21.0</version.org.apache.maven.plugins.site>
<version.org.apache.maven.plugins.source>3.3.1</version.org.apache.maven.plugins.source>
<version.org.apache.maven.plugins.surefire>3.5.3</version.org.apache.maven.plugins.surefire>
<version.org.codehaus.mojo.tidy>1.4.0</version.org.codehaus.mojo.tidy>
<version.org.codehaus.mojo.versions>2.18.0</version.org.codehaus.mojo.versions>
<version.org.sonatype.plugins.nexus>1.7.0</version.org.sonatype.plugins.nexus>
<version.net.revelc.code.formatter>2.26.0</version.net.revelc.code.formatter>
<version.net.revelc.code.impsort>1.12.0</version.net.revelc.code.impsort>
<version.io.fabric8.docker>0.46.0</version.io.fabric8.docker>
<version.org.keycloak>26.2.5</version.org.keycloak> <version.org.keycloak>26.2.5</version.org.keycloak>
<version.org.keycloak.test>${version.org.keycloak}</version.org.keycloak.test> <version.org.keycloak.test>${version.org.keycloak}</version.org.keycloak.test>
<version.org.testcontainers>1.18.3</version.org.testcontainers>
</properties> </properties>
@ -236,15 +212,10 @@
</testResources> </testResources>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${version.org.apache.maven.plugins.clean}</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>${version.org.apache.maven.plugins.compiler}</version> <version>3.14.0</version>
<configuration> <configuration>
<compilerArgument>${maven.compiler.compilerArgument}</compilerArgument> <compilerArgument>${maven.compiler.compilerArgument}</compilerArgument>
</configuration> </configuration>
@ -252,37 +223,37 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>${version.org.apache.maven.plugins.deploy}</version> <version>3.1.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<version>${version.org.apache.maven.plugins.surefire}</version> <version>3.5.3</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>${version.org.apache.maven.plugins.gpg}</version> <version>3.2.7</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>${version.org.apache.maven.plugins.install}</version> <version>3.1.4</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>${version.org.apache.maven.plugins.jar}</version> <version>3.4.2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>${version.org.apache.maven.plugins.javadoc}</version> <version>3.11.2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>${version.org.apache.maven.plugins.release}</version> <version>3.1.1</version>
<configuration> <configuration>
<preparationGoals>clean verify</preparationGoals> <preparationGoals>clean verify</preparationGoals>
<preparationProfiles>check</preparationProfiles> <preparationProfiles>check</preparationProfiles>
@ -296,7 +267,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>${version.org.apache.maven.plugins.resources}</version> <version>3.3.1</version>
<configuration> <configuration>
<propertiesEncoding>${project.build.propertiesEncoding}</propertiesEncoding> <propertiesEncoding>${project.build.propertiesEncoding}</propertiesEncoding>
</configuration> </configuration>
@ -304,43 +275,32 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>${version.org.apache.maven.plugins.site}</version> <version>3.21.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>${version.org.apache.maven.plugins.source}</version> <version>3.3.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>${version.org.apache.maven.plugins.surefire}</version> <version>3.5.3</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>tidy-maven-plugin</artifactId> <artifactId>tidy-maven-plugin</artifactId>
<version>${version.org.codehaus.mojo.tidy}</version> <version>1.4.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.sonatype.central</groupId>
<artifactId>versions-maven-plugin</artifactId> <artifactId>central-publishing-maven-plugin</artifactId>
<version>${version.org.codehaus.mojo.versions}</version> <version>0.7.0</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
<ignoredVersions>
<ignoredVersion>^.*-(alpha|beta|M)-?[0-9]+$</ignoredVersion>
</ignoredVersions>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${version.org.sonatype.plugins.nexus}</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>net.revelc.code.formatter</groupId> <groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId> <artifactId>formatter-maven-plugin</artifactId>
<version>${version.net.revelc.code.formatter}</version> <version>2.26.0</version>
<configuration> <configuration>
<configFile>${formatter.configFile}</configFile> <configFile>${formatter.configFile}</configFile>
</configuration> </configuration>
@ -348,12 +308,7 @@
<plugin> <plugin>
<groupId>net.revelc.code</groupId> <groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId> <artifactId>impsort-maven-plugin</artifactId>
<version>${version.net.revelc.code.impsort}</version> <version>1.12.0</version>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${version.io.fabric8.docker}</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
@ -373,18 +328,6 @@
</executions> </executions>
</plugin> </plugin>
<!-- disable default executions -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase />
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
@ -516,109 +459,12 @@
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>javadoc-no-fork</goal> <goal>jar</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- docker image -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build</id>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>push</id>
<phase>deploy</phase>
<goals>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>build</verbose>
<images>
<image>
<name>docker.io/kokuwaio/keycloak-event-metrics:${project.version}</name>
<build>
<from>docker.io/library/busybox:1.37.0-uclibc@sha256:cc57e0ff4b6d3138931ff5c7180d18078813300e2508a25fb767a4d36df30d4d</from>
<assembly>
<basedir>${file.separator}</basedir>
<inline>
<files>
<file>
<source>${project.build.directory}/${project.build.finalName}.jar</source>
<destName>${project.artifactId}.jar</destName>
<fileMode>444</fileMode>
</file>
</files>
</inline>
</assembly>
<labels>
<!-- https://github.com/opencontainers/image-spec/blob/main/annotations.md -->
<org.opencontainers.image.title>${project.name}</org.opencontainers.image.title>
<org.opencontainers.image.description>${project.description}</org.opencontainers.image.description>
<org.opencontainers.image.url>${project.url}</org.opencontainers.image.url>
<org.opencontainers.image.source>${project.scm.url}</org.opencontainers.image.source>
<org.opencontainers.image.vendor>${project.organization.name}</org.opencontainers.image.vendor>
<org.opencontainers.image.authors>https://github.com/orgs/kokuwaio/people</org.opencontainers.image.authors>
<org.opencontainers.image.licenses>${project.licenses[0].name}</org.opencontainers.image.licenses>
<org.opencontainers.image.version>${project.version}</org.opencontainers.image.version>
<org.opencontainers.image.base.name>docker.io/library/busybox:1.37.0-uclibc</org.opencontainers.image.base.name>
<org.opencontainers.image.base.digest>sha256:cc57e0ff4b6d3138931ff5c7180d18078813300e2508a25fb767a4d36df30d4d</org.opencontainers.image.base.digest>
</labels>
</build>
</image>
<image>
<name>ghcr.io/kokuwaio/keycloak-event-metrics:${project.version}</name>
<build>
<from>docker.io/library/busybox:1.37.0-uclibc@sha256:cc57e0ff4b6d3138931ff5c7180d18078813300e2508a25fb767a4d36df30d4d</from>
<assembly>
<basedir>${file.separator}</basedir>
<inline>
<files>
<file>
<source>${project.build.directory}/${project.build.finalName}.jar</source>
<destName>${project.artifactId}.jar</destName>
<fileMode>444</fileMode>
</file>
</files>
</inline>
</assembly>
<labels>
<!-- https://github.com/opencontainers/image-spec/blob/main/annotations.md -->
<org.opencontainers.image.title>${project.name}</org.opencontainers.image.title>
<org.opencontainers.image.description>${project.description}</org.opencontainers.image.description>
<org.opencontainers.image.url>${project.url}</org.opencontainers.image.url>
<org.opencontainers.image.source>${project.scm.url}</org.opencontainers.image.source>
<org.opencontainers.image.vendor>${project.organization.name}</org.opencontainers.image.vendor>
<org.opencontainers.image.authors>https://github.com/orgs/kokuwaio/people</org.opencontainers.image.authors>
<org.opencontainers.image.licenses>${project.licenses[0].name}</org.opencontainers.image.licenses>
<org.opencontainers.image.version>${project.version}</org.opencontainers.image.version>
<org.opencontainers.image.base.name>docker.io/library/busybox:1.37.0-uclibc</org.opencontainers.image.base.name>
<org.opencontainers.image.base.digest>sha256:cc57e0ff4b6d3138931ff5c7180d18078813300e2508a25fb767a4d36df30d4d</org.opencontainers.image.base.digest>
</labels>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<!-- sign before upload --> <!-- sign before upload -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -628,22 +474,30 @@
<goals> <goals>
<goal>sign</goal> <goal>sign</goal>
</goals> </goals>
<configuration>
<signer>bc</signer>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- autoclose sonatype nexus repo --> </plugins>
<plugin> </build>
<groupId>org.sonatype.plugins</groupId> </profile>
<artifactId>nexus-staging-maven-plugin</artifactId> <profile>
<extensions>true</extensions> <id>release</id>
<configuration> <build>
<serverId>sonatype-nexus</serverId> <plugins>
<nexusUrl>https://oss.sonatype.org/</nexusUrl> <plugin>
<autoReleaseAfterClose>true</autoReleaseAfterClose> <groupId>org.sonatype.central</groupId>
</configuration> <artifactId>central-publishing-maven-plugin</artifactId>
</plugin> <extensions>true</extensions>
<configuration>
<publishingServerId>sonatype.org</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>

4
renovate.json Normal file
View file

@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>infrastructure/renovate-config", ":reviewer(stephan.schnabel)"]
}

View file

@ -50,28 +50,29 @@ public class KeycloakExtension implements BeforeAllCallback, ParameterResolver {
var jar = properties.getProperty("jar"); var jar = properties.getProperty("jar");
var timeout = properties.getProperty("timeout"); var timeout = properties.getProperty("timeout");
// create and start container // create and start container - use fixed port in ci
@SuppressWarnings({ "resource", "deprecation" }) @SuppressWarnings({ "resource", "deprecation" })
var container = (System.getenv("CI") == null var container = (System.getenv("CI") == null
? new GenericContainer<>(image).withExposedPorts(8080) ? new GenericContainer<>(image).withExposedPorts(8080)
: new FixedHostPortGenericContainer<>(image).withFixedExposedPort(8080, 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");
try { 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) { } catch (RuntimeException e) {
throw new Exception("Failed to start keycloak", e); throw new Exception("Failed to start keycloak", e);
} }