@olivervea/pipelines 2.0.0-beta.22 → 2.0.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/library/ssh.ts +7 -3
package/README.md
CHANGED
|
@@ -166,7 +166,7 @@ Library steps carry their own implementation and image; they take typed settings
|
|
|
166
166
|
| `httpHealthCheck(ctx, url, { attempts?, delaySeconds?, headers? })` | GETs `url` until it returns 2xx (redirects followed), retrying network errors and non-2xx statuses; defaults 5 attempts, 5 s apart. Throws the last error when the attempts run out. Runs in the harness, so the image needs no curl. `helmDeployOverSsh`'s `healthUrl` uses it. |
|
|
167
167
|
| `serviceUrl(release)` | `http://<release>.<namespace>.svc.cluster.local` for a `HelmRelease` (charts that name the Service after the release). |
|
|
168
168
|
| `checkSpa(ctx, url)` | `GET <url>/` must reference an `/assets/*.js` bundle (Vite's layout) and the bundle must be served as JavaScript; returns `{ html, bundle }` for app-specific checks. |
|
|
169
|
-
| `sshSession(ctx, { host, key })` | Installs openssh-client when the image has no ssh (apk or apt-get), writes the key to `<tmpDir>/ssh/id` (trailing newline, mode 600; host key not verified) and returns `{ run(remote), text(remote), copy(local, remote), shell(remote) }`; `shell` is the quoted ssh command for pipes (`ctx.sh(`printf '%s' "$V" \| ${s.shell("kubectl apply -f -")}`)`). `helmDeployOverSsh` uses it. |
|
|
169
|
+
| `sshSession(ctx, { host, key })` | Installs openssh-client when the image has no ssh (apk or apt-get), writes the key to `<tmpDir>/ssh/id` (trailing newline, mode 600; host key not verified) and returns `{ run(remote, { tty? }), text(remote), copy(local, remote), shell(remote) }`; `shell` is the quoted ssh command for pipes (`ctx.sh(`printf '%s' "$V" \| ${s.shell("kubectl apply -f -")}`)`). `helmDeployOverSsh` uses it. |
|
|
170
170
|
|
|
171
171
|
```ts
|
|
172
172
|
import { httpHealthCheck, implement, step } from "@olivervea/pipelines";
|
package/package.json
CHANGED
package/src/library/ssh.ts
CHANGED
|
@@ -16,8 +16,11 @@ export const SSH_CLIENT_INSTALL =
|
|
|
16
16
|
|
|
17
17
|
export interface SshSession {
|
|
18
18
|
readonly host: string;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Runs a remote command; a non-zero exit throws. With `tty`, the command gets a terminal, so a client that
|
|
21
|
+
* dies (a cancelled step) hangs it up: without one, the command gets no signal and carries on.
|
|
22
|
+
*/
|
|
23
|
+
run(remote: string, options?: { tty?: boolean }): Promise<void>;
|
|
21
24
|
/** Runs a remote command and returns its stdout. */
|
|
22
25
|
text(remote: string): Promise<string>;
|
|
23
26
|
/** `scp -r` a local file or directory to a remote path. */
|
|
@@ -58,7 +61,8 @@ export async function sshSession(
|
|
|
58
61
|
const argv = (remote: string) => ['ssh', ...sshOpts, opts.host, remote];
|
|
59
62
|
return {
|
|
60
63
|
host: opts.host,
|
|
61
|
-
run: (remote) =>
|
|
64
|
+
run: (remote, options) =>
|
|
65
|
+
ctx.exec(options?.tty ? ['ssh', '-tt', ...argv(remote).slice(1)] : argv(remote)),
|
|
62
66
|
text: (remote) => ctx.sh.text(argv(remote).map(shq).join(' ')),
|
|
63
67
|
copy: (local, remote) =>
|
|
64
68
|
ctx.exec(['scp', ...sshOpts, '-r', local, `${opts.host}:${remote}`]),
|