Skip to content
Draft
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
40 changes: 15 additions & 25 deletions .github/workflows/roundtrip/config-demo-idp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,22 @@

set -x

: "${KC_VERSION:=24.0.3}"
APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"

if ! which kcadm.sh; then
KCADM_URL=https://github.com/keycloak/keycloak/releases/download/${KC_VERSION}/keycloak-${KC_VERSION}.zip
echo "DOWNLOADING ${KCADM_URL}"
if ! curl --output kc.zip --fail --location "${KCADM_URL}"; then
echo "[ERROR] Failed to download ${KCADM_URL}"
exit 3
fi
ls -l
if ! unzip ./kc.zip; then
echo "[ERROR] Failed to unzip file from ${KCADM_URL}"
exit 3
fi
ls -l
ls -l "$(pwd)/keycloak-${KC_VERSION}/bin"
PATH=$PATH:"$(pwd)/keycloak-${KC_VERSION}/bin"
export PATH
if ! which kcadm.sh; then
echo "[ERROR] Failed to find kcadm.sh"
exit 3
fi
fi
# Run kcadm inside the keycloak container instead of downloading the release
# zip. The container ships a JRE matching its own Keycloak version; the host
# does not necessarily -- Keycloak 26's kcadm needs Java 17, while the
# ubuntu-22.04 runner defaults to Java 11 (UnsupportedClassVersionError).
# Using -f makes the compose project resolve from this script's directory, so
# the caller's working directory doesn't matter.
kcadm.sh() {
docker compose -f "${APP_DIR}/docker-compose.yaml" \
exec -T keycloak /opt/keycloak/bin/kcadm.sh "$@"
}

kcadm.sh config credentials --server http://localhost:65432/auth \
# Inside the container Keycloak is reached on its own KC_HTTP_PORT, not through
# the vite dev-server proxy on 65432 that host-side callers use.
kcadm.sh config credentials --server http://localhost:8888/auth \
--realm master --user admin --password changeme

kcadm.sh create clients -r opentdf \
Expand All @@ -39,8 +30,7 @@ kcadm.sh create clients -r opentdf \
-s serviceAccountsEnabled=false \
-s publicClient=true \
-s protocol=openid-connect \
-s 'protocolMappers=[{"name":"aud","protocol":"openid-connect","protocolMapper":"oidc-audience-mapper","consentRequired":false,"config":{"access.token.claim":"true","included.custom.audience":"http://localhost:65432"}}]' \
-s 'attributes={"dpop.bound.access.tokens":"true"}'
-s 'protocolMappers=[{"name":"aud","protocol":"openid-connect","protocolMapper":"oidc-audience-mapper","consentRequired":false,"config":{"access.token.claim":"true","included.custom.audience":"http://localhost:65432"}}]'

kcadm.sh create clients -r opentdf \
-s clientId=testclient \
Expand Down
25 changes: 3 additions & 22 deletions .github/workflows/roundtrip/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
services:
keycloak:
image: keycloak/keycloak:24.0.5
image: keycloak/keycloak:26.2
restart: always
command:
- "start-dev"
- "--verbose"
environment:
KC_DB_VENDOR: postgres
KC_DB_URL_HOST: keycloakdb
KC_DB_URL_PORT: 5432
KC_DB_URL_DATABASE: keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: changeme
KC_FEATURES: 'preview,token-exchange'
KC_FEATURES: "preview,token-exchange,admin-fine-grained-authz:v1"
KC_HEALTH_ENABLED: 'true'
KC_HOSTNAME_ADMIN_URL: 'http://localhost:65432/auth'
KC_HOSTNAME_PORT: '65432'
Expand All @@ -29,24 +23,11 @@ services:
ports:
- '8888:8888'
healthcheck:
test: ['CMD-SHELL', '[ -f /tmp/HealthCheck.java ] || echo "public class HealthCheck { public static void main(String[] args) throws java.lang.Throwable { System.exit(java.net.HttpURLConnection.HTTP_OK == ((java.net.HttpURLConnection)new java.net.URL(args[0]).openConnection()).getResponseCode() ? 0 : 1); } }" > /tmp/HealthCheck.java && java /tmp/HealthCheck.java http://localhost:8888/auth/health/live']
test: ['CMD-SHELL', '[ -f /tmp/HealthCheck.java ] || echo "public class HealthCheck { public static void main(String[] args) throws java.lang.Throwable { System.exit(java.net.HttpURLConnection.HTTP_OK == ((java.net.HttpURLConnection)new java.net.URL(args[0]).openConnection()).getResponseCode() ? 0 : 1); } }" > /tmp/HealthCheck.java && java /tmp/HealthCheck.java http://localhost:9000/auth/health/live']
interval: 5s
timeout: 10s
retries: 3
start_period: 2m
keycloakdb:
image: postgres:15-alpine
restart: always
user: postgres
environment:
POSTGRES_PASSWORD: changeme
POSTGRES_USER: postgres
POSTGRES_DB: keycloak
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 5s
timeout: 5s
retries: 10
opentdfdb:
image: postgres:15-alpine
restart: always
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/roundtrip/wait-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ _init_platform() {
return 1
fi
if ! ./config-demo-idp.sh; then
echo "[ERROR] unable to provision keycloak"
echo "[ERROR] unable to configure demo idp clients"
return 1
fi
if ! ./init-temp-keys.sh; then
Expand Down