Improve remote runtime cache logging
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user