docker(install): print lima logs on "colima start" failure
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import * as child_process from 'child_process';
|
import * as child_process from 'child_process';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import fsp from 'fs/promises';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import retry from 'async-retry';
|
import retry from 'async-retry';
|
||||||
@@ -187,10 +188,23 @@ export class Install {
|
|||||||
try {
|
try {
|
||||||
await Exec.exec(`colima ${colimaStartArgs.join(' ')}`, [], {env: envs});
|
await Exec.exec(`colima ${colimaStartArgs.join(' ')}`, [], {env: envs});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const haStderrLog = path.join(os.homedir(), '.lima', 'colima', 'ha.stderr.log');
|
const limaColimaDir = path.join(os.homedir(), '.lima', 'colima');
|
||||||
if (fs.existsSync(haStderrLog)) {
|
fsp
|
||||||
core.info(`Printing debug logs (${haStderrLog}):\n${fs.readFileSync(haStderrLog, {encoding: 'utf8'})}`);
|
.readdir(limaColimaDir)
|
||||||
}
|
.then(files => {
|
||||||
|
files
|
||||||
|
.filter(f => path.extname(f) === '.log')
|
||||||
|
.forEach(f => {
|
||||||
|
const logfile = path.join(limaColimaDir, f);
|
||||||
|
const logcontent = fs.readFileSync(logfile, {encoding: 'utf8'}).trim();
|
||||||
|
if (logcontent.length > 0) {
|
||||||
|
core.info(`### ${logfile}:\n${logcontent}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// ignore
|
||||||
|
});
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user