Repository navigation
Fix false release failures after GitHub API connection errors #908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
636fefa
Distinguish release monitoring errors from workflow failures
kaahos 9e086ec
Merge branch 'main' into paul.fournillon/fix-release-workflow-monitoring
kaahos 6c85605
Bound release monitoring and preserve GitHub conclusions
kaahos 0d40d16
Offer interactive release monitoring extensions after timeout
kaahos d9f3791
Explain expected process cleanup race in release CLI tests
kaahos 07b51ec
Preserve final status-query grace across the monitoring deadline
kaahos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright 2026, Datadog, Inc | ||
|
|
||
| """Run the release CLI, optionally answering prompts through a real terminal.""" | ||
|
|
||
| import errno | ||
| import os | ||
| import pty | ||
| import select | ||
| import signal | ||
| import sys | ||
| import time | ||
|
|
||
|
|
||
| def main(): | ||
| """Forward the CLI exit status and script terminal replies when requested.""" | ||
| command = ["bash", *sys.argv[1:]] | ||
| if "CLI_PTY_REPLIES" not in os.environ: | ||
| os.execvp(command[0], command) | ||
|
|
||
| replies = iter(os.environ["CLI_PTY_REPLIES"].split("\n")) | ||
| prompt = b"[y/N]: " | ||
| pending = b"" | ||
| child_pid, terminal = pty.fork() | ||
| if child_pid == 0: | ||
| os.execvp(command[0], command) | ||
|
|
||
| try: | ||
| deadline = time.monotonic() + 30 | ||
| while True: | ||
| if time.monotonic() >= deadline: | ||
| raise RuntimeError("interactive release test timed out") | ||
| readable, _, _ = select.select([terminal], [], [], 0.1) | ||
| if not readable: | ||
| continue | ||
| try: | ||
| output = os.read(terminal, 4096) | ||
| except OSError as error: | ||
| if error.errno == errno.EIO: | ||
| break | ||
| raise | ||
| if not output: | ||
| break | ||
| sys.stdout.buffer.write(output) | ||
| sys.stdout.buffer.flush() | ||
| pending += output | ||
| while prompt in pending: | ||
| pending = pending.split(prompt, 1)[1] | ||
| reply = next(replies).encode() | ||
| # Ctrl-C and Ctrl-D exercise terminal interrupt and EOF handling. | ||
| os.write(terminal, reply if reply in (b"\x03", b"\x04") else reply + b"\n") | ||
| _, status = os.waitpid(child_pid, 0) | ||
| except BaseException: | ||
| try: | ||
| os.killpg(child_pid, signal.SIGKILL) | ||
| except ProcessLookupError: | ||
| # The child may have exited and its process group disappeared before cleanup. | ||
| pass | ||
| os.waitpid(child_pid, 0) | ||
| raise | ||
| finally: | ||
| os.close(terminal) | ||
|
|
||
| result = os.waitstatus_to_exitcode(status) | ||
| return result if result >= 0 else 128 - result | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.