test
parent
5947566262
commit
9bcd11c51c
|
|
@ -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;
|
||||
}
|
||||
catch (error) {
|
||||
cloud_runner_logger_1.default.logRemoteCli(`[ERROR] (${command}) ${error}`);
|
||||
throw error;
|
||||
}
|
||||
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());
|
||||
}
|
||||
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}`);
|
||||
});
|
||||
|
|
@ -932,8 +938,8 @@ class AWSJobStack {
|
|||
setupCloudFormations(CF, buildGuid, image, entrypoint, commands, mountdir, workingdir, secrets) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const logGuid = nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 9)();
|
||||
commands[1] += `
|
||||
echo "${logGuid}"
|
||||
commands[1] += `
|
||||
echo "${logGuid}"
|
||||
`;
|
||||
const taskDefStackName = `${this.baseStackName}-${buildGuid}`;
|
||||
let taskDefCloudFormation = aws_templates_1.AWSTemplates.readTaskCloudFormationTemplate();
|
||||
|
|
@ -1309,25 +1315,25 @@ exports.AWSTemplates = void 0;
|
|||
const fs = __importStar(__webpack_require__(35747));
|
||||
class AWSTemplates {
|
||||
static getParameterTemplate(p1) {
|
||||
return `
|
||||
${p1}:
|
||||
Type: String
|
||||
Default: ''
|
||||
return `
|
||||
${p1}:
|
||||
Type: String
|
||||
Default: ''
|
||||
`;
|
||||
}
|
||||
static getSecretTemplate(p1) {
|
||||
return `
|
||||
${p1}Secret:
|
||||
Type: AWS::SecretsManager::Secret
|
||||
Properties:
|
||||
Name: !Join [ "", [ '${p1}', !Ref BUILDID ] ]
|
||||
SecretString: !Ref ${p1}
|
||||
return `
|
||||
${p1}Secret:
|
||||
Type: AWS::SecretsManager::Secret
|
||||
Properties:
|
||||
Name: !Join [ "", [ '${p1}', !Ref BUILDID ] ]
|
||||
SecretString: !Ref ${p1}
|
||||
`;
|
||||
}
|
||||
static getSecretDefinitionTemplate(p1, p2) {
|
||||
return `
|
||||
- Name: '${p1}'
|
||||
ValueFrom: !Ref ${p2}Secret
|
||||
return `
|
||||
- Name: '${p1}'
|
||||
ValueFrom: !Ref ${p2}Secret
|
||||
`;
|
||||
}
|
||||
static insertAtTemplate(template, insertionKey, insertion) {
|
||||
|
|
@ -1883,8 +1889,8 @@ class KubernetesJobSpecFactory {
|
|||
command: [
|
||||
'bin/bash',
|
||||
'-c',
|
||||
`cd /data/builder/action/steps;
|
||||
chmod +x /return_license.sh;
|
||||
`cd /data/builder/action/steps;
|
||||
chmod +x /return_license.sh;
|
||||
/return_license.sh;`,
|
||||
],
|
||||
},
|
||||
|
|
@ -2691,23 +2697,23 @@ class BuildStep {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
cloud_runner_logger_1.default.logLine('Starting part 2/2 (build unity project)');
|
||||
yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runTask(cloud_runner_state_1.CloudRunnerState.buildGuid, image, [
|
||||
`
|
||||
export GITHUB_WORKSPACE="${cloud_runner_state_1.CloudRunnerState.repoPathFull}"
|
||||
cp -r "${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/default-build-script/" "/UnityBuilderAction"
|
||||
cp -r "${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/entrypoint.sh" "/entrypoint.sh"
|
||||
cp -r "${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/steps/" "/steps"
|
||||
chmod -R +x "/entrypoint.sh"
|
||||
chmod -R +x "/steps"
|
||||
/entrypoint.sh
|
||||
apk update -q
|
||||
apk add zip tree -q
|
||||
cd "$libraryFolderFull/.."
|
||||
zip -r "lib-$BUILDID.zip" "./Library"
|
||||
mv "lib-$BUILDID.zip" "/$cacheFolderFull/lib"
|
||||
cd "$repoPathFull"
|
||||
ls -lh "$repoPathFull"
|
||||
zip -r "build-$BUILDID.zip" "./${cloud_runner_state_1.CloudRunnerState.buildParams.buildPath}"
|
||||
mv "build-$BUILDID.zip" "/$cacheFolderFull/build-$BUILDID.zip"
|
||||
`
|
||||
export GITHUB_WORKSPACE="${cloud_runner_state_1.CloudRunnerState.repoPathFull}"
|
||||
cp -r "${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/default-build-script/" "/UnityBuilderAction"
|
||||
cp -r "${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/entrypoint.sh" "/entrypoint.sh"
|
||||
cp -r "${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/steps/" "/steps"
|
||||
chmod -R +x "/entrypoint.sh"
|
||||
chmod -R +x "/steps"
|
||||
/entrypoint.sh
|
||||
apk update -q
|
||||
apk add zip tree -q
|
||||
cd "$libraryFolderFull/.."
|
||||
zip -r "lib-$BUILDID.zip" "./Library"
|
||||
mv "lib-$BUILDID.zip" "/$cacheFolderFull/lib"
|
||||
cd "$repoPathFull"
|
||||
ls -lh "$repoPathFull"
|
||||
zip -r "build-$BUILDID.zip" "./${cloud_runner_state_1.CloudRunnerState.buildParams.buildPath}"
|
||||
mv "build-$BUILDID.zip" "/$cacheFolderFull/build-$BUILDID.zip"
|
||||
`,
|
||||
], `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.projectPathFull}`, environmentVariables, secrets);
|
||||
});
|
||||
|
|
@ -2755,15 +2761,15 @@ class SetupStep {
|
|||
try {
|
||||
cloud_runner_logger_1.default.logLine('Starting step 1/2 download game files from repository, try to use cache');
|
||||
yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runTask(cloud_runner_state_1.CloudRunnerState.buildGuid, image, [
|
||||
`
|
||||
apk update -q
|
||||
apk add unzip zip git-lfs jq tree nodejs -q
|
||||
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||
mkdir -p ${cloud_runner_state_1.CloudRunnerState.builderPathFull}
|
||||
echo "${cloud_runner_state_1.CloudRunnerState.cloneBuilderCommand}"
|
||||
${cloud_runner_state_1.CloudRunnerState.cloneBuilderCommand}
|
||||
chmod +x ${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/index.js
|
||||
node ${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/index.js -m remote-cli
|
||||
`
|
||||
apk update -q
|
||||
apk add unzip zip git-lfs jq tree nodejs -q
|
||||
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||
mkdir -p ${cloud_runner_state_1.CloudRunnerState.builderPathFull}
|
||||
echo "${cloud_runner_state_1.CloudRunnerState.cloneBuilderCommand}"
|
||||
${cloud_runner_state_1.CloudRunnerState.cloneBuilderCommand}
|
||||
chmod +x ${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/index.js
|
||||
node ${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/index.js -m remote-cli
|
||||
`,
|
||||
], `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}/`, environmentVariables, secrets);
|
||||
}
|
||||
|
|
@ -3116,7 +3122,7 @@ class ImageEnvironmentFactory {
|
|||
const environmentVariables = ImageEnvironmentFactory.getEnvironmentVariables(parameters);
|
||||
let string = '';
|
||||
for (const p of environmentVariables) {
|
||||
string += `--env ${p.name}="${p.value}" \
|
||||
string += `--env ${p.name}="${p.value}" \
|
||||
`;
|
||||
}
|
||||
return string;
|
||||
|
|
@ -3261,8 +3267,8 @@ class ImageTag {
|
|||
case platform_1.default.types.Test:
|
||||
return generic;
|
||||
default:
|
||||
throw new Error(`
|
||||
Platform must be one of the ones described in the documentation.
|
||||
throw new Error(`
|
||||
Platform must be one of the ones described in the documentation.
|
||||
"${platform}" is currently not supported.`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -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());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue