command start and end injector
parent
3ad76f7e5a
commit
66a269d926
|
|
@ -1021,7 +1021,7 @@ class AWSJobStack {
|
||||||
setupCloudFormations(CF, buildGuid, image, entrypoint, commands, mountdir, workingdir, secrets) {
|
setupCloudFormations(CF, buildGuid, image, entrypoint, commands, mountdir, workingdir, secrets) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const logGuid = nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 9)();
|
const logGuid = nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 9)();
|
||||||
commands[1] += `
|
commands += `
|
||||||
echo "${logGuid}"
|
echo "${logGuid}"
|
||||||
`;
|
`;
|
||||||
const taskDefStackName = `${this.baseStackName}-${buildGuid}`;
|
const taskDefStackName = `${this.baseStackName}-${buildGuid}`;
|
||||||
|
|
@ -1201,6 +1201,7 @@ const __1 = __webpack_require__(41359);
|
||||||
const fs_1 = __importDefault(__webpack_require__(35747));
|
const fs_1 = __importDefault(__webpack_require__(35747));
|
||||||
const cloud_runner_state_1 = __webpack_require__(70912);
|
const cloud_runner_state_1 = __webpack_require__(70912);
|
||||||
const cloud_runner_statics_1 = __webpack_require__(90828);
|
const cloud_runner_statics_1 = __webpack_require__(90828);
|
||||||
|
const cloud_runner_build_command_process_1 = __webpack_require__(71899);
|
||||||
class AWSTaskRunner {
|
class AWSTaskRunner {
|
||||||
static runTask(taskDef, ECS, CF, environment, buildGuid, commands) {
|
static runTask(taskDef, ECS, CF, environment, buildGuid, commands) {
|
||||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
||||||
|
|
@ -1220,7 +1221,7 @@ class AWSTaskRunner {
|
||||||
{
|
{
|
||||||
name: taskDef.taskDefStackName,
|
name: taskDef.taskDefStackName,
|
||||||
environment: [...environment, { name: 'BUILDID', value: buildGuid }],
|
environment: [...environment, { name: 'BUILDID', value: buildGuid }],
|
||||||
command: ['-c', ...commands],
|
command: ['-c', ...cloud_runner_build_command_process_1.CloudRunnerBuildCommandProcessor.ProcessCommands(commands)],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -1849,11 +1850,12 @@ exports.default = Kubernetes;
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1739:
|
/***/ 1739:
|
||||||
/***/ ((__unused_webpack_module, exports) => {
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
const cloud_runner_build_command_process_1 = __webpack_require__(71899);
|
||||||
class KubernetesJobSpecFactory {
|
class KubernetesJobSpecFactory {
|
||||||
static getJobSpec(command, image, mountdir, workingDirectory, environment, buildGuid, buildParameters, secretName, pvcName, jobName, k8s) {
|
static getJobSpec(command, image, mountdir, workingDirectory, environment, buildGuid, buildParameters, secretName, pvcName, jobName, k8s) {
|
||||||
environment.push(...[
|
environment.push(...[
|
||||||
|
|
@ -1943,7 +1945,7 @@ class KubernetesJobSpecFactory {
|
||||||
name: 'main',
|
name: 'main',
|
||||||
image,
|
image,
|
||||||
command: ['/bin/sh'],
|
command: ['/bin/sh'],
|
||||||
args: ['-c', ...command],
|
args: ['-c', cloud_runner_build_command_process_1.CloudRunnerBuildCommandProcessor.ProcessCommands(command)],
|
||||||
workingDir: `/${workingDirectory}`,
|
workingDir: `/${workingDirectory}`,
|
||||||
resources: {
|
resources: {
|
||||||
requests: {
|
requests: {
|
||||||
|
|
@ -2405,6 +2407,26 @@ class KubernetesUtilities {
|
||||||
exports.default = KubernetesUtilities;
|
exports.default = KubernetesUtilities;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 71899:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.CloudRunnerBuildCommandProcessor = void 0;
|
||||||
|
class CloudRunnerBuildCommandProcessor {
|
||||||
|
static ProcessCommands(commands) {
|
||||||
|
return `
|
||||||
|
echo "start"
|
||||||
|
${commands}
|
||||||
|
echo "end"`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CloudRunnerBuildCommandProcessor = CloudRunnerBuildCommandProcessor;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 91311:
|
/***/ 91311:
|
||||||
|
|
@ -2796,8 +2818,7 @@ class BuildStep {
|
||||||
static BuildStep(image, environmentVariables, secrets) {
|
static BuildStep(image, environmentVariables, secrets) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
cloud_runner_logger_1.default.logLine('Starting part 2/2 (build unity project)');
|
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, [
|
yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runTask(cloud_runner_state_1.CloudRunnerState.buildGuid, image, `
|
||||||
`
|
|
||||||
export GITHUB_WORKSPACE="${cloud_runner_state_1.CloudRunnerState.repoPathFull}"
|
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/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/entrypoint.sh" "/entrypoint.sh"
|
||||||
|
|
@ -2818,8 +2839,7 @@ class BuildStep {
|
||||||
ls ${cloud_runner_state_1.CloudRunnerState.cacheFolderFull}/lib
|
ls ${cloud_runner_state_1.CloudRunnerState.cacheFolderFull}/lib
|
||||||
echo " "
|
echo " "
|
||||||
ls
|
ls
|
||||||
`,
|
`, `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.projectPathFull}`, environmentVariables, secrets);
|
||||||
], `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.projectPathFull}`, environmentVariables, secrets);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2864,8 +2884,7 @@ class SetupStep {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
cloud_runner_logger_1.default.logLine('Starting step 1/2 download game files from repository, try to use cache');
|
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, [
|
yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runTask(cloud_runner_state_1.CloudRunnerState.buildGuid, image, `
|
||||||
`
|
|
||||||
apk update -q
|
apk update -q
|
||||||
apk add unzip zip git-lfs jq tree nodejs -q
|
apk add unzip zip git-lfs jq tree nodejs -q
|
||||||
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||||
|
|
@ -2873,8 +2892,7 @@ class SetupStep {
|
||||||
git clone -b ${cloud_runner_state_1.CloudRunnerState.branchName} ${cloud_runner_state_1.CloudRunnerState.unityBuilderRepoUrl} ${cloud_runner_state_1.CloudRunnerState.builderPathFull}
|
git clone -b ${cloud_runner_state_1.CloudRunnerState.branchName} ${cloud_runner_state_1.CloudRunnerState.unityBuilderRepoUrl} ${cloud_runner_state_1.CloudRunnerState.builderPathFull}
|
||||||
chmod +x ${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/index.js
|
chmod +x ${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/index.js
|
||||||
node ${cloud_runner_state_1.CloudRunnerState.builderPathFull}/dist/index.js -m remote-cli
|
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);
|
||||||
], `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}/`, environmentVariables, secrets);
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
cloud_runner_logger_1.default.logLine(`Failed download repository step 1/2`);
|
cloud_runner_logger_1.default.logLine(`Failed download repository step 1/2`);
|
||||||
|
|
@ -3047,7 +3065,7 @@ class EphemeralGitHubRunnerWorkflow {
|
||||||
try {
|
try {
|
||||||
cloud_runner_logger_1.default.log(`Cloud Runner is running in ephemeral GitHub runner mode`);
|
cloud_runner_logger_1.default.log(`Cloud Runner is running in ephemeral GitHub runner mode`);
|
||||||
const installAndStartRunner = ' cd ../.. && ls && mkdir actions-runner && cd actions-runner && curl -O -L https://github.com/actions/runner/releases/download/v2.283.1/actions-runner-linux-x64-2.283.1.tar.gz && tar xzf ./actions-runner-linux-x64-2.283.1.tar.gz';
|
const installAndStartRunner = ' cd ../.. && ls && mkdir actions-runner && cd actions-runner && curl -O -L https://github.com/actions/runner/releases/download/v2.283.1/actions-runner-linux-x64-2.283.1.tar.gz && tar xzf ./actions-runner-linux-x64-2.283.1.tar.gz';
|
||||||
yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runTask(cloud_runner_state_1.CloudRunnerState.buildGuid, image, [installAndStartRunner], `/runner`, `/runner`, environmentVariables, secrets);
|
yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runTask(cloud_runner_state_1.CloudRunnerState.buildGuid, image, installAndStartRunner, `/runner`, `/runner`, environmentVariables, secrets);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -19,13 +19,13 @@ export class AWSJobStack {
|
||||||
buildGuid: string,
|
buildGuid: string,
|
||||||
image: string,
|
image: string,
|
||||||
entrypoint: string[],
|
entrypoint: string[],
|
||||||
commands: string[],
|
commands: string,
|
||||||
mountdir: string,
|
mountdir: string,
|
||||||
workingdir: string,
|
workingdir: string,
|
||||||
secrets: CloudRunnerSecret[],
|
secrets: CloudRunnerSecret[],
|
||||||
): Promise<CloudRunnerTaskDef> {
|
): Promise<CloudRunnerTaskDef> {
|
||||||
const logGuid = customAlphabet(CloudRunnerConstants.alphabet, 9)();
|
const logGuid = customAlphabet(CloudRunnerConstants.alphabet, 9)();
|
||||||
commands[1] += `
|
commands += `
|
||||||
echo "${logGuid}"
|
echo "${logGuid}"
|
||||||
`;
|
`;
|
||||||
const taskDefStackName = `${this.baseStackName}-${buildGuid}`;
|
const taskDefStackName = `${this.baseStackName}-${buildGuid}`;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { Input } from '../..';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { CloudRunnerState } from '../state/cloud-runner-state';
|
import { CloudRunnerState } from '../state/cloud-runner-state';
|
||||||
import { CloudRunnerStatics } from '../cloud-runner-statics';
|
import { CloudRunnerStatics } from '../cloud-runner-statics';
|
||||||
|
import { CloudRunnerBuildCommandProcessor } from '../services/cloud-runner-build-command-process';
|
||||||
|
|
||||||
class AWSTaskRunner {
|
class AWSTaskRunner {
|
||||||
static async runTask(
|
static async runTask(
|
||||||
|
|
@ -16,7 +17,7 @@ class AWSTaskRunner {
|
||||||
CF: AWS.CloudFormation,
|
CF: AWS.CloudFormation,
|
||||||
environment: CloudRunnerEnvironmentVariable[],
|
environment: CloudRunnerEnvironmentVariable[],
|
||||||
buildGuid: string,
|
buildGuid: string,
|
||||||
commands: string[],
|
commands: string,
|
||||||
) {
|
) {
|
||||||
const cluster = taskDef.baseResources?.find((x) => x.LogicalResourceId === 'ECSCluster')?.PhysicalResourceId || '';
|
const cluster = taskDef.baseResources?.find((x) => x.LogicalResourceId === 'ECSCluster')?.PhysicalResourceId || '';
|
||||||
const taskDefinition =
|
const taskDefinition =
|
||||||
|
|
@ -39,7 +40,7 @@ class AWSTaskRunner {
|
||||||
{
|
{
|
||||||
name: taskDef.taskDefStackName,
|
name: taskDef.taskDefStackName,
|
||||||
environment: [...environment, { name: 'BUILDID', value: buildGuid }],
|
environment: [...environment, { name: 'BUILDID', value: buildGuid }],
|
||||||
command: ['-c', ...commands],
|
command: ['-c', ...CloudRunnerBuildCommandProcessor.ProcessCommands(commands)],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
|
||||||
async runTask(
|
async runTask(
|
||||||
buildId: string,
|
buildId: string,
|
||||||
image: string,
|
image: string,
|
||||||
commands: string[],
|
commands: string,
|
||||||
mountdir: string,
|
mountdir: string,
|
||||||
workingdir: string,
|
workingdir: string,
|
||||||
environment: CloudRunnerEnvironmentVariable[],
|
environment: CloudRunnerEnvironmentVariable[],
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class Kubernetes implements CloudRunnerProviderInterface {
|
||||||
async runTask(
|
async runTask(
|
||||||
buildGuid: string,
|
buildGuid: string,
|
||||||
image: string,
|
image: string,
|
||||||
commands: string[],
|
commands: string,
|
||||||
mountdir: string,
|
mountdir: string,
|
||||||
workingdir: string,
|
workingdir: string,
|
||||||
environment: CloudRunnerEnvironmentVariable[],
|
environment: CloudRunnerEnvironmentVariable[],
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import BuildParameters from '../../build-parameters';
|
import BuildParameters from '../../build-parameters';
|
||||||
|
import { CloudRunnerBuildCommandProcessor } from '../services/cloud-runner-build-command-process';
|
||||||
import CloudRunnerEnvironmentVariable from '../services/cloud-runner-environment-variable';
|
import CloudRunnerEnvironmentVariable from '../services/cloud-runner-environment-variable';
|
||||||
|
|
||||||
class KubernetesJobSpecFactory {
|
class KubernetesJobSpecFactory {
|
||||||
static getJobSpec(
|
static getJobSpec(
|
||||||
command: string[],
|
command: string,
|
||||||
image: string,
|
image: string,
|
||||||
mountdir: string,
|
mountdir: string,
|
||||||
workingDirectory: string,
|
workingDirectory: string,
|
||||||
|
|
@ -104,7 +105,7 @@ class KubernetesJobSpecFactory {
|
||||||
name: 'main',
|
name: 'main',
|
||||||
image,
|
image,
|
||||||
command: ['/bin/sh'],
|
command: ['/bin/sh'],
|
||||||
args: ['-c', ...command],
|
args: ['-c', CloudRunnerBuildCommandProcessor.ProcessCommands(command)],
|
||||||
|
|
||||||
workingDir: `/${workingDirectory}`,
|
workingDir: `/${workingDirectory}`,
|
||||||
resources: {
|
resources: {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
export class CloudRunnerBuildCommandProcessor {
|
||||||
|
public static ProcessCommands(commands: string): string {
|
||||||
|
return `
|
||||||
|
echo "start"
|
||||||
|
${commands}
|
||||||
|
echo "end"`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -29,7 +29,7 @@ export interface CloudRunnerProviderInterface {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
image: string,
|
image: string,
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
commands: string[],
|
commands: string,
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
mountdir: string,
|
mountdir: string,
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ export class BuildStep implements StepInterface {
|
||||||
await CloudRunnerState.CloudRunnerProviderPlatform.runTask(
|
await CloudRunnerState.CloudRunnerProviderPlatform.runTask(
|
||||||
CloudRunnerState.buildGuid,
|
CloudRunnerState.buildGuid,
|
||||||
image,
|
image,
|
||||||
[
|
|
||||||
`
|
`
|
||||||
export GITHUB_WORKSPACE="${CloudRunnerState.repoPathFull}"
|
export GITHUB_WORKSPACE="${CloudRunnerState.repoPathFull}"
|
||||||
cp -r "${CloudRunnerState.builderPathFull}/dist/default-build-script/" "/UnityBuilderAction"
|
cp -r "${CloudRunnerState.builderPathFull}/dist/default-build-script/" "/UnityBuilderAction"
|
||||||
|
|
@ -46,7 +45,6 @@ export class BuildStep implements StepInterface {
|
||||||
echo " "
|
echo " "
|
||||||
ls
|
ls
|
||||||
`,
|
`,
|
||||||
],
|
|
||||||
`/${CloudRunnerState.buildVolumeFolder}`,
|
`/${CloudRunnerState.buildVolumeFolder}`,
|
||||||
`/${CloudRunnerState.projectPathFull}`,
|
`/${CloudRunnerState.projectPathFull}`,
|
||||||
environmentVariables,
|
environmentVariables,
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ export class SetupStep implements StepInterface {
|
||||||
await CloudRunnerState.CloudRunnerProviderPlatform.runTask(
|
await CloudRunnerState.CloudRunnerProviderPlatform.runTask(
|
||||||
CloudRunnerState.buildGuid,
|
CloudRunnerState.buildGuid,
|
||||||
image,
|
image,
|
||||||
[
|
|
||||||
`
|
`
|
||||||
apk update -q
|
apk update -q
|
||||||
apk add unzip zip git-lfs jq tree nodejs -q
|
apk add unzip zip git-lfs jq tree nodejs -q
|
||||||
|
|
@ -38,7 +37,6 @@ export class SetupStep implements StepInterface {
|
||||||
chmod +x ${CloudRunnerState.builderPathFull}/dist/index.js
|
chmod +x ${CloudRunnerState.builderPathFull}/dist/index.js
|
||||||
node ${CloudRunnerState.builderPathFull}/dist/index.js -m remote-cli
|
node ${CloudRunnerState.builderPathFull}/dist/index.js -m remote-cli
|
||||||
`,
|
`,
|
||||||
],
|
|
||||||
`/${CloudRunnerState.buildVolumeFolder}`,
|
`/${CloudRunnerState.buildVolumeFolder}`,
|
||||||
`/${CloudRunnerState.buildVolumeFolder}/`,
|
`/${CloudRunnerState.buildVolumeFolder}/`,
|
||||||
environmentVariables,
|
environmentVariables,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ export class EphemeralGitHubRunnerWorkflow implements WorkflowInterface {
|
||||||
await CloudRunnerState.CloudRunnerProviderPlatform.runTask(
|
await CloudRunnerState.CloudRunnerProviderPlatform.runTask(
|
||||||
CloudRunnerState.buildGuid,
|
CloudRunnerState.buildGuid,
|
||||||
image,
|
image,
|
||||||
[installAndStartRunner],
|
installAndStartRunner,
|
||||||
`/runner`,
|
`/runner`,
|
||||||
`/runner`,
|
`/runner`,
|
||||||
environmentVariables,
|
environmentVariables,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue