wait-for-hydra: add SSE support for real-time Hydra status#41
Merged
Conversation
c850034 to
8fb6452
Compare
When `hydra-status-url` is provided, the action connects to the hydra-github-bridge SSE endpoint for real-time build status updates instead of polling the GitHub API. This dramatically reduces latency from minutes (poll interval) to seconds (event-driven). SSE mode features: - One-shot check on cached status before opening the stream - Event filtering by check-run name (ignores unrelated jobs) - Process substitution to avoid subshell exit trap - read -t 60 to enforce timeout during idle streams - Periodic re-checks every 120s as CDN buffering safety net - Graceful fallback to poll mode on connection failure Without `hydra-status-url`, the action behaves exactly as before (pure GitHub API polling with exponential backoff). Copyright (c) Moritz Angermann <moritz.angermann@iohk.io>, Input Output Group. SPDX-License-Identifier: Apache-2.0
8fb6452 to
67492d0
Compare
2 tasks
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
Add SSE (Server-Sent Events) support to the
wait-for-hydraaction for real-time build status from hydra-github-bridge. Whenhydra-status-urlis provided, the action connects to the bridge's SSE endpoint instead of polling the GitHub API — reducing detection latency from minutes (poll interval) to seconds (event-driven).Without
hydra-status-url, the action behaves exactly as before (GitHub API polling with exponential backoff).New input
hydra-status-url''https://ci.zw3rk.com). Enables SSE mode when set.How SSE mode works
/status/{owner}/{repo}/{sha}) to see if the build already finished/status/{owner}/{repo}/{sha}/eventsand filters for events matching the requested check-run nameread -t 60prevents indefinite blocking on idle streams so the global timeout is always respectedOther improvements in this PR
poll_github()now shows the full jq query (copy-pasteable for local debugging) and goes to stderr so it doesn't contaminateconclusion=$(poll_github)capturepoll_wait()function for reuse as SSE fallbackclassify_status()helper centralizes success/failure classificationUsage
Test plan
hydra-status-url, action behaves identically to before