fix(demo): resolve dynamic BASE_URL and handle silent curl failures (#87) - #115
Open
HamidKhan1001 wants to merge 1 commit into
Open
Conversation
drasi-project#87) Signed-off-by: hamidkhan1001 <hamidk5002@gmail.com>
HamidKhan1001
requested a deployment
to
tutorial-evaluation
July 23, 2026 07:47 — with
GitHub Actions
Waiting
HamidKhan1001
requested a deployment
to
tutorial-evaluation
July 23, 2026 07:47 — with
GitHub Actions
Waiting
HamidKhan1001
requested a deployment
to
tutorial-evaluation
July 23, 2026 07:47 — with
GitHub Actions
Waiting
HamidKhan1001
requested a deployment
to
tutorial-evaluation
July 23, 2026 07:47 — with
GitHub Actions
Waiting
HamidKhan1001
requested a deployment
to
tutorial-evaluation
July 23, 2026 07:47 — with
GitHub Actions
Waiting
There was a problem hiding this comment.
Pull request overview
This PR fixes local execution of the Dapr demo scripts by dynamically determining the correct Traefik load balancer port (instead of assuming http://localhost) and by making the retry wrapper treat non-2xx/connection-failure responses as failures rather than reporting false successes.
Changes:
- Add a
BASE_URLfallback chain that detects Codespaces vs local k3d and derives the mapped Traefik port via Docker inspection. - Update
execute_with_retry(dashboard + notifications demos) to verify success via extracted HTTP status codes rather than only shell exit codes / output heuristics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tutorial/dapr/demo/demo-notifications-service.sh | Adds dynamic BASE_URL resolution and changes retry logic to validate HTTP status codes. |
| tutorial/dapr/demo/demo-dashboard-service.sh | Adds dynamic BASE_URL resolution and changes retry logic to validate HTTP status codes. |
| tutorial/dapr/demo/demo-catalogue-service.sh | Adds dynamic BASE_URL resolution to work on local k3d port mappings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [ -z "$BASE_URL" ]; then | ||
| if [ -n "$CODESPACES" ]; then | ||
| BASE_URL="http://localhost" | ||
| elif command -v docker >/dev/null 2>&1 && docker inspect k3d-drasi-tutorial-serverlb >/dev/null 2>&1; then |
| BASE_URL="http://localhost" | ||
| elif command -v docker >/dev/null 2>&1 && docker inspect k3d-drasi-tutorial-serverlb >/dev/null 2>&1; then | ||
| PORT=$(docker port k3d-drasi-tutorial-serverlb 80 2>/dev/null | head -n1 | cut -d: -f2) | ||
| if [ -n "$PORT" ]; then |
| if [ -n "$CODESPACES" ]; then | ||
| BASE_URL="http://localhost" | ||
| elif command -v docker >/dev/null 2>&1 && docker inspect k3d-drasi-tutorial-serverlb >/dev/null 2>&1; then | ||
| PORT=$(docker port k3d-drasi-tutorial-serverlb 80 2>/dev/null | head -n1 | cut -d: -f2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes demo script execution failures on local k3d clusters where Traefik port mapping differs from Codespaces default port bindings. Also standardizes
curlretry behavior to catch connection failures (HTTP 000) and non-2xx responses instead of reporting false successes.Changes
BASE_URLResolution: Implemented a fallback chain (ENV->Codespaces->docker port k3d-drasi-tutorial-serverlb 80-> defaulthttp://localhost:8123) acrossdemo-catalogue-service.sh,demo-dashboard-service.sh, anddemo-notifications-service.sh.execute_with_retryindemo-dashboard-service.shanddemo-notifications-service.shto extract the HTTP status code usingcurl -w "\n%{http_code}". Non-2xx responses and000status codes are now correctly identified as retriable errors.Fixes #87