pull/310/head
Frostebite 2021-12-26 00:32:00 +00:00
parent 5947566262
commit 9bcd11c51c
4 changed files with 79 additions and 66 deletions

22
dist/index.js vendored
View File

@ -486,20 +486,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RemoteClientSystem = void 0;
const child_process_1 = __webpack_require__(63129);
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
const system_1 = __importDefault(__webpack_require__(62177));
class RemoteClientSystem {
static Run(command) {
return __awaiter(this, void 0, void 0, function* () {
try {
const result = yield system_1.default.run(command);
cloud_runner_logger_1.default.logRemoteCli(`${result}`);
return result;
return yield new Promise((promise) => {
child_process_1.exec(command, (error, stdout, stderr) => {
if (error) {
cloud_runner_logger_1.default.logRemoteCli(`[ERROR] ${error.message}`);
throw new Error(error.toString());
}
catch (error) {
cloud_runner_logger_1.default.logRemoteCli(`[ERROR] (${command}) ${error}`);
throw error;
if (stderr) {
cloud_runner_logger_1.default.logRemoteCli(`[STD-ERROR] ${stderr.toString()}`);
throw new Error(stderr.toString());
}
cloud_runner_logger_1.default.logRemoteCli(`${stdout.toString()}`);
promise(stdout.toString());
});
});
});
}
}
@ -670,6 +675,7 @@ class SetupRemoteRepository {
yield remote_client_system_1.RemoteClientSystem.Run(`git clone --depth 1 ${cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl} ${cloud_runner_state_1.CloudRunnerState.repoPathFull}`);
yield remote_client_system_1.RemoteClientSystem.Run(`ls -lh`);
yield remote_client_system_1.RemoteClientSystem.Run(`tree`);
yield remote_client_system_1.RemoteClientSystem.Run(`${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}`);
yield remote_client_system_1.RemoteClientSystem.Run(`git checkout ${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}`);
cloud_runner_logger_1.default.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
});

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,21 @@
import { exec } from 'child_process';
import CloudRunnerLogger from '../../cloud-runner/services/cloud-runner-logger';
import System from '../../system';
export class RemoteClientSystem {
public static async Run(command: string) {
try {
const result = await System.run(command);
CloudRunnerLogger.logRemoteCli(`${result}`);
return result;
} catch (error) {
CloudRunnerLogger.logRemoteCli(`[ERROR] (${command}) ${error}`);
throw error;
}
return await new Promise<string>((promise) => {
exec(command, (error, stdout, stderr) => {
if (error) {
CloudRunnerLogger.logRemoteCli(`[ERROR] ${error.message}`);
throw new Error(error.toString());
}
if (stderr) {
CloudRunnerLogger.logRemoteCli(`[STD-ERROR] ${stderr.toString()}`);
throw new Error(stderr.toString());
}
CloudRunnerLogger.logRemoteCli(`${stdout.toString()}`);
promise(stdout.toString());
});
});
}
}

View File

@ -145,6 +145,7 @@ export class SetupRemoteRepository {
);
await RemoteClientSystem.Run(`ls -lh`);
await RemoteClientSystem.Run(`tree`);
await RemoteClientSystem.Run(`${CloudRunnerState.buildParams.gitSha}`);
await RemoteClientSystem.Run(`git checkout ${CloudRunnerState.buildParams.gitSha}`);
CloudRunnerLogger.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
}