Improve remote runtime cache logging

This commit is contained in:
2026-05-10 22:56:29 +00:00
parent 61f6d37960
commit 7de42e10df
5 changed files with 113 additions and 12 deletions
+24
View File
@@ -53,6 +53,13 @@ export interface IRemoteEphemeralRuntimeCacheCheckOptions {
nodePath?: string;
}
export interface IRemoteEphemeralRuntimeMarkOptions {
runtimeRoot: string;
runtimeSha256: string;
markerFileName?: string;
nodePath?: string;
}
export const defaultIdeDataRoot = '~/.git.zone/ide';
export const defaultInstallRoot = '~/.git.zone/ide/server';
export const remoteEphemeralRuntimeMarkerFileName = '.gitzone-runtime-sha256';
@@ -209,6 +216,23 @@ export const createRemoteEphemeralRuntimeCacheCheckCommand = (options: IRemoteEp
].join('\n');
};
export const createRemoteEphemeralRuntimeMarkCommand = (options: IRemoteEphemeralRuntimeMarkOptions) => {
const markerFileName = options.markerFileName ?? remoteEphemeralRuntimeMarkerFileName;
const markerPath = joinRemotePath(options.runtimeRoot, markerFileName);
const markerTempPath = `${markerPath}.tmp`;
const nodePath = options.nodePath ?? joinRemotePath(options.runtimeRoot, 'node/bin/node');
const backendPath = joinRemotePath(options.runtimeRoot, 'applications/remote-theia/lib/backend/main.js');
return [
'set -euo pipefail',
`test -x ${quoteRemotePath(nodePath)}`,
`test -f ${quoteRemotePath(backendPath)}`,
`printf '%s\n' ${quoteShellArg(options.runtimeSha256)} > ${quoteRemotePath(markerTempPath)}`,
`mv ${quoteRemotePath(markerTempPath)} ${quoteRemotePath(markerPath)}`,
`printf 'runtimeCache=stored\n'`,
].join('\n');
};
export const createRemoteHealthCommand = (serverVersion: string, installRoot = defaultInstallRoot) => {
const plan = createRemoteServerInstallPlan({
serverVersion,
+15 -1
View File
@@ -36,6 +36,11 @@ export interface ISshTunnelOptions extends ISshRunOptions {
export interface ISshUploadOptions extends ISshRunOptions {
cleanRemote?: boolean;
onProgress?: (progress: ISshUploadProgress) => void;
}
export interface ISshUploadProgress {
bytesUploaded: number;
}
export interface ISshTunnelHandle {
@@ -367,6 +372,7 @@ export const uploadDirectoryToRemote = async (
const stdout: Buffer[] = [];
const stderr: Buffer[] = [];
let tarStderr = '';
let bytesUploaded = 0;
let settled = false;
const timeout = options.timeoutMs
? setTimeout(() => {
@@ -386,7 +392,15 @@ export const uploadDirectoryToRemote = async (
resolve(result);
};
tar.stdout.pipe(ssh.stdin);
const progressStream = new plugins.stream.Transform({
transform(chunk: Buffer, _encoding, callback) {
bytesUploaded += chunk.length;
options.onProgress?.({ bytesUploaded });
callback(undefined, chunk);
},
});
tar.stdout.pipe(progressStream).pipe(ssh.stdin);
tar.stderr.on('data', (chunk: Buffer) => {
tarStderr += chunk.toString('utf8');
});
+2 -1
View File
@@ -4,5 +4,6 @@ import * as fsSync from 'node:fs';
import * as net from 'node:net';
import * as os from 'node:os';
import * as path from 'node:path';
import * as stream from 'node:stream';
export { childProcess, fs, fsSync, net, os, path };
export { childProcess, fs, fsSync, net, os, path, stream };