-
Notifications
You must be signed in to change notification settings - Fork 199
acc: run ssh/connect-serverless-cpu locally #5941
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # not actually checked by tests; accept-new appends the ephemeral host key here |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
|
|
||
| === CLI ssh connect (local sshd) | ||
|
|
||
| >>> print_requests.py //api/2.2/jobs/runs/submit | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.2/jobs/runs/submit", | ||
| "body": { | ||
| "environments": [ | ||
| { | ||
| "environment_key": "ssh_tunnel_serverless", | ||
| "spec": { | ||
| "environment_version": "4" | ||
| } | ||
| } | ||
| ], | ||
| "run_name": "ssh-server-bootstrap-[CPU_CONN]", | ||
| "tasks": [ | ||
| { | ||
| "environment_key": "ssh_tunnel_serverless", | ||
| "notebook_task": { | ||
| "base_parameters": { | ||
| "authorizedKeySecretName": "client-public-key", | ||
| "maxClients": "10", | ||
| "secretScopeName": "[USERNAME]-[CPU_CONN]-ssh-tunnel-keys", | ||
| "serverless": "true", | ||
| "sessionId": "[CPU_CONN]", | ||
| "shutdownDelay": "10m0s", | ||
| "version": "[CLI_VERSION]" | ||
| }, | ||
| "notebook_path": "/Workspace/Users/[USERNAME]/.databricks/ssh-tunnel/[CLI_VERSION]/[CPU_CONN]/ssh-server-bootstrap" | ||
| }, | ||
| "task_key": "start_ssh_server", | ||
| "timeout_seconds": 86400 | ||
| } | ||
| ], | ||
| "timeout_seconds": 86400 | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,27 @@ | ||
| errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr | ||
| if [ -n "${CLOUD_ENV:-}" ]; then | ||
| # Cloud: real serverless CPU runs the command; dump the run on failure. | ||
| title "CLI ssh connect (serverless CPU)\n" | ||
| errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr | ||
| if ! grep -q "Connection successful" out.stdout.txt; then | ||
| run_id=$(cat LOG.stderr | grep -o "Job submitted successfully with run ID: [0-9]*" | grep -o "[0-9]*$") | ||
| trace $CLI jobs get-run "$run_id" > LOG.job | ||
| fi | ||
| else | ||
| # Local: the test server backs the /ssh websocket with a real sshd, so this | ||
| # asserts the bootstrap job plus a full handshake over the tunnel. Skip when | ||
| # sshd is absent (only task test-exp-ssh provisions it). | ||
| if [ -z "$(command -v sshd || ls /usr/sbin/sshd /usr/local/sbin/sshd /sbin/sshd 2>/dev/null)" ]; then | ||
| echo "SKIP_TEST sshd (openssh-server) not installed" | ||
| exit 0 | ||
| fi | ||
|
|
||
| if ! grep -q "Connection successful" out.stdout.txt; then | ||
| run_id=$(cat LOG.stderr | grep -o "Job submitted successfully with run ID: [0-9]*" | grep -o "[0-9]*$") | ||
| trace $CLI jobs get-run "$run_id" > LOG.job | ||
| # No release artifacts locally and they're never executed; stand in empty archives. | ||
| mkdir -p releases | ||
| touch releases/databricks_cli_linux_amd64.zip | ||
| touch releases/databricks_cli_linux_arm64.zip | ||
| CLI_RELEASES_DIR="$PWD/releases" | ||
|
|
||
| title "CLI ssh connect (local sshd)\n" | ||
| errcode $CLI ssh connect --releases-dir=$CLI_RELEASES_DIR --user-known-hosts-file=known_hosts -- "echo 'Connection successful'" >out.stdout.txt 2>LOG.stderr | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be good to have the core of this test
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a title "CLI ssh connect ..." so the core command shows up in the golden output, but left the actual invocation on errcode + redirect rather than trace because its stdout/stderr are non-deterministic. |
||
| trace print_requests.py //api/2.2/jobs/runs/submit | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,28 @@ | ||
| Local = false | ||
| Cloud = true | ||
| Local = true | ||
| Cloud = false | ||
|
|
||
| # Serverless requires Unity Catalog | ||
| # Serverless requires Unity Catalog. | ||
| RequiresUnityCatalog = true | ||
|
|
||
| # Record requests so we can assert the bootstrap job the CLI submits. | ||
| RecordRequests = true | ||
|
|
||
| # Stand-in release archives staged by the local run; not golden output. | ||
| Ignore = [ | ||
| "releases", | ||
| ] | ||
|
|
||
| # The local run drives a real sshd, reliable only on Linux. | ||
| [GOOS] | ||
| linux = true | ||
| darwin = false | ||
| windows = false | ||
|
|
||
| # No --name: the connection name is a hash of the (random) local host, so | ||
| # normalize it to keep the submitted job payload deterministic. | ||
| [[Repls]] | ||
| Old = 'databricks-cpu-[0-9a-f]{8}' | ||
| New = "[CPU_CONN]" | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct"] |
Uh oh!
There was an error while loading. Please reload this page.