Migrate to kokuwa parent

This commit is contained in:
Stephan Schnabel 2023-07-03 09:50:21 +02:00
parent 29b573f2f7
commit a3784fe1f5
Signed by: stephan.schnabel
GPG key ID: E07AF5BA239FE543
12 changed files with 193 additions and 414 deletions

2
.github/CODEOWNERS vendored
View file

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

View file

@ -2,21 +2,13 @@ version: 2
updates:
- package-ecosystem: maven
directory: /
open-pull-requests-limit: 20
schedule:
interval: monthly
day: monday
# github parses time without quotes to int
# yamllint disable-line rule:quoted-strings
time: "09:00"
timezone: Europe/Berlin
interval: daily
allow:
- dependency-name: io.kokuwa.maven:maven-parent
- dependency-name: org.keycloak:keycloak-quarkus-server
- package-ecosystem: github-actions
directory: /
open-pull-requests-limit: 10
schedule:
interval: monthly
day: monday
# github parses time without quotes to int
# yamllint disable-line rule:quoted-strings
time: "09:00"
timezone: Europe/Berlin

16
.github/settings.xml vendored Normal file
View file

@ -0,0 +1,16 @@
<?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>

31
.github/workflows/build.yaml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Build
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
env:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress --settings=.github/settings.xml
steps:
- 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@v3
with:
token: ${{ secrets.GIT_ACTION_TOKEN }}
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn $MAVEN_ARGS dependency:go-offline
- run: mvn $MAVEN_ARGS deploy
env:
SERVER_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SERVER_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
- run: mvn $MAVEN_ARGS site-deploy
env:
GIT_ACTION_TOKEN: ${{ secrets.GIT_ACTION_TOKEN }}

View file

@ -1,87 +0,0 @@
name: CI
on:
push:
branches: [main]
pull_request: {}
jobs:
yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ibiqlik/action-yamllint@v3
with:
format: colored
strict: true
markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: avto-dev/markdown-lint@v1
with:
args: /github/workspace
javadoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn -B -ntp javadoc:javadoc-no-fork -Ddoclint=all
checkstyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn -B -ntp checkstyle:check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: maven
server-id: sonatype-nexus
server-username: SERVER_USERNAME
server-password: SERVER_PASSWORD
- run: mvn -B -ntp verify -Dcheckstyle.skip -Dmaven.test.redirectTestOutputToFile=false
if: ${{ github.ref != 'refs/heads/main' }}
- run: mvn -B -ntp deploy -Dcheckstyle.skip -Dmaven.test.redirectTestOutputToFile=false
if: ${{ github.ref == 'refs/heads/main' }}
env:
SERVER_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SERVER_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 21.0.0
- 21.0.1
- 21.0.2
- 21.1.0
- 21.1.1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn -B -ntp verify -Dcheckstyle.skip -Dmaven.test.redirectTestOutputToFile=false -Dversion.org.keycloak=${{ matrix.version }}

View file

@ -1,17 +0,0 @@
name: Dependabot
on: pull_request_target
jobs:
auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GIT_ACTION_TOKEN }}
- run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GIT_ACTION_TOKEN }}

59
.github/workflows/pr.yaml vendored Normal file
View file

@ -0,0 +1,59 @@
name: PullRequest
on: pull_request
env:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress -Dmaven.test.redirectTestOutputToFile=false
jobs:
yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ibiqlik/action-yamllint@v3
with:
format: colored
strict: true
markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: avto-dev/markdown-lint@v1
with:
args: /github/workspace
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn $MAVEN_ARGS dependency:go-offline
- run: mvn $MAVEN_ARGS verify
- run: mvn $MAVEN_ARGS site
- uses: actions/upload-artifact@v3
if: always()
with:
path: target/site
versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 21.0.2
- 21.1.1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: maven
- run: mvn $MAVEN_ARGS verify -Dcheck.skip -Dversion.org.keycloak=${{ matrix.version }}

View file

@ -5,7 +5,11 @@ on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
env:
MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress --settings=.github/settings.xml
steps:
- 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@v3
with:
token: ${{ secrets.GIT_ACTION_TOKEN }}
@ -25,9 +29,11 @@ jobs:
server-password: SERVER_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- run: mvn -B -ntp release:prepare
- run: mvn -B -ntp release:perform
- run: mvn $MAVEN_ARGS dependency:go-offline
- 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 }}

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
# do not include developer stuff here, use `git config --global core.excludesFile ~/.gitignore` for your setup
target
pom.xml.releaseBackup
release.properties

