Skip to content

Commit 2f36459

Browse files
chore(deps): update all non-major keycloak (#548)
* chore(deps): update all non-major keycloak | datasource | package | from | to | | ---------- | ----------------------------------------- | ------------------- | ------------------- | | docker | quay.io/keycloak/keycloak | 26.5.7 | 26.6.0 | | docker | registry.camunda.cloud/vendor-ee/keycloak | 26.5.7-debian-12-r0 | 26.6.0-debian-12-r0 | * fix: improve retries * try with bash * fix * fix: escape $port in healthcheck and fix compose v2 detection - docker-compose.quay.yml: escape $port as $$port to prevent docker compose from interpolating the bash variable as an empty env var - docker-compose.yml: try health endpoint on port 9000 first (KC 25+) then fall back to 8080 for older versions - healthy.sh: use 'command -v' to check for docker-compose before calling it, avoiding 'command not found' errors on ubuntu-24.04 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Leo <[email protected]>
1 parent 93f5f49 commit 2f36459

5 files changed

Lines changed: 62 additions & 26 deletions

File tree

.github/actions/compose/healthy.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
#!/bin/bash
22

3-
# docker compose --> v2 (GA)
4-
# docker-compose --> v1 (missing some newer flags)
5-
# Edge case; Self-hosted runners don't support "docker compose" yet even though on v2
6-
VERSION=$(docker-compose version --short)
7-
8-
if [[ "$VERSION" =~ ^1\.[0-9]+\.[0-9]+ || -z "${VERSION}" ]]; then
9-
# if docker-compose is v1, we're setting it to docker compose, which should be v2
10-
echo "Deteceted v1, setting to v2"
11-
DOCKER_COMMAND="docker compose -f ${FILE} ${COMPOSE_FLAGS}"
3+
# docker compose --> v2 (GA, plugin)
4+
# docker-compose --> v1/v2 (standalone binary, may not be installed)
5+
if command -v docker-compose &>/dev/null; then
6+
VERSION=$(docker-compose version --short 2>/dev/null)
7+
if [[ "$VERSION" =~ ^1\.[0-9]+\.[0-9]+ ]]; then
8+
echo "Detected docker-compose v1, using docker compose (v2 plugin)"
9+
DOCKER_COMMAND="docker compose -f ${FILE} ${COMPOSE_FLAGS}"
10+
else
11+
echo "Detected docker-compose v2"
12+
DOCKER_COMMAND="docker-compose -f ${FILE} ${COMPOSE_FLAGS}"
13+
fi
1214
else
13-
# e.g. locally or on self-hosted runners docker-compose can be v2
14-
echo "Detected v2"
15-
DOCKER_COMMAND="docker-compose -f ${FILE} ${COMPOSE_FLAGS}"
15+
echo "docker-compose not found, using docker compose (v2 plugin)"
16+
DOCKER_COMMAND="docker compose -f ${FILE} ${COMPOSE_FLAGS}"
1617
fi
1718

1819
eval $DOCKER_COMMAND ps

.github/scripts/integration/main.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
1+
import time
12
from keycloak import KeycloakAdmin
23
from keycloak import KeycloakOpenIDConnection
4+
from keycloak.exceptions import KeycloakPostError
5+
6+
max_retries = 30
7+
retry_delay = 5
38

49
print("Connecting to KeyCloak")
5-
keycloak_connection = KeycloakOpenIDConnection(
6-
server_url="http://localhost:8080/",
7-
username='admin',
8-
password='admin',
9-
realm_name="master")
10+
for attempt in range(1, max_retries + 1):
11+
try:
12+
keycloak_connection = KeycloakOpenIDConnection(
13+
server_url="http://localhost:8080/",
14+
username='admin',
15+
password='admin',
16+
realm_name="master")
1017

11-
keycloak_admin = KeycloakAdmin(connection=keycloak_connection)
18+
keycloak_admin = KeycloakAdmin(connection=keycloak_connection)
19+
break
20+
except KeycloakPostError as e:
21+
if "503" in str(e) and attempt < max_retries:
22+
print(f"Keycloak bootstrap in progress (attempt {attempt}/{max_retries}), retrying in {retry_delay}s...")
23+
time.sleep(retry_delay)
24+
else:
25+
raise
26+
except Exception as e:
27+
if attempt < max_retries:
28+
print(f"Connection failed (attempt {attempt}/{max_retries}): {e}, retrying in {retry_delay}s...")
29+
time.sleep(retry_delay)
30+
else:
31+
raise
1232

1333
print("Checking that only 1 user exists")
1434
count_users = keycloak_admin.users_count()

docker-compose.quay.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,22 @@ services:
5454
AWS_WEB_IDENTITY_TOKEN_FILE: ${AWS_WEB_IDENTITY_TOKEN_FILE:-}
5555

5656
healthcheck:
57-
test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/8080' || exit 1
57+
test:
58+
- CMD
59+
- bash
60+
- -c
61+
- >
62+
for port in 9000 8080; do
63+
if exec 3<>/dev/tcp/127.0.0.1/$$port 2>/dev/null; then
64+
echo -e "GET /health/ready HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n" >&3;
65+
timeout 5 cat <&3 | grep -q '200 OK' && exit 0;
66+
fi;
67+
done;
68+
exit 1
5869
interval: 15s
59-
timeout: 5s
60-
retries: 5
70+
timeout: 15s
71+
retries: 15
72+
start_period: 30s
6173
ports:
6274
- 8080:8080
6375
- 9000:9000

docker-compose.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ services:
5757
AWS_WEB_IDENTITY_TOKEN_FILE: ${AWS_WEB_IDENTITY_TOKEN_FILE:-}
5858

5959
healthcheck:
60-
test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/8080' || exit 1
60+
test:
61+
- CMD-SHELL
62+
- curl -fsS http://127.0.0.1:9000/health/ready > /dev/null 2>&1 || curl -fsS http://127.0.0.1:8080/health/ready > /dev/null 2>&1
6163
interval: 15s
62-
timeout: 5s
63-
retries: 5
64+
timeout: 15s
65+
retries: 15
66+
start_period: 30s
6467
ports:
6568
- 8080:8080
6669
depends_on:

keycloak-26/bases.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sources:
1616
# skopeo --override-os linux inspect docker://registry.camunda.cloud/vendor-ee/keycloak:<tag> --raw | jq '.Digest'
1717
image:
1818
repository: registry.camunda.cloud/vendor-ee/keycloak
19-
tag: 26.5.7-debian-12-r0@sha256:350c7c7ee4ef8cafa5cd0b973d15237f62ed4193ee4ec9c3570265583c5f67fa
19+
tag: 26.6.0-debian-12-r0@sha256:eb5b4fe7b1ae306322c75e4a72229bb8067f8b1cb48454225af27fc2a684fe60
2020

2121
quay:
2222
# List of all available images with associated sha:
@@ -25,4 +25,4 @@ sources:
2525
# skopeo --override-os linux inspect docker://quay.io/keycloak/keycloak:<tag> --raw | jq '.Digest'
2626
image:
2727
repository: quay.io/keycloak/keycloak
28-
tag: 26.5.7@sha256:45ae20191531eb608ddb0b775d012b40d3e4f942697f3214694887dd7c108d13
28+
tag: 26.6.0@sha256:b0e5dbced1775de4d629f103c0a9cfc057decc62ce8d3cb1c54f8849a6c6eb62

0 commit comments

Comments
 (0)