Skip to content

Fix host-mode harness gaps that block Keycloak 26.7 testing - #1042

Closed
mbunwe-victor wants to merge 6 commits into
mainfrom
fix/host-mode-harness-1038
Closed

mbunwe-victor wants to merge 6 commits into
mainfrom
fix/host-mode-harness-1038

Conversation

@mbunwe-victor

@mbunwe-victor mbunwe-victor commented Jul 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #1038.

Host-mode testing (keycloak-ssi setup -d on the host, then config / test via the CLI container) was unreliable on Keycloak 26.7/main. This PR tightens the oid4vci-deployment harness so the documented path works without manual workarounds.

Harness fixes

  • Replace broad pgrep -f keycloak with targeted PID detection (kc.sh, quarkus-run.jar, org.keycloak) and filter out harness scripts
  • Use HTTP reachability (ensure_keycloak_reachable) for config / test instead of local process checks, so the CLI container can talk to a host-started Keycloak
  • Rebuild KEYCLOAK_FEATURES on each config load to avoid duplicate feature flags when compose and CLI both load config
  • Pass HOST_WORK_DIR from keycloak-ssi.sh into compose; fail clearly when the CLI container cannot resolve host paths
  • Resolve kcadm via KEYCLOAK_INSTALL_DIR, HOST_WORK_DIR, or WORK_DIR before falling back to the compose app service

26.7 compatibility (needed for the smoke path)

  • Map enable_credential_offer_create to oid4vc-vci-rest-credential-offer
  • Grant demo VCs to Francis during user configuration (non-fatal on older Keycloak)
  • Improve credential-offer error reporting in request_credential.sh

Docs

  • Document bash requirement (export -f; do not source under zsh)
  • Document root-owned target/ after CLI container use and how to fix ownership
  • Document host-mode flow: install → setup -d → config → test preauth

Test plan

  • keycloak-ssi setup -d on Keycloak 26.7.0 (host mode)
  • keycloak-ssi config
  • keycloak-ssi test preauth IdentityCredential
  • keycloak-ssi test authcode IdentityCredential

Signed-off-by: mbunwe-victor <mbunwevicki@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses reliability gaps in the oid4vci-deployment host-mode harness (host-started Keycloak with CLI running in the container) to enable a documented setup -d → config → test flow on Keycloak 26.7/main, and updates docs accordingly.

Changes:

  • Reworks Keycloak detection and readiness checks by introducing HTTP reachability (ensure_keycloak_reachable) and tightening PID matching for stop/start flows.
  • Improves 26.7 compatibility by updating feature flag composition and enhancing user/config/test harness behavior (including better credential-offer diagnostics and demo VC grants).
  • Documents bash-only execution requirements and common host/container operational pitfalls (notably root-owned target/ after CLI container runs).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
oid4vci-deployment/src/utils/helper.sh Tightens Keycloak PID detection, adds HTTP reachability checks, rebuilds feature flags per config load, improves kcadm/truststore resolution.
oid4vci-deployment/src/deployment/2.configure_user_4_account_client.sh Adds demo VC grants for Francis and adjusts role assignment flow.
oid4vci-deployment/src/deployment/1.oid4vci_test_deployment.sh Switches from PID-based “running” checks to HTTP reachability for host-mode compatibility.
oid4vci-deployment/src/credentials/request_credential.sh Improves error reporting and adds a legacy fallback when requesting credential offers.
oid4vci-deployment/Readme.md Documents bash requirement, host-mode flow, and root-owned target/ remediation guidance.
oid4vci-deployment/keycloak-ssi.sh Passes HOST_WORK_DIR into compose CLI runs and uses reachability checks for config/test.
oid4vci-deployment/docker-compose.yml Allows HOST_WORK_DIR to be injected (fallback to ${PWD}) for host-mode path resolution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread oid4vci-deployment/src/utils/helper.sh
Comment thread oid4vci-deployment/src/utils/helper.sh Outdated
Signed-off-by: mbunwe-victor <mbunwevicki@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread oid4vci-deployment/src/utils/helper.sh Outdated
Comment thread oid4vci-deployment/docker-compose.yml Outdated
Signed-off-by: mbunwe-victor <mbunwevicki@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread oid4vci-deployment/src/utils/helper.sh
Comment thread oid4vci-deployment/keycloak-ssi.sh Outdated
Signed-off-by: mbunwe-victor <mbunwevicki@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread oid4vci-deployment/src/credentials/request_credential.sh Outdated
Comment thread oid4vci-deployment/src/utils/helper.sh Outdated
Signed-off-by: mbunwe-victor <mbunwevicki@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread oid4vci-deployment/keycloak-ssi.sh
Signed-off-by: mbunwe-victor <mbunwevicki@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

oid4vci-deployment/keycloak-ssi.sh:155

  • run_in_cli_container_if_needed writes an env file to $WORK_DIR/.env and deletes it before/after the compose run. If a user already has a real project .env in the repo root, this will silently overwrite/delete it. Use a dedicated temporary filename (e.g. via mktemp) and only clean up that generated file.
            local env_file="$WORK_DIR/.env"
            local config_files=("$WORK_DIR/config.yaml")
            local override_file="$WORK_DIR/config.override.yaml"
            [[ -f "$override_file" ]] && config_files+=("$override_file")
            rm -f "$env_file"

@Ogenbertrand
Ogenbertrand requested a review from Awambeng July 16, 2026 09:45

@Awambeng Awambeng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mbunwe-victor could you please close this based on the discussions we had?

@mbunwe-victor

Copy link
Copy Markdown
Collaborator Author

Yes, sure, I will close it since @Vitalisn4 confirmed on his side that it was working

@Awambeng
Awambeng deleted the fix/host-mode-harness-1038 branch July 17, 2026 14:38
@mbunwe-victor
mbunwe-victor restored the fix/host-mode-harness-1038 branch July 17, 2026 14:42
@mbunwe-victor
mbunwe-victor deleted the fix/host-mode-harness-1038 branch July 17, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Place Keycloak keystore under data/<realm> for Keycloak 26.6.4+

3 participants