Make balena-cli build on refreshed on-prem workers

* Fix 'balena ssh' test cases when using the Windows built-in ssh tool
* Fix Windows installer build in new balena CI workers (qqjs patch)
* Remove hardcoded path

Change-type: patch
This commit is contained in:
Paulo Castro 2020-11-30 22:58:46 +00:00 committed by ab77
parent 6b0201866f
commit 511d0dbe26
No known key found for this signature in database
GPG Key ID: D094F44E5E29445A
3 changed files with 14 additions and 4 deletions

View File

@ -20,7 +20,8 @@ import * as _ from 'lodash';
import * as path from 'path';
import * as shellEscape from 'shell-escape';
export const MSYS2_BASH = 'C:\\msys64\\usr\\bin\\bash.exe';
export const MSYS2_BASH =
process.env.MSYSSHELLPATH || 'C:\\msys64\\usr\\bin\\bash.exe';
export const ROOT = path.join(__dirname, '..');
/** Tap and buffer this process' stdout and stderr */

View File

@ -120,6 +120,13 @@ describe('balena ssh', function () {
async function checkSsh(): Promise<boolean> {
const { which } = await import('../../build/utils/helpers');
const sshPath = await which('ssh', false);
if ((sshPath || '').includes('\\Windows\\System32\\OpenSSH\\ssh')) {
// don't use Windows' built-in ssh tool for these test cases
// because it messes up with the terminal window such that
// "line breaks stop working" (and not even '\033c' fixes it)
// and all mocha output gets printed on a single very long line...
return false;
}
return !!sshPath;
}
@ -127,11 +134,13 @@ async function checkSsh(): Promise<boolean> {
async function startMockSshServer(): Promise<[Server, number]> {
const server = createServer((c) => {
// 'connection' listener
c.on('end', () => {
const handler = (msg: string) => {
if (process.env.DEBUG) {
console.error('[debug] mock ssh server: client disconnected');
console.error(`[debug] mock ssh server: ${msg}`);
}
});
};
c.on('error', (err) => handler(err.message));
c.on('end', () => handler('client disconnected'));
c.end();
});
server.on('error', (err) => {