Repository navigation
Add SSH-ready Docker-DB fixture support for GitHub Actions - #680
Conversation
- SSH readiness now uses 127.0.0.1:<forwarded SSH port> rather than the Docker-private container IP. - Docker-exec fixtures no longer reserve/publish SSH port 22, reducing concurrent port conflicts. - Fixed the prior SSH test that accidentally exercised Docker exec. - Added SSH forwarded-port and non-SSH port-exposure coverage.
…-ssh-port-forward.
450ed96 to
141f5f7
Compare
…cess options (DOCKER_EXEC and SSH)
8c7438b to
e55c8a0
Compare
- SSH test waits for temporary sshd readiness via prepare() before executing commands. The prior code forced SSH for both cases and attempted it before sshd was ready
…add-ssh-ready-docker-db-fixture # Conflicts: # doc/changes/unreleased.md
…xpand SSH coverage, and prepare executors before ConfD commands.
| Added SSH-ready Docker-DB fixture support for GitHub Actions | ||
| Added secure ConfD RPC port exposure and disposable Basic-auth credentials for Docker-DB integration tests |
There was a problem hiding this comment.
| Added SSH-ready Docker-DB fixture support for GitHub Actions | |
| Added secure ConfD RPC port exposure and disposable Basic-auth credentials for Docker-DB integration tests | |
| This release adds | |
| * Secure ConfD RPC port exposure | |
| * Disposable Basic-auth credentials for Docker-DB integration tests | |
| * SSH-ready Docker-DB fixture for usage in GitHub Actions |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58af3fa5a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # host port, so prefer that endpoint when available. | ||
| if info.forwarded_ports is not None and info.forwarded_ports.ssh is not None: | ||
| return SshExecFactory( | ||
| f"{info.ssh_info.user}@127.0.0.1:{info.forwarded_ports.ssh}", |
There was a problem hiding this comment.
Honor the configured bind address for SSH
When --port-bind-address is a specific non-loopback local interface, SpawnTestDockerDatabase._port_mapping() publishes port 22 on that address only, while this factory always connects to 127.0.0.1. Because database readiness uses this factory in SSH mode, the connection is refused and environment creation fails despite the bind-address option being valid; carry the configured bind endpoint into DatabaseInfo or otherwise target the address actually used for the published port.
Useful? React with 👍 / 👎.
| @@ -176,6 +185,15 @@ class SshExecFactory(DbOsExecFactory): | |||
| @classmethod | |||
| def from_database_info(cls, info: DatabaseInfo): | |||
There was a problem hiding this comment.
To be honest in this place it will be important, who wants to call db_os_executor from where.
Please first of all, inspect all locations potentially calling from_database_info().
I would ask for the top-level use cases.
And I think the goal of this question should be to try to separate use cases into two groups
- (a) from your local developer machine
- (b) internally or from other docker containers
I am asking this, because (b) usually can and must use f"{info.ssh_info.user}@{info.host}:{info.ports.ssh}", while (a) must must f"{info.ssh_info.user}@127.0.0.1:{info.forwarded_ports.ssh}".
There was a problem hiding this comment.
Or, rephrasing my question, maybe setting CLI option --ssh-port-forward serves exactly this purpose already? In this case we just should forward this implementation detail to the user guide. As then the CLI option not only tells ITDE to use this port but also localhost which should be explicitly mentioned transparently.
Also, I now (sorry for not proposing earlier) I will add a small suggestion to make it a bit clearer.
@classmethod
def from_database_info(cls, info: DatabaseInfo):
assert info.ssh_info
# Check for forwarded port:
if port := info.forwarded_ports and info.forwarded_ports.ssh:
host = "127.0.0.1"
else:
host = info.host
port = info.ports.ssh
return SshExecFactory(
f"{info.ssh_info.user}@{host}:{port}",
info.ssh_info.key_file,
)There was a problem hiding this comment.
Thank you for the detailed review! 👍
I Addressed the review findings as follows:
- Reviewed every SshExecFactory.from_database_info() caller.
- Production use is from the host-side ITDE process; the remaining uses are test helpers/tests.
- Kept the two endpoint cases explicit: without a forwarded SSH port, SSH uses the database’s internal host and port; with a forwarded SSH port, it uses the address on which Docker published that port.
- Carried port_bind_address into DatabaseInfo, so a non-loopback --port-bind-address is used instead of hard-coded 127.0.0.1.
- Added regression coverage for default loopback binding, custom bind addresses, and the no-forwarded-port case.
- Updated CLI help and the user guide to explain that --ssh-port-forward is reached through --port-bind-address (loopback by default).
- This also keeps SSH readiness checks on the same endpoint Docker exposes.
- Reviewed every SshExecFactory.from_database_info() caller. - Production use is from the host-side ITDE process; the remaining uses are test helpers/tests. - Kept the two endpoint cases explicit: without a forwarded SSH port, SSH uses the database’s internal host and port; with a forwarded SSH port, it uses the address on which Docker published that port. - Carried port_bind_address into DatabaseInfo, so a non-loopback --port-bind-address is used instead of hard-coded 127.0.0.1. - Added regression coverage for default loopback binding, custom bind addresses, and the no-forwarded-port case. - Updated CLI help and the user guide to explain that --ssh-port-forward is reached through --port-bind-address (loopback by default). - This also keeps SSH readiness checks on the same endpoint Docker exposes.
58af3fa to
29f2b37
Compare
- Docker can publish the forwarded SSH port before sshd is ready to accept connections or complete the SSH banner exchange. This caused transient SSH failures to be treated as database-start failures. - Retry transient SSH connection and banner errors, recreate the Fabric connection after failed handshakes, and continue waiting within the configured database-startup timeout. - Use the configured forwarded-port bind address for SSH connections so non-loopback --port-bind-address configurations remain reachable.
- Docker-DB readiness now uses Docker exec and no longer depends on SSH becoming available first. - SSH retries use a fresh Fabric connection after failed handshakes. - Added unit coverage for SSH retries and database-readiness behavior.
- Database startup readiness now again uses the executor selected by --db-os-access: SSH when SSH access is configured, otherwise Docker exec. - The redundant SSH retry loop was removed from IsDatabaseReadyThread. SSH connection retries remain centralized in SshExecutor.prepare(), avoiding duplicate readiness behavior. - The obsolete tests for the Docker-exec-only readiness path were removed, along with tests for the removed waiter-level retry logic.
a6db718 to
548bafb
Compare
|
| return SshExecFactory( | ||
| f"{info.ssh_info.user}@{info.host}:{info.ports.ssh}", | ||
| info.ssh_info.key_file, | ||
| f"{info.ssh_info.user}@{host}:{port}", info.ssh_info.key_file |



Closes #673
Closes #681
All Submissions: