Skip to content

Add SSH-ready Docker-DB fixture support for GitHub Actions - #680

Merged
skyglass merged 15 commits into
mainfrom
skyglass/feature/673-add-ssh-ready-docker-db-fixture
Sep 28, 2026
Merged

skyglass merged 15 commits into
mainfrom
skyglass/feature/673-add-ssh-ready-docker-db-fixture

Conversation

@skyglass

@skyglass skyglass commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #673
Closes #681

  • SSH readiness now uses 127.0.0.1: 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.
  • Retry SSH banner and connection failures, reset failed connections, expand SSH coverage, and prepare executors before ConfD commands.

All Submissions:

  • Is the title of the Pull Request correct?
  • Is the title of the corresponding issue correct?
  • Have you updated the changelog?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Are you mentioning the issue which this PullRequest fixes ("Fixes...")
  • Are the CLI usage examples up to date?

- 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.
@skyglass
skyglass force-pushed the skyglass/feature/673-add-ssh-ready-docker-db-fixture branch from 450ed96 to 141f5f7 Compare September 21, 2026 22:17
@skyglass
skyglass enabled auto-merge (squash) September 21, 2026 22:56
@skyglass
skyglass force-pushed the skyglass/feature/673-add-ssh-ready-docker-db-fixture branch from 8c7438b to e55c8a0 Compare September 21, 2026 22:59
- 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.
Comment thread doc/changes/unreleased.md
Comment on lines +5 to 6
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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

@ckunki

ckunki commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T06:27:29.711608Z 58af3fa Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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}".

@ckunki ckunki Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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,
        )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@ckunki ckunki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See comments

- 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.
@skyglass
skyglass force-pushed the skyglass/feature/673-add-ssh-ready-docker-db-fixture branch from 58af3fa to 29f2b37 Compare September 25, 2026 11:15
- 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.
@skyglass
skyglass force-pushed the skyglass/feature/673-add-ssh-ready-docker-db-fixture branch from a6db718 to 548bafb Compare September 25, 2026 15:43
@sonarqubecloud

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@skyglass
skyglass merged commit 805c60d into main Sep 28, 2026
422 checks passed
@skyglass
skyglass deleted the skyglass/feature/673-add-ssh-ready-docker-db-fixture branch September 28, 2026 06:17

This branch was previously deployed

1 inactive deployment
manual-approval — 548bafb2 Deployed Sep 25, 2026 by skyglass via Merge Gate / Approve Running Slow Tests? #848
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.

Harden SSH Docker-DB readiness retries and acceptance coverage Add SSH-ready Docker-DB fixture support for GitHub Actions

3 participants