Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Keycloak 22 #898

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Used in docker-compose
# shellcheck disable=SC2034
KEYCLOAK_VERSION=21.1.1
KEYCLOAK_VERSION=22.0.0
28 changes: 24 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ jobs:
fail-fast: false
matrix:
env:
# we keep 18.0.2 for backwards compatibility with RH-SSO 7.6
- KEYCLOAK_VERSION: 18.0.2
thomasdarimont marked this conversation as resolved.
Show resolved Hide resolved
- KEYCLOAK_VERSION: 19.0.3
- KEYCLOAK_VERSION: 20.0.5
- KEYCLOAK_VERSION: 21.1.1
- KEYCLOAK_VERSION: 22.0.0
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -48,8 +50,14 @@ jobs:
key: ${{ runner.os }}-maven-${{ matrix.env.KEYCLOAK_VERSION }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-${{ matrix.env.KEYCLOAK_VERSION }}

- name: Adapt sources for Keycloak versions < 22.0.0 (jakarta -> javax)
if: ${{ matrix.env.KEYCLOAK_VERSION < '22.0.0' }}
run: |
echo "JAVAX_PROFILE=-Pjavax" >> $GITHUB_ENV
echo "ADJUSTED_RESTEASY_VERSION=-Dresteasy.version=4.7.7.Final" >> $GITHUB_ENV

- name: Build & Test
run: ./mvnw ${MAVEN_CLI_OPTS} -Dkeycloak.version=${{ matrix.env.KEYCLOAK_VERSION }} clean verify -Pcoverage
run: ./mvnw ${MAVEN_CLI_OPTS} -Dkeycloak.version=${{ matrix.env.KEYCLOAK_VERSION }} ${ADJUSTED_RESTEASY_VERSION} clean verify -Pcoverage ${JAVAX_PROFILE}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down Expand Up @@ -106,7 +114,7 @@ jobs:
with:
build-args: |-
KEYCLOAK_VERSION=${{ matrix.env.KEYCLOAK_VERSION }}
MAVEN_CLI_OPTS=${{ env.MAVEN_CLI_OPTS }}
MAVEN_CLI_OPTS=${{ env.MAVEN_CLI_OPTS }} ${{ env.ADJUSTED_RESTEASY_VERSION }} ${{ env.JAVAX_PROFILE }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
Expand Down Expand Up @@ -151,8 +159,14 @@ jobs:
key: ${{ runner.os }}-${{ matrix.java }}-maven-build-pom-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ matrix.java }}-maven-build-pom

- name: Adapt sources for Keycloak versions < 22.0.0 (jakarta -> javax)
if: ${{ matrix.env.KEYCLOAK_VERSION < '22.0.0' }}
run: |
echo "JAVAX_PROFILE=-Pjavax" >> $GITHUB_ENV
echo "ADJUSTED_RESTEASY_VERSION=-Dresteasy.version=4.7.7.Final" >> $GITHUB_ENV

- name: Build & Test
run: ./mvnw ${MAVEN_CLI_OPTS} clean verify
run: ./mvnw ${MAVEN_CLI_OPTS} ${ADJUSTED_RESTEASY_VERSION} clean verify ${JAVAX_PROFILE}

build-legacy:
runs-on: ubuntu-latest
Expand All @@ -178,8 +192,14 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-keycloak-legacy

- name: Adapt sources for Keycloak versions < 22.0.0 (jakarta -> javax)
if: ${{ matrix.env.KEYCLOAK_VERSION < '22.0.0' }}
run: |
echo "JAVAX_PROFILE=-Pjavax" >> $GITHUB_ENV
echo "ADJUSTED_RESTEASY_VERSION=-Dresteasy.version=4.7.7.Final" >> $GITHUB_ENV

- name: Build & Test
run: ./mvnw ${MAVEN_CLI_OPTS} -Dkeycloak.version=${{ matrix.env.KEYCLOAK_VERSION }} -Dkeycloak.dockerTagSuffix="" clean verify
run: ./mvnw ${MAVEN_CLI_OPTS} -Dkeycloak.version=${{ matrix.env.KEYCLOAK_VERSION }} -Dkeycloak.dockerTagSuffix="" ${ADJUSTED_RESTEASY_VERSION} clean verify ${JAVAX_PROFILE}

lint-other-files:
runs-on: ubuntu-latest
Expand Down
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Added
- Support for Keycloak 22

### Changed
- Migrated from Java EE to Jakarta EE
- Migrated imports of javax packages to jakarta packages
- Upgraded Spring Boot to 2.7.13

## [5.7.0] - 2023-07-14

### Changed
Expand Down Expand Up @@ -690,8 +698,7 @@ A lot of import properties are added over the years. this major release of keycl

<!-- @formatter:off -->

[Unreleased]: https://github.com/adorsys/keycloak-config-cli/compare/v5.7.0...HEAD
[5.7.0]: https://github.com/adorsys/keycloak-config-cli/compare/v5.6.1...v5.7.0
[Unreleased]: https://github.com/adorsys/keycloak-config-cli/compare/v5.6.1...HEAD
[5.6.1]: https://github.com/adorsys/keycloak-config-cli/compare/v5.6.0...v5.6.1
[5.6.0]: https://github.com/adorsys/keycloak-config-cli/compare/v5.5.0...v5.6.0
[5.5.0]: https://github.com/adorsys/keycloak-config-cli/compare/v5.4.0...v5.5.0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM ${BUILDER_IMAGE} AS BUILDER

WORKDIR /app/

ARG KEYCLOAK_VERSION=21.1.1
ARG KEYCLOAK_VERSION=22.0.0
ARG MAVEN_CLI_OPTS="-ntp -B"

COPY .mvn .mvn
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ See: [docs/FEATURES.md](./docs/FEATURES.md)
# Compatibility with keycloak

Since keycloak-config-cli 4.0 will support the latest 4 releases of keycloak, if possible.
There are some exceptions:

There are some exceptions, for example if keycloak introduce some backward compatible changes, keycloak-config-cli will cut the support, too.

- keycloak-config-cli will try the keep an extended support for [RH-SSO](https://access.redhat.com/articles/2342881)
- keycloak-config-cli will cut the support if keycloak introduces some breaking changes

# Build this project

Expand Down Expand Up @@ -155,7 +156,7 @@ Additionally, the tag `maven` contains the source code and compile keycloak-conf
Keycloak versions, that not official supported., e.g.:

```bash
docker run --rm -ti -v $PWD:/config/ -eKEYCLOAK_VERSION=17.0.0 -eMAVEN_CLI_OPTS="-B -ntp -q" adorsys/keycloak-config-cli:edge-build
docker run --rm -ti -v $PWD:/config/ -eKEYCLOAK_VERSION=22.0.0 -eMAVEN_CLI_OPTS="-B -ntp -q" adorsys/keycloak-config-cli:edge-build
```

### Docker run
Expand Down
4 changes: 3 additions & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="standardPackageRegExp" value="^(java|javax)\."/>
<property name="specialImportsRegExp" value="^(jakarta)\."/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###STATIC"/>
<property name="customImportOrderRules" value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
</module>
<module name="MethodParamPad">
Expand Down
105 changes: 99 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.12</version>
<version>2.7.13</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -59,7 +59,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<keycloak.version>21.1.1</keycloak.version>
<keycloak.version>22.0.0</keycloak.version>

<checkstyle-plugin.version>3.2.0</checkstyle-plugin.version>
<checkstyle.version>10.0</checkstyle.version>
Expand All @@ -84,7 +84,13 @@
<pmd-plugin.version>3.21.0</pmd-plugin.version>
<pmd.version>6.55.0</pmd.version>
<reproducible-build-maven-plugin.version>0.15</reproducible-build-maven-plugin.version>
<resteasy.version>5.0.4.Final</resteasy.version>
<resteasy.version>6.2.4.Final</resteasy.version>
<snakeyaml.version>2.0</snakeyaml.version>
<jakarta.ws.rs-api.version>3.1.0</jakarta.ws.rs-api.version>
<jakarta.activation.version>2.1.2</jakarta.activation.version>
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
<jakarta.mail.version>2.1.2</jakarta.mail.version>
<spring-security-crypto.version>5.8.4</spring-security-crypto.version>
<spotbugs-plugin.version>4.7.3.5</spotbugs-plugin.version>
<spotbugs.version>4.7.3</spotbugs.version>
<testcontainers.version>1.18.3</testcontainers.version>
Expand Down Expand Up @@ -161,6 +167,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -177,7 +189,7 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
<version>5.8.3</version>
<version>${spring-security-crypto.version}</version>
</dependency>

<dependency>
Expand All @@ -194,7 +206,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>
<version>${snakeyaml.version}</version>
</dependency>

<dependency>
Expand All @@ -205,6 +217,53 @@
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
</exclusion>

<exclusion>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>${jakarta.ws.rs-api.version}</version>
</dependency>

<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>${jakarta.activation.version}</version>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta.annotation.version}</version>
</dependency>

<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>${jakarta.mail.version}</version>
<exclusions>
<exclusion>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -571,7 +630,6 @@
<configuration>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>false</consoleOutput>
<encoding>${project.reporting.outputEncoding}</encoding>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
Expand Down Expand Up @@ -633,6 +691,41 @@
</build>

<profiles>
<profile>
<id>javax</id>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed after the jakarta migration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see ci.yml in order to replace the "jakarta" imports "back" to "javax" in order to be able to build the keycloak-config-cli versions for Keycloak versions < 22.0.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks I didn't get the link. Now it's clear.

<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>${maven-replacer.version}</version>
<executions>
<execution>
<id>replace-import-javax-by-jakarta</id>
<phase>generate-sources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<basedir>
${project.basedir}/src
</basedir>
<includes>
<include>**/*.java</include>
</includes>
<replacements>
<replacement>
<token>import jakarta</token>
<value>import javax</value>
</replacement>
</replacements>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>coverage</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
import java.net.URL;
import java.text.MessageFormat;
import java.time.Duration;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.Response;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.Response;

/**
* This class exists because we need to create a single keycloak instance or to close the keycloak before using a new one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.ws.rs.ClientErrorException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;

import jakarta.ws.rs.ClientErrorException;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;

@Service
public class AuthenticationFlowRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;

@Service
public class ClientRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;

@Service
public class ClientScopeRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;

@Service
public class ComponentRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;

@Service
public class ExecutionFlowRepository {
Expand Down
Loading
Loading