mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
stream logs through standard input and new remote client cli command
This commit is contained in:
parent
16284dcf8d
commit
8a501a6c9f
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -52,6 +52,7 @@ export class Cli {
|
|||||||
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
||||||
program.option('--artifactName <artifactName>', 'caching artifact name');
|
program.option('--artifactName <artifactName>', 'caching artifact name');
|
||||||
program.option('--select <select>', 'select a particular resource');
|
program.option('--select <select>', 'select a particular resource');
|
||||||
|
program.option('--logFile <logFile>', 'output to log file (log stream only)');
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
Cli.options = program.opts();
|
Cli.options = program.opts();
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import { CloudRunnerSystem } from '../services/core/cloud-runner-system';
|
|||||||
import YAML from 'yaml';
|
import YAML from 'yaml';
|
||||||
import GitHub from '../../github';
|
import GitHub from '../../github';
|
||||||
import BuildParameters from '../../build-parameters';
|
import BuildParameters from '../../build-parameters';
|
||||||
|
import { Cli } from '../../cli/cli';
|
||||||
|
|
||||||
export class RemoteClient {
|
export class RemoteClient {
|
||||||
@CliFunction(`remote-cli-pre-build`, `sets up a repository, usually before a game-ci build`)
|
@CliFunction(`remote-cli-pre-build`, `sets up a repository, usually before a game-ci build`)
|
||||||
@ -24,6 +25,30 @@ export class RemoteClient {
|
|||||||
await RemoteClient.runCustomHookFiles(`before-build`);
|
await RemoteClient.runCustomHookFiles(`before-build`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CliFunction('remote-cli-log-stream', `log stream from standard input`)
|
||||||
|
public static async remoteClientLogStream() {
|
||||||
|
const logFile = Cli.options!['logFile'];
|
||||||
|
process.stdin.resume();
|
||||||
|
process.stdin.setEncoding('utf8');
|
||||||
|
|
||||||
|
let lingeringLine = '';
|
||||||
|
|
||||||
|
process.stdin.on('data', (chunk) => {
|
||||||
|
const lines = chunk.toString().split('\n');
|
||||||
|
|
||||||
|
lines[0] = lingeringLine + lines[0];
|
||||||
|
lingeringLine = lines.pop() || '';
|
||||||
|
|
||||||
|
for (const element of lines) {
|
||||||
|
fs.appendFileSync(logFile, element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
process.stdin.on('end', function () {
|
||||||
|
fs.appendFileSync(logFile, lingeringLine);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@CliFunction(`remote-cli-post-build`, `runs a cloud runner build`)
|
@CliFunction(`remote-cli-post-build`, `runs a cloud runner build`)
|
||||||
public static async remoteClientPostBuild(): Promise<string> {
|
public static async remoteClientPostBuild(): Promise<string> {
|
||||||
RemoteClientLogger.log(`Running POST build tasks`);
|
RemoteClientLogger.log(`Running POST build tasks`);
|
||||||
|
@ -110,7 +110,7 @@ node ${builderPath} -m remote-cli-pre-build`;
|
|||||||
chmod -R +x "/steps"
|
chmod -R +x "/steps"
|
||||||
echo "game ci start"
|
echo "game ci start"
|
||||||
echo "game ci start" >> /home/job-log.txt
|
echo "game ci start" >> /home/job-log.txt
|
||||||
/entrypoint.sh | tee /home/build-log.txt
|
/entrypoint.sh | node ${builderPath} -m remote-cli-log-stream /home/build-log.txt
|
||||||
cat /home/build-log.txt >> /home/job-log.txt
|
cat /home/build-log.txt >> /home/job-log.txt
|
||||||
node ${builderPath} -m remote-cli-post-build`;
|
node ${builderPath} -m remote-cli-post-build`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user