pull/437/head
Frostebite 2022-10-14 20:10:06 +01:00
parent a320cf893c
commit 901e7d254a
5 changed files with 36 additions and 21 deletions

23
dist/index.js vendored
View File

@ -4830,6 +4830,19 @@ exports.CloudRunnerSystem = void 0;
const child_process_1 = __nccwpck_require__(32081);
const remote_client_logger_1 = __nccwpck_require__(59412);
class CloudRunnerSystem {
static RunAndReadLines(command) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield CloudRunnerSystem.Run(command, false, true);
return result
.split(`\n`)
.map((x) => x.replace(`\r`, ``))
.filter((x) => x !== ``)
.map((x) => {
const lineValues = x.split(` `);
return lineValues[lineValues.length - 1];
});
});
}
static Run(command, suppressError = false, suppressLogs = false) {
return __awaiter(this, void 0, void 0, function* () {
for (const element of command.split(`\n`)) {
@ -5198,15 +5211,7 @@ class SharedWorkspaceLocking {
}
static ReadLines(command) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield cloud_runner_system_1.CloudRunnerSystem.Run(command, false, true);
return result
.split(`\n`)
.map((x) => x.replace(`\r`, ``))
.filter((x) => x !== ``)
.map((x) => {
const lineValues = x.split(` `);
return lineValues[lineValues.length - 1];
});
return cloud_runner_system_1.CloudRunnerSystem.RunAndReadLines(command);
});
}
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,20 @@ import { exec } from 'child_process';
import { RemoteClientLogger } from '../remote-client/remote-client-logger';
export class CloudRunnerSystem {
public static async RunAndReadLines(command: string): Promise<string[]> {
const result = await CloudRunnerSystem.Run(command, false, true);
return result
.split(`\n`)
.map((x) => x.replace(`\r`, ``))
.filter((x) => x !== ``)
.map((x) => {
const lineValues = x.split(` `);
return lineValues[lineValues.length - 1];
});
}
public static async Run(command: string, suppressError = false, suppressLogs = false) {
for (const element of command.split(`\n`)) {
if (!suppressLogs) {

View File

@ -186,17 +186,7 @@ export class SharedWorkspaceLocking {
}
private static async ReadLines(command: string): Promise<string[]> {
const result = await CloudRunnerSystem.Run(command, false, true);
return result
.split(`\n`)
.map((x) => x.replace(`\r`, ``))
.filter((x) => x !== ``)
.map((x) => {
const lineValues = x.split(` `);
return lineValues[lineValues.length - 1];
});
return CloudRunnerSystem.RunAndReadLines(command);
}
}

View File

@ -6,6 +6,7 @@ import CloudRunnerLogger from '../services/cloud-runner-logger';
import { v4 as uuidv4 } from 'uuid';
import CloudRunnerOptions from '../cloud-runner-options';
import setups from './cloud-runner-suite.test';
import { CloudRunnerSystem } from '../services/cloud-runner-system';
async function CreateParameters(overrides) {
if (overrides) {
@ -35,6 +36,11 @@ describe('Cloud Runner pre-built S3 steps', () => {
const build2ContainsBuildSucceeded = results2.includes('Build succeeded');
expect(build2ContainsBuildSucceeded).toBeTruthy();
const results = await CloudRunnerSystem.RunAndReadLines(
`aws ls s3://game-ci-test-storage/${buildParameter2.cacheKey}/`,
);
CloudRunnerLogger.log(results.join(`,`));
}, 10000000);
}
});