View file

@ -1,10 +1,10 @@
# Keycloak Metrics
Provides metrics for Keycloak user/admin events and user/client/session count. Tested on Keycloak [20-21](.github/workflows/ci.yaml#L74-L77).
Provides metrics for Keycloak user/admin events and user/client/session count. Tested on Keycloak [21](.github/workflows/pr.yaml#L49-L51).
[![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/keycloak-event-metrics.svg?label=Maven%20Central)](https://central.sonatype.com/search?namespace=io.kokuwa.keycloak&q=keycloak-event-metrics)
[![CI](https://img.shields.io/github/actions/workflow/status/kokuwaio/keycloak-event-metrics/ci.yaml?branch=main&label=CI)](https://github.com/kokuwaio/keycloak-event-metrics/actions/workflows/ci.yaml?query=branch%3Amain)
[![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)
## Why?

350
pom.xml
View file

@ -2,6 +2,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.kokuwa.maven</groupId>
<artifactId>maven-parent</artifactId>
<version>0.6.10</version>
<relativePath/>
</parent>
<groupId>io.kokuwa.keycloak</groupId>
<artifactId>keycloak-event-metrics</artifactId>
<version>1.0.1-SNAPSHOT</version>
@ -16,19 +23,21 @@
</organization>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<name>Apache-2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>stephanschnabel</id>
<id>sschnabe</id>
<name>Stephan Schnabel</name>
<url>https://github.com/sschnabe</url>
<email>stephan@grayc.de</email>
<organization>GrayC GmbH</organization>
<organizationUrl>https://grayc.de</organizationUrl>
<timezone>Europe/Berlin</timezone>
</developer>
</developers>
@ -46,16 +55,6 @@
<system>github</system>
<url>https://github.com/kokuwaio/keycloak-event-metrics/actions</url>
</ciManagement>
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>
<properties>
@ -63,73 +62,27 @@
<!-- =============================== Build =============================== -->
<!-- ===================================================================== -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<maven.compiler.showWarnings>true</maven.compiler.showWarnings>
<maven.compiler.failOnWarning>true</maven.compiler.failOnWarning>
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
<!-- ===================================================================== -->
<!-- ============================== Libaries ============================= -->
<!-- ===================================================================== -->
<!-- plugins -->
<version.org.apache.maven.plugins.checkstyle>3.2.2</version.org.apache.maven.plugins.checkstyle>
<version.org.apache.maven.plugins.clean>3.2.0</version.org.apache.maven.plugins.clean>
<version.org.apache.maven.plugins.compiler>3.11.0</version.org.apache.maven.plugins.compiler>
<version.org.apache.maven.plugins.dependency>3.5.0</version.org.apache.maven.plugins.dependency>
<version.org.apache.maven.plugins.deploy>3.1.1</version.org.apache.maven.plugins.deploy>
<version.org.apache.maven.plugins.gpg>3.0.1</version.org.apache.maven.plugins.gpg>
<version.org.apache.maven.plugins.install>3.1.1</version.org.apache.maven.plugins.install>
<version.org.apache.maven.plugins.jar>3.3.0</version.org.apache.maven.plugins.jar>
<version.org.apache.maven.plugins.javadoc>1.0.0</version.org.apache.maven.plugins.javadoc>
<version.org.apache.maven.plugins.release>3.0.0</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.source>3.2.1</version.org.apache.maven.plugins.source>
<version.org.apache.maven.plugins.surefire>3.0.0</version.org.apache.maven.plugins.surefire>
<version.org.codehaus.mojo.tidy>1.2.0</version.org.codehaus.mojo.tidy>
<version.org.sonatype.plugins.nexus-staging>1.6.13</version.org.sonatype.plugins.nexus-staging>
<version.com.puppycrawl.tools.checkstyle>10.10.0</version.com.puppycrawl.tools.checkstyle>
<version.io.kokuwa.checkstyle>0.5.6</version.io.kokuwa.checkstyle>
<!-- dependencies -->
<version.org.keycloak>21.1.1</version.org.keycloak>
<version.org.mockito>5.3.1</version.org.mockito>
<version.org.testcontainers>1.18.0</version.org.testcontainers>
<version.org.testcontainers>1.18.3</version.org.testcontainers>
</properties>
<dependencyManagement>
<dependencies>
<!-- keycloak -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-parent</artifactId>
<artifactId>keycloak-quarkus-server</artifactId>
<version>${version.org.keycloak}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- test -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${version.org.mockito}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${version.org.testcontainers}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
@ -152,27 +105,61 @@
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-quarkus-server</artifactId>
<scope>provided</scope>
<artifactId>keycloak-admin-client</artifactId>
<scope>test</scope>
<exclusions>
<exclusion><!-- references ancient `commons-io` -->
<groupId>com.openshift</groupId>
<artifactId>openshift-restclient-java</artifactId>
</exclusion>
<exclusion><!-- https://github.com/keycloak/keycloak/issues/19850 -->
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-ui</artifactId>
<exclusion>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</exclusion>
<exclusion>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-account-ui</artifactId>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- libraries -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
</exclusion>
<exclusion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml</groupId>
<artifactId>classmate</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<scope>test</scope>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- test -->
@ -183,13 +170,7 @@
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency><!-- is missing and necessary for `keycloak-admin-client` -->
<groupId>org.wildfly.client</groupId>
<artifactId>wildfly-client-config</artifactId>
<version>1.0.1.Final</version>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
@ -202,151 +183,8 @@
<filtering>true</filtering>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${version.org.apache.maven.plugins.checkstyle}</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppression.xml</suppressionsLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${version.com.puppycrawl.tools.checkstyle}</version>
</dependency>
<dependency>
<groupId>io.kokuwa</groupId>
<artifactId>maven-parent</artifactId>
<version>${version.io.kokuwa.checkstyle}</version>
<type>zip</type>
<classifier>checkstyle</classifier>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${version.org.apache.maven.plugins.clean}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.org.apache.maven.plugins.compiler}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${version.org.apache.maven.plugins.dependency}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${version.org.apache.maven.plugins.deploy}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.org.apache.maven.plugins.surefire}</version>
<configuration>
<failIfNoTests>true</failIfNoTests>
<redirectTestOutputToFile>${maven.test.redirectTestOutputToFile}</redirectTestOutputToFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${version.org.apache.maven.plugins.gpg}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${version.org.apache.maven.plugins.install}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${version.org.apache.maven.plugins.jar}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${version.org.apache.maven.plugins.jar}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${version.org.apache.maven.plugins.release}</version>
<configuration>
<tagNameFormat>@{project.version}</tagNameFormat>
<releaseProfiles>release</releaseProfiles>
<localCheckout>true</localCheckout>
<signTag>true</signTag>
<scmReleaseCommitComment>@{prefix} prepare release @{releaseLabel} [no ci]</scmReleaseCommitComment>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${version.org.apache.maven.plugins.source}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.org.apache.maven.plugins.resources}</version>
<configuration>
<propertiesEncoding>UTF-8</propertiesEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.org.apache.maven.plugins.surefire}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tidy-maven-plugin</artifactId>
<version>${version.org.codehaus.mojo.tidy}</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${version.org.sonatype.plugins.nexus-staging}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- fail if any pom is dirty -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tidy-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- fail if checkstyle reports problems -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- run tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -363,66 +201,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<!-- add source for downstream projects -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- add javadoc for downstream projects -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- sign documents before upload -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- autoclose sonatype nexus repo -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -41,12 +41,11 @@ public class MetricsStatsTask implements Provider, ScheduledTask {
try {
scrape(session);
} catch (org.hibernate.exception.SQLGrammarException e) {
log.infov("Metrics status task skipped, database not ready.");
return;
} catch (Exception e) {
if (e instanceof org.hibernate.exception.SQLGrammarException) {
log.infov("Metrics status task skipped, database not ready.");
} else {
log.errorv(e, "Failed to scrape stats.");
}
log.errorv(e, "Failed to scrape stats.");
return;
}
@ -67,6 +66,7 @@ public class MetricsStatsTask implements Provider, ScheduledTask {
private void scrape(KeycloakSession session) {
session.realms().getRealmsStream().forEach(realm -> {
log.tracev("Scrape for realm {0}.", realm.getName());
var tagRealm = Tag.of("realm", realm.getName());
gauge("keycloak_users", Set.of(tagRealm), session.users().getUsersCount(realm), true);
gauge("keycloak_clients", Set.of(tagRealm), session.clients().getClientsCount(realm), true);