fixes
parent
c367ef8c51
commit
62d089fd89
|
|
@ -118,7 +118,7 @@ inputs:
|
||||||
description:
|
description:
|
||||||
'[CloudRunner] Run a pre build job after the repository setup but before the build job (in yaml format with the
|
'[CloudRunner] Run a pre build job after the repository setup but before the build job (in yaml format with the
|
||||||
keys image, secrets (name, value object array), command line string)'
|
keys image, secrets (name, value object array), command line string)'
|
||||||
customStepFiles:
|
containerHookFiles:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -278,8 +278,8 @@ class BuildParameters {
|
||||||
containerCpu: cloud_runner_options_1.default.containerCpu,
|
containerCpu: cloud_runner_options_1.default.containerCpu,
|
||||||
kubeVolumeSize: cloud_runner_options_1.default.kubeVolumeSize,
|
kubeVolumeSize: cloud_runner_options_1.default.kubeVolumeSize,
|
||||||
kubeVolume: cloud_runner_options_1.default.kubeVolume,
|
kubeVolume: cloud_runner_options_1.default.kubeVolume,
|
||||||
postBuildSteps: cloud_runner_options_1.default.postBuildSteps,
|
postBuildContainerHooks: cloud_runner_options_1.default.postBuildContainerHooks,
|
||||||
preBuildSteps: cloud_runner_options_1.default.preBuildSteps,
|
preBuildContainerHooks: cloud_runner_options_1.default.preBuildContainerHooks,
|
||||||
customJob: cloud_runner_options_1.default.customJob,
|
customJob: cloud_runner_options_1.default.customJob,
|
||||||
runNumber: input_1.default.runNumber,
|
runNumber: input_1.default.runNumber,
|
||||||
branch: input_1.default.branch.replace('/head', '') || (await git_repo_1.GitRepoReader.GetBranch()),
|
branch: input_1.default.branch.replace('/head', '') || (await git_repo_1.GitRepoReader.GetBranch()),
|
||||||
|
|
@ -802,11 +802,11 @@ class CloudRunnerOptions {
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
// Custom commands from files parameters
|
// Custom commands from files parameters
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
static get customStepFiles() {
|
static get containerHookFiles() {
|
||||||
return CloudRunnerOptions.getInput('customStepFiles')?.split(`,`) || [];
|
return CloudRunnerOptions.getInput('containerHookFiles')?.split(`,`) || [];
|
||||||
}
|
}
|
||||||
static get customHookFiles() {
|
static get commandHookFiles() {
|
||||||
return CloudRunnerOptions.getInput('customHookFiles')?.split(`,`) || [];
|
return CloudRunnerOptions.getInput('commandHookFiles')?.split(`,`) || [];
|
||||||
}
|
}
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
// Custom commands from yaml parameters
|
// Custom commands from yaml parameters
|
||||||
|
|
@ -814,11 +814,11 @@ class CloudRunnerOptions {
|
||||||
static get commandHooks() {
|
static get commandHooks() {
|
||||||
return CloudRunnerOptions.getInput('commandHooks') || '';
|
return CloudRunnerOptions.getInput('commandHooks') || '';
|
||||||
}
|
}
|
||||||
static get postBuildSteps() {
|
static get postBuildContainerHooks() {
|
||||||
return CloudRunnerOptions.getInput('postBuildSteps') || '';
|
return CloudRunnerOptions.getInput('postBuildContainerHooks') || '';
|
||||||
}
|
}
|
||||||
static get preBuildSteps() {
|
static get preBuildContainerHooks() {
|
||||||
return CloudRunnerOptions.getInput('preBuildSteps') || '';
|
return CloudRunnerOptions.getInput('preBuildContainerHooks') || '';
|
||||||
}
|
}
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
// Input override handling
|
// Input override handling
|
||||||
|
|
@ -1592,7 +1592,7 @@ const zlib = __importStar(__nccwpck_require__(65628));
|
||||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||||
const __1 = __nccwpck_require__(41359);
|
const __1 = __nccwpck_require__(41359);
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
const cloud_runner_custom_hooks_1 = __nccwpck_require__(58873);
|
const cloud_runner_command_hook_1 = __nccwpck_require__(38960);
|
||||||
const follow_log_stream_service_1 = __nccwpck_require__(64121);
|
const follow_log_stream_service_1 = __nccwpck_require__(64121);
|
||||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||||
|
|
@ -1613,7 +1613,7 @@ class AWSTaskRunner {
|
||||||
{
|
{
|
||||||
name: taskDef.taskDefStackName,
|
name: taskDef.taskDefStackName,
|
||||||
environment,
|
environment,
|
||||||
command: ['-c', cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.ApplyHooksToCommands(commands, cloud_runner_1.default.buildParameters)],
|
command: ['-c', cloud_runner_command_hook_1.CloudRunnerCommandHooks.ApplyHooksToCommands(commands, cloud_runner_1.default.buildParameters)],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -2906,7 +2906,7 @@ const node_fs_1 = __nccwpck_require__(87561);
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
||||||
const fs = __importStar(__nccwpck_require__(87561));
|
const fs = __importStar(__nccwpck_require__(87561));
|
||||||
const cloud_runner_custom_hooks_1 = __nccwpck_require__(58873);
|
const cloud_runner_command_hook_1 = __nccwpck_require__(38960);
|
||||||
class LocalDockerCloudRunner {
|
class LocalDockerCloudRunner {
|
||||||
listResources() {
|
listResources() {
|
||||||
return new Promise((resolve) => resolve([]));
|
return new Promise((resolve) => resolve([]));
|
||||||
|
|
@ -2980,7 +2980,7 @@ set -e
|
||||||
mkdir -p /github/workspace/cloud-runner-cache
|
mkdir -p /github/workspace/cloud-runner-cache
|
||||||
mkdir -p /data/cache
|
mkdir -p /data/cache
|
||||||
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
||||||
${cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.ApplyHooksToCommands(commands, this.buildParameters)}
|
${cloud_runner_command_hook_1.CloudRunnerCommandHooks.ApplyHooksToCommands(commands, this.buildParameters)}
|
||||||
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||||
`;
|
`;
|
||||||
node_fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
|
node_fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
|
||||||
|
|
@ -3270,7 +3270,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const client_node_1 = __nccwpck_require__(89679);
|
const client_node_1 = __nccwpck_require__(89679);
|
||||||
const cloud_runner_custom_hooks_1 = __nccwpck_require__(58873);
|
const cloud_runner_command_hook_1 = __nccwpck_require__(38960);
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
class KubernetesJobSpecFactory {
|
class KubernetesJobSpecFactory {
|
||||||
static getJobSpec(command, image, mountdir, workingDirectory, environment, secrets, buildGuid, buildParameters, secretName, pvcName, jobName, k8s, containerName) {
|
static getJobSpec(command, image, mountdir, workingDirectory, environment, secrets, buildGuid, buildParameters, secretName, pvcName, jobName, k8s, containerName) {
|
||||||
|
|
@ -3359,7 +3359,7 @@ class KubernetesJobSpecFactory {
|
||||||
command: ['/bin/sh'],
|
command: ['/bin/sh'],
|
||||||
args: [
|
args: [
|
||||||
'-c',
|
'-c',
|
||||||
`${cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.ApplyHooksToCommands(`${command}\nsleep 2m`, cloud_runner_1.default.buildParameters)}`,
|
`${cloud_runner_command_hook_1.CloudRunnerCommandHooks.ApplyHooksToCommands(`${command}\nsleep 2m`, cloud_runner_1.default.buildParameters)}`,
|
||||||
],
|
],
|
||||||
workingDir: `${workingDirectory}`,
|
workingDir: `${workingDirectory}`,
|
||||||
resources: {
|
resources: {
|
||||||
|
|
@ -4321,7 +4321,120 @@ exports["default"] = CloudRunnerConstants;
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 58873:
|
/***/ 79691:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
class CloudRunnerEnvironmentVariable {
|
||||||
|
}
|
||||||
|
exports["default"] = CloudRunnerEnvironmentVariable;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 13527:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.CloudRunnerFolders = void 0;
|
||||||
|
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||||
|
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||||
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
|
const build_parameters_1 = __importDefault(__nccwpck_require__(80787));
|
||||||
|
class CloudRunnerFolders {
|
||||||
|
static ToLinuxFolder(folder) {
|
||||||
|
return folder.replace(/\\/g, `/`);
|
||||||
|
}
|
||||||
|
// Only the following paths that do not start a path.join with another "Full" suffixed property need to start with an absolute /
|
||||||
|
static get uniqueCloudRunnerJobFolderAbsolute() {
|
||||||
|
return cloud_runner_1.default.buildParameters && build_parameters_1.default.shouldUseRetainedWorkspaceMode(cloud_runner_1.default.buildParameters)
|
||||||
|
? node_path_1.default.join(`/`, CloudRunnerFolders.buildVolumeFolder, cloud_runner_1.default.lockedWorkspace)
|
||||||
|
: node_path_1.default.join(`/`, CloudRunnerFolders.buildVolumeFolder, cloud_runner_1.default.buildParameters.buildGuid);
|
||||||
|
}
|
||||||
|
static get cacheFolderForAllFull() {
|
||||||
|
return node_path_1.default.join('/', CloudRunnerFolders.buildVolumeFolder, CloudRunnerFolders.cacheFolder);
|
||||||
|
}
|
||||||
|
static get cacheFolderForCacheKeyFull() {
|
||||||
|
return node_path_1.default.join('/', CloudRunnerFolders.buildVolumeFolder, CloudRunnerFolders.cacheFolder, cloud_runner_1.default.buildParameters.cacheKey);
|
||||||
|
}
|
||||||
|
static get builderPathAbsolute() {
|
||||||
|
return node_path_1.default.join(cloud_runner_options_1.default.useSharedBuilder
|
||||||
|
? `/${CloudRunnerFolders.buildVolumeFolder}`
|
||||||
|
: CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute, `builder`);
|
||||||
|
}
|
||||||
|
static get repoPathAbsolute() {
|
||||||
|
return node_path_1.default.join(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute, CloudRunnerFolders.repositoryFolder);
|
||||||
|
}
|
||||||
|
static get projectPathAbsolute() {
|
||||||
|
return node_path_1.default.join(CloudRunnerFolders.repoPathAbsolute, cloud_runner_1.default.buildParameters.projectPath);
|
||||||
|
}
|
||||||
|
static get libraryFolderAbsolute() {
|
||||||
|
return node_path_1.default.join(CloudRunnerFolders.projectPathAbsolute, `Library`);
|
||||||
|
}
|
||||||
|
static get projectBuildFolderAbsolute() {
|
||||||
|
return node_path_1.default.join(CloudRunnerFolders.repoPathAbsolute, cloud_runner_1.default.buildParameters.buildPath);
|
||||||
|
}
|
||||||
|
static get lfsFolderAbsolute() {
|
||||||
|
return node_path_1.default.join(CloudRunnerFolders.repoPathAbsolute, `.git`, `lfs`);
|
||||||
|
}
|
||||||
|
static get purgeRemoteCaching() {
|
||||||
|
return process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined;
|
||||||
|
}
|
||||||
|
static get lfsCacheFolderFull() {
|
||||||
|
return node_path_1.default.join(CloudRunnerFolders.cacheFolderForCacheKeyFull, `lfs`);
|
||||||
|
}
|
||||||
|
static get libraryCacheFolderFull() {
|
||||||
|
return node_path_1.default.join(CloudRunnerFolders.cacheFolderForCacheKeyFull, `Library`);
|
||||||
|
}
|
||||||
|
static get unityBuilderRepoUrl() {
|
||||||
|
return `https://${cloud_runner_1.default.buildParameters.gitPrivateToken}@github.com/game-ci/unity-builder.git`;
|
||||||
|
}
|
||||||
|
static get targetBuildRepoUrl() {
|
||||||
|
return `https://${cloud_runner_1.default.buildParameters.gitPrivateToken}@github.com/${cloud_runner_1.default.buildParameters.githubRepo}.git`;
|
||||||
|
}
|
||||||
|
static get buildVolumeFolder() {
|
||||||
|
return 'data';
|
||||||
|
}
|
||||||
|
static get cacheFolder() {
|
||||||
|
return 'cache';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CloudRunnerFolders = CloudRunnerFolders;
|
||||||
|
CloudRunnerFolders.repositoryFolder = 'repo';
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 17963:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
const nanoid_1 = __nccwpck_require__(17592);
|
||||||
|
const cloud_runner_constants_1 = __importDefault(__nccwpck_require__(91311));
|
||||||
|
class CloudRunnerNamespace {
|
||||||
|
static generateGuid(runNumber, platform) {
|
||||||
|
const nanoid = nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 4);
|
||||||
|
return `${runNumber}-${platform.toLowerCase().replace('standalone', '')}-${nanoid()}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports["default"] = CloudRunnerNamespace;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 38960:
|
||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
@ -4349,7 +4462,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.Hook = exports.CloudRunnerCustomHooks = void 0;
|
exports.CloudRunnerCommandHooks = void 0;
|
||||||
const __1 = __nccwpck_require__(41359);
|
const __1 = __nccwpck_require__(41359);
|
||||||
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
||||||
const remote_client_logger_1 = __nccwpck_require__(59412);
|
const remote_client_logger_1 = __nccwpck_require__(59412);
|
||||||
|
|
@ -4358,9 +4471,9 @@ const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||||
const fs = __importStar(__nccwpck_require__(87561));
|
const fs = __importStar(__nccwpck_require__(87561));
|
||||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||||
// import CloudRunnerLogger from './cloud-runner-logger';
|
// import CloudRunnerLogger from './cloud-runner-logger';
|
||||||
class CloudRunnerCustomHooks {
|
class CloudRunnerCommandHooks {
|
||||||
static ApplyHooksToCommands(commands, buildParameters) {
|
static ApplyHooksToCommands(commands, buildParameters) {
|
||||||
const hooks = CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks);
|
const hooks = CloudRunnerCommandHooks.getHooks(buildParameters.commandHooks);
|
||||||
cloud_runner_logger_1.default.log(`Applying hooks ${hooks.length}`);
|
cloud_runner_logger_1.default.log(`Applying hooks ${hooks.length}`);
|
||||||
return `echo "---"
|
return `echo "---"
|
||||||
echo "start cloud runner init"
|
echo "start cloud runner init"
|
||||||
|
|
@ -4385,22 +4498,22 @@ echo "---${buildParameters.logId}"`;
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
...output.filter((x) => x.hook !== undefined && x.hook.length > 0),
|
...output.filter((x) => x.hook !== undefined && x.hook.length > 0),
|
||||||
...CloudRunnerCustomHooks.GetCustomHooksFromFiles(`before`),
|
...CloudRunnerCommandHooks.GetCustomHooksFromFiles(`before`),
|
||||||
...CloudRunnerCustomHooks.GetCustomHooksFromFiles(`after`),
|
...CloudRunnerCommandHooks.GetCustomHooksFromFiles(`after`),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
static GetCustomHooksFromFiles(hookLifecycle) {
|
static GetCustomHooksFromFiles(hookLifecycle) {
|
||||||
const results = [];
|
const results = [];
|
||||||
// RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
// RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
||||||
try {
|
try {
|
||||||
const gameCiCustomHooksPath = node_path_1.default.join(process.cwd(), `game-ci`, `hooks`);
|
const gameCiCustomHooksPath = node_path_1.default.join(process.cwd(), `game-ci`, `command-hooks`);
|
||||||
const files = fs.readdirSync(gameCiCustomHooksPath);
|
const files = fs.readdirSync(gameCiCustomHooksPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!cloud_runner_options_1.default.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
if (!cloud_runner_options_1.default.commandHookFiles.includes(file.replace(`.yaml`, ``))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fileContents = fs.readFileSync(node_path_1.default.join(gameCiCustomHooksPath, file), `utf8`);
|
const fileContents = fs.readFileSync(node_path_1.default.join(gameCiCustomHooksPath, file), `utf8`);
|
||||||
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
const fileContentsObject = CloudRunnerCommandHooks.ParseHooks(fileContents)[0];
|
||||||
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
||||||
results.push(fileContentsObject);
|
results.push(fileContentsObject);
|
||||||
}
|
}
|
||||||
|
|
@ -4435,7 +4548,7 @@ echo "---${buildParameters.logId}"`;
|
||||||
const isArray = hooks.replace(/\s/g, ``)[0] === `-`;
|
const isArray = hooks.replace(/\s/g, ``)[0] === `-`;
|
||||||
const object = isArray ? yaml_1.default.parse(hooks) : [yaml_1.default.parse(hooks)];
|
const object = isArray ? yaml_1.default.parse(hooks) : [yaml_1.default.parse(hooks)];
|
||||||
for (const hook of object) {
|
for (const hook of object) {
|
||||||
CloudRunnerCustomHooks.ConvertYamlSecrets(hook);
|
CloudRunnerCommandHooks.ConvertYamlSecrets(hook);
|
||||||
if (hook.secrets === undefined) {
|
if (hook.secrets === undefined) {
|
||||||
hook.secrets = [];
|
hook.secrets = [];
|
||||||
}
|
}
|
||||||
|
|
@ -4451,19 +4564,12 @@ echo "---${buildParameters.logId}"`;
|
||||||
return secrets.length > 0 ? secrets.reduce((x, y) => [...x, ...y]) : [];
|
return secrets.length > 0 ? secrets.reduce((x, y) => [...x, ...y]) : [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.CloudRunnerCustomHooks = CloudRunnerCustomHooks;
|
exports.CloudRunnerCommandHooks = CloudRunnerCommandHooks;
|
||||||
class Hook {
|
|
||||||
constructor() {
|
|
||||||
this.commands = new Array();
|
|
||||||
this.secrets = new Array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Hook = Hook;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 96455:
|
/***/ 18313:
|
||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
@ -4491,7 +4597,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.CloudRunnerCustomSteps = void 0;
|
exports.CloudRunnerContainerHook = void 0;
|
||||||
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
const core = __importStar(__nccwpck_require__(42186));
|
const core = __importStar(__nccwpck_require__(42186));
|
||||||
|
|
@ -4501,22 +4607,19 @@ const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||||
const node_fs_1 = __importDefault(__nccwpck_require__(87561));
|
const node_fs_1 = __importDefault(__nccwpck_require__(87561));
|
||||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||||
class CloudRunnerCustomSteps {
|
class CloudRunnerContainerHook {
|
||||||
static GetCustomStepsFromFiles(hookLifecycle) {
|
static GetContainerHooksFromFiles(hookLifecycle) {
|
||||||
const results = [];
|
const results = [];
|
||||||
// RemoteClientLogger.log(
|
|
||||||
// `GetCustomStepFiles: ${hookLifecycle} CustomStepFiles: ${CloudRunnerOptions.customStepFiles}`,
|
|
||||||
// );
|
|
||||||
try {
|
try {
|
||||||
const gameCiCustomStepsPath = node_path_1.default.join(process.cwd(), `game-ci`, `steps`);
|
const gameCiCustomStepsPath = node_path_1.default.join(process.cwd(), `game-ci`, `container-hooks`);
|
||||||
const files = node_fs_1.default.readdirSync(gameCiCustomStepsPath);
|
const files = node_fs_1.default.readdirSync(gameCiCustomStepsPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!cloud_runner_options_1.default.customStepFiles.includes(file.replace(`.yaml`, ``))) {
|
if (!cloud_runner_options_1.default.containerHookFiles.includes(file.replace(`.yaml`, ``))) {
|
||||||
// RemoteClientLogger.log(`Skipping CustomStepFile: ${file}`);
|
// RemoteClientLogger.log(`Skipping CustomStepFile: ${file}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fileContents = node_fs_1.default.readFileSync(node_path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
|
const fileContents = node_fs_1.default.readFileSync(node_path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
|
||||||
const fileContentsObject = CloudRunnerCustomSteps.ParseSteps(fileContents)[0];
|
const fileContentsObject = CloudRunnerContainerHook.ParseContainerHooks(fileContents)[0];
|
||||||
if (fileContentsObject.hook === hookLifecycle) {
|
if (fileContentsObject.hook === hookLifecycle) {
|
||||||
results.push(fileContentsObject);
|
results.push(fileContentsObject);
|
||||||
}
|
}
|
||||||
|
|
@ -4526,7 +4629,7 @@ class CloudRunnerCustomSteps {
|
||||||
remote_client_logger_1.RemoteClientLogger.log(`Failed Getting: ${hookLifecycle} \n ${JSON.stringify(error, undefined, 4)}`);
|
remote_client_logger_1.RemoteClientLogger.log(`Failed Getting: ${hookLifecycle} \n ${JSON.stringify(error, undefined, 4)}`);
|
||||||
}
|
}
|
||||||
// RemoteClientLogger.log(`Active Steps From Files: \n ${JSON.stringify(results, undefined, 4)}`);
|
// RemoteClientLogger.log(`Active Steps From Files: \n ${JSON.stringify(results, undefined, 4)}`);
|
||||||
const builtInCustomSteps = CloudRunnerCustomSteps.ParseSteps(`- name: aws-s3-upload-build
|
const builtInContainerHooks = CloudRunnerContainerHook.ParseContainerHooks(`- name: aws-s3-upload-build
|
||||||
image: amazon/aws-cli
|
image: amazon/aws-cli
|
||||||
hook: after
|
hook: after
|
||||||
commands: |
|
commands: |
|
||||||
|
|
@ -4650,9 +4753,9 @@ class CloudRunnerCustomSteps {
|
||||||
- name: awsSecretAccessKey
|
- name: awsSecretAccessKey
|
||||||
value: ${process.env.AWS_SECRET_ACCESS_KEY || ``}
|
value: ${process.env.AWS_SECRET_ACCESS_KEY || ``}
|
||||||
- name: awsDefaultRegion
|
- name: awsDefaultRegion
|
||||||
value: ${process.env.AWS_REGION || ``}`).filter((x) => cloud_runner_options_1.default.customStepFiles.includes(x.name) && x.hook === hookLifecycle);
|
value: ${process.env.AWS_REGION || ``}`).filter((x) => cloud_runner_options_1.default.containerHookFiles.includes(x.name) && x.hook === hookLifecycle);
|
||||||
if (builtInCustomSteps.length > 0) {
|
if (builtInContainerHooks.length > 0) {
|
||||||
results.push(...builtInCustomSteps);
|
results.push(...builtInContainerHooks);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
@ -4669,14 +4772,14 @@ class CloudRunnerCustomSteps {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static ParseSteps(steps) {
|
static ParseContainerHooks(steps) {
|
||||||
if (steps === '') {
|
if (steps === '') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const isArray = steps.replace(/\s/g, ``)[0] === `-`;
|
const isArray = steps.replace(/\s/g, ``)[0] === `-`;
|
||||||
const object = isArray ? yaml_1.default.parse(steps) : [yaml_1.default.parse(steps)];
|
const object = isArray ? yaml_1.default.parse(steps) : [yaml_1.default.parse(steps)];
|
||||||
for (const step of object) {
|
for (const step of object) {
|
||||||
CloudRunnerCustomSteps.ConvertYamlSecrets(step);
|
CloudRunnerContainerHook.ConvertYamlSecrets(step);
|
||||||
if (step.secrets === undefined) {
|
if (step.secrets === undefined) {
|
||||||
step.secrets = [];
|
step.secrets = [];
|
||||||
}
|
}
|
||||||
|
|
@ -4702,8 +4805,8 @@ class CloudRunnerCustomSteps {
|
||||||
static async RunPostBuildSteps(cloudRunnerStepState) {
|
static async RunPostBuildSteps(cloudRunnerStepState) {
|
||||||
let output = ``;
|
let output = ``;
|
||||||
const steps = [
|
const steps = [
|
||||||
...CloudRunnerCustomSteps.ParseSteps(cloud_runner_1.default.buildParameters.postBuildSteps),
|
...CloudRunnerContainerHook.ParseContainerHooks(cloud_runner_1.default.buildParameters.postBuildContainerHooks),
|
||||||
...CloudRunnerCustomSteps.GetCustomStepsFromFiles(`after`),
|
...CloudRunnerContainerHook.GetContainerHooksFromFiles(`after`),
|
||||||
];
|
];
|
||||||
if (steps.length > 0) {
|
if (steps.length > 0) {
|
||||||
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
||||||
|
|
@ -4717,8 +4820,8 @@ class CloudRunnerCustomSteps {
|
||||||
static async RunPreBuildSteps(cloudRunnerStepState) {
|
static async RunPreBuildSteps(cloudRunnerStepState) {
|
||||||
let output = ``;
|
let output = ``;
|
||||||
const steps = [
|
const steps = [
|
||||||
...CloudRunnerCustomSteps.ParseSteps(cloud_runner_1.default.buildParameters.preBuildSteps),
|
...CloudRunnerContainerHook.ParseContainerHooks(cloud_runner_1.default.buildParameters.preBuildContainerHooks),
|
||||||
...CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`),
|
...CloudRunnerContainerHook.GetContainerHooksFromFiles(`before`),
|
||||||
];
|
];
|
||||||
if (steps.length > 0) {
|
if (steps.length > 0) {
|
||||||
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
||||||
|
|
@ -4730,120 +4833,7 @@ class CloudRunnerCustomSteps {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.CloudRunnerCustomSteps = CloudRunnerCustomSteps;
|
exports.CloudRunnerContainerHook = CloudRunnerContainerHook;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 79691:
|
|
||||||
/***/ ((__unused_webpack_module, exports) => {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
||||||
class CloudRunnerEnvironmentVariable {
|
|
||||||
}
|
|
||||||
exports["default"] = CloudRunnerEnvironmentVariable;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 13527:
|
|
||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
||||||
exports.CloudRunnerFolders = void 0;
|
|
||||||
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
|
||||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
|
||||||
const build_parameters_1 = __importDefault(__nccwpck_require__(80787));
|
|
||||||
class CloudRunnerFolders {
|
|
||||||
static ToLinuxFolder(folder) {
|
|
||||||
return folder.replace(/\\/g, `/`);
|
|
||||||
}
|
|
||||||
// Only the following paths that do not start a path.join with another "Full" suffixed property need to start with an absolute /
|
|
||||||
static get uniqueCloudRunnerJobFolderAbsolute() {
|
|
||||||
return cloud_runner_1.default.buildParameters && build_parameters_1.default.shouldUseRetainedWorkspaceMode(cloud_runner_1.default.buildParameters)
|
|
||||||
? node_path_1.default.join(`/`, CloudRunnerFolders.buildVolumeFolder, cloud_runner_1.default.lockedWorkspace)
|
|
||||||
: node_path_1.default.join(`/`, CloudRunnerFolders.buildVolumeFolder, cloud_runner_1.default.buildParameters.buildGuid);
|
|
||||||
}
|
|
||||||
static get cacheFolderForAllFull() {
|
|
||||||
return node_path_1.default.join('/', CloudRunnerFolders.buildVolumeFolder, CloudRunnerFolders.cacheFolder);
|
|
||||||
}
|
|
||||||
static get cacheFolderForCacheKeyFull() {
|
|
||||||
return node_path_1.default.join('/', CloudRunnerFolders.buildVolumeFolder, CloudRunnerFolders.cacheFolder, cloud_runner_1.default.buildParameters.cacheKey);
|
|
||||||
}
|
|
||||||
static get builderPathAbsolute() {
|
|
||||||
return node_path_1.default.join(cloud_runner_options_1.default.useSharedBuilder
|
|
||||||
? `/${CloudRunnerFolders.buildVolumeFolder}`
|
|
||||||
: CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute, `builder`);
|
|
||||||
}
|
|
||||||
static get repoPathAbsolute() {
|
|
||||||
return node_path_1.default.join(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute, CloudRunnerFolders.repositoryFolder);
|
|
||||||
}
|
|
||||||
static get projectPathAbsolute() {
|
|
||||||
return node_path_1.default.join(CloudRunnerFolders.repoPathAbsolute, cloud_runner_1.default.buildParameters.projectPath);
|
|
||||||
}
|
|
||||||
static get libraryFolderAbsolute() {
|
|
||||||
return node_path_1.default.join(CloudRunnerFolders.projectPathAbsolute, `Library`);
|
|
||||||
}
|
|
||||||
static get projectBuildFolderAbsolute() {
|
|
||||||
return node_path_1.default.join(CloudRunnerFolders.repoPathAbsolute, cloud_runner_1.default.buildParameters.buildPath);
|
|
||||||
}
|
|
||||||
static get lfsFolderAbsolute() {
|
|
||||||
return node_path_1.default.join(CloudRunnerFolders.repoPathAbsolute, `.git`, `lfs`);
|
|
||||||
}
|
|
||||||
static get purgeRemoteCaching() {
|
|
||||||
return process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined;
|
|
||||||
}
|
|
||||||
static get lfsCacheFolderFull() {
|
|
||||||
return node_path_1.default.join(CloudRunnerFolders.cacheFolderForCacheKeyFull, `lfs`);
|
|
||||||
}
|
|
||||||
static get libraryCacheFolderFull() {
|
|
||||||
return node_path_1.default.join(CloudRunnerFolders.cacheFolderForCacheKeyFull, `Library`);
|
|
||||||
}
|
|
||||||
static get unityBuilderRepoUrl() {
|
|
||||||
return `https://${cloud_runner_1.default.buildParameters.gitPrivateToken}@github.com/game-ci/unity-builder.git`;
|
|
||||||
}
|
|
||||||
static get targetBuildRepoUrl() {
|
|
||||||
return `https://${cloud_runner_1.default.buildParameters.gitPrivateToken}@github.com/${cloud_runner_1.default.buildParameters.githubRepo}.git`;
|
|
||||||
}
|
|
||||||
static get buildVolumeFolder() {
|
|
||||||
return 'data';
|
|
||||||
}
|
|
||||||
static get cacheFolder() {
|
|
||||||
return 'cache';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.CloudRunnerFolders = CloudRunnerFolders;
|
|
||||||
CloudRunnerFolders.repositoryFolder = 'repo';
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 17963:
|
|
||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
||||||
const nanoid_1 = __nccwpck_require__(17592);
|
|
||||||
const cloud_runner_constants_1 = __importDefault(__nccwpck_require__(91311));
|
|
||||||
class CloudRunnerNamespace {
|
|
||||||
static generateGuid(runNumber, platform) {
|
|
||||||
const nanoid = nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 4);
|
|
||||||
return `${runNumber}-${platform.toLowerCase().replace('standalone', '')}-${nanoid()}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports["default"] = CloudRunnerNamespace;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
@ -5436,7 +5426,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.TaskParameterSerializer = void 0;
|
exports.TaskParameterSerializer = void 0;
|
||||||
const __1 = __nccwpck_require__(41359);
|
const __1 = __nccwpck_require__(41359);
|
||||||
const cloud_runner_custom_hooks_1 = __nccwpck_require__(58873);
|
const cloud_runner_command_hook_1 = __nccwpck_require__(38960);
|
||||||
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
||||||
const cloud_runner_options_reader_1 = __importDefault(__nccwpck_require__(3343));
|
const cloud_runner_options_reader_1 = __importDefault(__nccwpck_require__(3343));
|
||||||
const build_parameters_1 = __importDefault(__nccwpck_require__(80787));
|
const build_parameters_1 = __importDefault(__nccwpck_require__(80787));
|
||||||
|
|
@ -5452,7 +5442,7 @@ class TaskParameterSerializer {
|
||||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||||
...TaskParameterSerializer.serializeInput(),
|
...TaskParameterSerializer.serializeInput(),
|
||||||
...TaskParameterSerializer.serializeCloudRunnerOptions(),
|
...TaskParameterSerializer.serializeCloudRunnerOptions(),
|
||||||
...cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getSecrets(cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks)),
|
...cloud_runner_command_hook_1.CloudRunnerCommandHooks.getSecrets(cloud_runner_command_hook_1.CloudRunnerCommandHooks.getHooks(buildParameters.commandHooks)),
|
||||||
]
|
]
|
||||||
.filter((x) => !TaskParameterSerializer.blockedParameterNames.has(x.name) &&
|
.filter((x) => !TaskParameterSerializer.blockedParameterNames.has(x.name) &&
|
||||||
x.value !== '' &&
|
x.value !== '' &&
|
||||||
|
|
@ -5671,10 +5661,10 @@ exports.BuildAutomationWorkflow = void 0;
|
||||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||||
const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
||||||
const core = __importStar(__nccwpck_require__(42186));
|
const core = __importStar(__nccwpck_require__(42186));
|
||||||
const cloud_runner_custom_hooks_1 = __nccwpck_require__(58873);
|
const cloud_runner_command_hook_1 = __nccwpck_require__(38960);
|
||||||
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
const cloud_runner_custom_steps_1 = __nccwpck_require__(96455);
|
const cloud_runner_container_hook_1 = __nccwpck_require__(18313);
|
||||||
class BuildAutomationWorkflow {
|
class BuildAutomationWorkflow {
|
||||||
async run(cloudRunnerStepState) {
|
async run(cloudRunnerStepState) {
|
||||||
return await BuildAutomationWorkflow.standardBuildAutomation(cloudRunnerStepState.image, cloudRunnerStepState);
|
return await BuildAutomationWorkflow.standardBuildAutomation(cloudRunnerStepState.image, cloudRunnerStepState);
|
||||||
|
|
@ -5683,7 +5673,7 @@ class BuildAutomationWorkflow {
|
||||||
// TODO accept post and pre build steps as yaml files in the repo
|
// TODO accept post and pre build steps as yaml files in the repo
|
||||||
cloud_runner_logger_1.default.log(`Cloud Runner is running standard build automation`);
|
cloud_runner_logger_1.default.log(`Cloud Runner is running standard build automation`);
|
||||||
let output = '';
|
let output = '';
|
||||||
output += await cloud_runner_custom_steps_1.CloudRunnerCustomSteps.RunPreBuildSteps(cloudRunnerStepState);
|
output += await cloud_runner_container_hook_1.CloudRunnerContainerHook.RunPreBuildSteps(cloudRunnerStepState);
|
||||||
cloud_runner_logger_1.default.logWithTime('Configurable pre build step(s) time');
|
cloud_runner_logger_1.default.logWithTime('Configurable pre build step(s) time');
|
||||||
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
||||||
core.startGroup('build');
|
core.startGroup('build');
|
||||||
|
|
@ -5694,14 +5684,14 @@ class BuildAutomationWorkflow {
|
||||||
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
if (!cloud_runner_1.default.buildParameters.isCliMode)
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
cloud_runner_logger_1.default.logWithTime('Build time');
|
cloud_runner_logger_1.default.logWithTime('Build time');
|
||||||
output += await cloud_runner_custom_steps_1.CloudRunnerCustomSteps.RunPostBuildSteps(cloudRunnerStepState);
|
output += await cloud_runner_container_hook_1.CloudRunnerContainerHook.RunPostBuildSteps(cloudRunnerStepState);
|
||||||
cloud_runner_logger_1.default.logWithTime('Configurable post build step(s) time');
|
cloud_runner_logger_1.default.logWithTime('Configurable post build step(s) time');
|
||||||
cloud_runner_logger_1.default.log(`Cloud Runner finished running standard build automation`);
|
cloud_runner_logger_1.default.log(`Cloud Runner finished running standard build automation`);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
static get BuildWorkflow() {
|
static get BuildWorkflow() {
|
||||||
const setupHooks = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(cloud_runner_1.default.buildParameters.commandHooks).filter((x) => x.step?.includes(`setup`));
|
const setupHooks = cloud_runner_command_hook_1.CloudRunnerCommandHooks.getHooks(cloud_runner_1.default.buildParameters.commandHooks).filter((x) => x.step?.includes(`setup`));
|
||||||
const buildHooks = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(cloud_runner_1.default.buildParameters.commandHooks).filter((x) => x.step?.includes(`build`));
|
const buildHooks = cloud_runner_command_hook_1.CloudRunnerCommandHooks.getHooks(cloud_runner_1.default.buildParameters.commandHooks).filter((x) => x.step?.includes(`build`));
|
||||||
const builderPath = cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(node_path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute, 'dist', `index.js`));
|
const builderPath = cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(node_path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute, 'dist', `index.js`));
|
||||||
return `apt-get update > /dev/null
|
return `apt-get update > /dev/null
|
||||||
apt-get install -y curl tar tree npm git-lfs jq git > /dev/null
|
apt-get install -y curl tar tree npm git-lfs jq git > /dev/null
|
||||||
|
|
@ -5761,11 +5751,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.CustomWorkflow = void 0;
|
exports.CustomWorkflow = void 0;
|
||||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||||
const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
||||||
const cloud_runner_custom_steps_1 = __nccwpck_require__(96455);
|
const cloud_runner_container_hook_1 = __nccwpck_require__(18313);
|
||||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||||
class CustomWorkflow {
|
class CustomWorkflow {
|
||||||
static async runContainerJobFromString(buildSteps, environmentVariables, secrets) {
|
static async runContainerJobFromString(buildSteps, environmentVariables, secrets) {
|
||||||
return await CustomWorkflow.runContainerJob(cloud_runner_custom_steps_1.CloudRunnerCustomSteps.ParseSteps(buildSteps), environmentVariables, secrets);
|
return await CustomWorkflow.runContainerJob(cloud_runner_container_hook_1.CloudRunnerContainerHook.ParseContainerHooks(buildSteps), environmentVariables, secrets);
|
||||||
}
|
}
|
||||||
static async runContainerJob(steps, environmentVariables, secrets) {
|
static async runContainerJob(steps, environmentVariables, secrets) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -57,8 +57,8 @@ class BuildParameters {
|
||||||
public inputPullCommand!: string;
|
public inputPullCommand!: string;
|
||||||
public cacheKey!: string;
|
public cacheKey!: string;
|
||||||
|
|
||||||
public postBuildSteps!: string;
|
public postBuildContainerHooks!: string;
|
||||||
public preBuildSteps!: string;
|
public preBuildContainerHooks!: string;
|
||||||
public customJob!: string;
|
public customJob!: string;
|
||||||
public runNumber!: string;
|
public runNumber!: string;
|
||||||
public branch!: string;
|
public branch!: string;
|
||||||
|
|
@ -157,8 +157,8 @@ class BuildParameters {
|
||||||
containerCpu: CloudRunnerOptions.containerCpu,
|
containerCpu: CloudRunnerOptions.containerCpu,
|
||||||
kubeVolumeSize: CloudRunnerOptions.kubeVolumeSize,
|
kubeVolumeSize: CloudRunnerOptions.kubeVolumeSize,
|
||||||
kubeVolume: CloudRunnerOptions.kubeVolume,
|
kubeVolume: CloudRunnerOptions.kubeVolume,
|
||||||
postBuildSteps: CloudRunnerOptions.postBuildSteps,
|
postBuildContainerHooks: CloudRunnerOptions.postBuildContainerHooks,
|
||||||
preBuildSteps: CloudRunnerOptions.preBuildSteps,
|
preBuildContainerHooks: CloudRunnerOptions.preBuildContainerHooks,
|
||||||
customJob: CloudRunnerOptions.customJob,
|
customJob: CloudRunnerOptions.customJob,
|
||||||
runNumber: Input.runNumber,
|
runNumber: Input.runNumber,
|
||||||
branch: Input.branch.replace('/head', '') || (await GitRepoReader.GetBranch()),
|
branch: Input.branch.replace('/head', '') || (await GitRepoReader.GetBranch()),
|
||||||
|
|
|
||||||
|
|
@ -143,12 +143,12 @@ class CloudRunnerOptions {
|
||||||
// Custom commands from files parameters
|
// Custom commands from files parameters
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
||||||
static get customStepFiles(): string[] {
|
static get containerHookFiles(): string[] {
|
||||||
return CloudRunnerOptions.getInput('customStepFiles')?.split(`,`) || [];
|
return CloudRunnerOptions.getInput('containerHookFiles')?.split(`,`) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
static get customHookFiles(): string[] {
|
static get commandHookFiles(): string[] {
|
||||||
return CloudRunnerOptions.getInput('customHookFiles')?.split(`,`) || [];
|
return CloudRunnerOptions.getInput('commandHookFiles')?.split(`,`) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
@ -159,12 +159,12 @@ class CloudRunnerOptions {
|
||||||
return CloudRunnerOptions.getInput('commandHooks') || '';
|
return CloudRunnerOptions.getInput('commandHooks') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get postBuildSteps(): string {
|
static get postBuildContainerHooks(): string {
|
||||||
return CloudRunnerOptions.getInput('postBuildSteps') || '';
|
return CloudRunnerOptions.getInput('postBuildContainerHooks') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get preBuildSteps(): string {
|
static get preBuildContainerHooks(): string {
|
||||||
return CloudRunnerOptions.getInput('preBuildSteps') || '';
|
return CloudRunnerOptions.getInput('preBuildContainerHooks') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import * as zlib from 'node:zlib';
|
||||||
import CloudRunnerLogger from '../../services/cloud-runner-logger';
|
import CloudRunnerLogger from '../../services/cloud-runner-logger';
|
||||||
import { Input } from '../../..';
|
import { Input } from '../../..';
|
||||||
import CloudRunner from '../../cloud-runner';
|
import CloudRunner from '../../cloud-runner';
|
||||||
import { CloudRunnerCustomHooks } from '../../services/cloud-runner-custom-hooks';
|
import { CloudRunnerCommandHooks } from '../../services/cloud-runner-hooks/cloud-runner-command-hook';
|
||||||
import { FollowLogStreamService } from '../../services/follow-log-stream-service';
|
import { FollowLogStreamService } from '../../services/follow-log-stream-service';
|
||||||
import CloudRunnerOptions from '../../cloud-runner-options';
|
import CloudRunnerOptions from '../../cloud-runner-options';
|
||||||
import GitHub from '../../../github';
|
import GitHub from '../../../github';
|
||||||
|
|
@ -41,7 +41,7 @@ class AWSTaskRunner {
|
||||||
{
|
{
|
||||||
name: taskDef.taskDefStackName,
|
name: taskDef.taskDefStackName,
|
||||||
environment,
|
environment,
|
||||||
command: ['-c', CloudRunnerCustomHooks.ApplyHooksToCommands(commands, CloudRunner.buildParameters)],
|
command: ['-c', CloudRunnerCommandHooks.ApplyHooksToCommands(commands, CloudRunner.buildParameters)],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import { ProviderResource } from '../provider-resource';
|
||||||
import { ProviderWorkflow } from '../provider-workflow';
|
import { ProviderWorkflow } from '../provider-workflow';
|
||||||
import { CloudRunnerSystem } from '../../services/cloud-runner-system';
|
import { CloudRunnerSystem } from '../../services/cloud-runner-system';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import { CloudRunnerCustomHooks } from '../../services/cloud-runner-custom-hooks';
|
import { CloudRunnerCommandHooks } from '../../services/cloud-runner-hooks/cloud-runner-command-hook';
|
||||||
import { StringKeyValuePair } from '../../../shared-types';
|
import { StringKeyValuePair } from '../../../shared-types';
|
||||||
|
|
||||||
class LocalDockerCloudRunner implements ProviderInterface {
|
class LocalDockerCloudRunner implements ProviderInterface {
|
||||||
|
|
@ -119,7 +119,7 @@ set -e
|
||||||
mkdir -p /github/workspace/cloud-runner-cache
|
mkdir -p /github/workspace/cloud-runner-cache
|
||||||
mkdir -p /data/cache
|
mkdir -p /data/cache
|
||||||
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
||||||
${CloudRunnerCustomHooks.ApplyHooksToCommands(commands, this.buildParameters)}
|
${CloudRunnerCommandHooks.ApplyHooksToCommands(commands, this.buildParameters)}
|
||||||
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||||
`;
|
`;
|
||||||
writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
|
writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { V1EnvVar, V1EnvVarSource, V1SecretKeySelector } from '@kubernetes/client-node';
|
import { V1EnvVar, V1EnvVarSource, V1SecretKeySelector } from '@kubernetes/client-node';
|
||||||
import BuildParameters from '../../../build-parameters';
|
import BuildParameters from '../../../build-parameters';
|
||||||
import { CloudRunnerCustomHooks } from '../../services/cloud-runner-custom-hooks';
|
import { CloudRunnerCommandHooks } from '../../services/cloud-runner-hooks/cloud-runner-command-hook';
|
||||||
import CloudRunnerEnvironmentVariable from '../../services/cloud-runner-environment-variable';
|
import CloudRunnerEnvironmentVariable from '../../services/cloud-runner-environment-variable';
|
||||||
import CloudRunnerSecret from '../../services/cloud-runner-secret';
|
import CloudRunnerSecret from '../../services/cloud-runner-secret';
|
||||||
import CloudRunner from '../../cloud-runner';
|
import CloudRunner from '../../cloud-runner';
|
||||||
|
|
@ -108,7 +108,7 @@ class KubernetesJobSpecFactory {
|
||||||
command: ['/bin/sh'],
|
command: ['/bin/sh'],
|
||||||
args: [
|
args: [
|
||||||
'-c',
|
'-c',
|
||||||
`${CloudRunnerCustomHooks.ApplyHooksToCommands(`${command}\nsleep 2m`, CloudRunner.buildParameters)}`,
|
`${CloudRunnerCommandHooks.ApplyHooksToCommands(`${command}\nsleep 2m`, CloudRunner.buildParameters)}`,
|
||||||
],
|
],
|
||||||
|
|
||||||
workingDir: `${workingDirectory}`,
|
workingDir: `${workingDirectory}`,
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
import { BuildParameters, Input } from '../..';
|
import { BuildParameters, Input } from '../../..';
|
||||||
import YAML from 'yaml';
|
import YAML from 'yaml';
|
||||||
import CloudRunnerSecret from './cloud-runner-secret';
|
import { RemoteClientLogger } from '../../remote-client/remote-client-logger';
|
||||||
import { RemoteClientLogger } from '../remote-client/remote-client-logger';
|
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import CloudRunnerOptions from '../cloud-runner-options';
|
import CloudRunnerOptions from '../../cloud-runner-options';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import CloudRunnerLogger from './cloud-runner-logger';
|
import CloudRunnerLogger from '../cloud-runner-logger';
|
||||||
|
import { CommandHook } from './command-hook';
|
||||||
|
|
||||||
// import CloudRunnerLogger from './cloud-runner-logger';
|
// import CloudRunnerLogger from './cloud-runner-logger';
|
||||||
|
|
||||||
export class CloudRunnerCustomHooks {
|
export class CloudRunnerCommandHooks {
|
||||||
public static ApplyHooksToCommands(commands: string, buildParameters: BuildParameters): string {
|
public static ApplyHooksToCommands(commands: string, buildParameters: BuildParameters): string {
|
||||||
const hooks = CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks);
|
const hooks = CloudRunnerCommandHooks.getHooks(buildParameters.commandHooks);
|
||||||
CloudRunnerLogger.log(`Applying hooks ${hooks.length}`);
|
CloudRunnerLogger.log(`Applying hooks ${hooks.length}`);
|
||||||
|
|
||||||
return `echo "---"
|
return `echo "---"
|
||||||
|
|
@ -25,9 +25,9 @@ echo "end of cloud runner job"
|
||||||
echo "---${buildParameters.logId}"`;
|
echo "---${buildParameters.logId}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getHooks(customCommandHooks: string): Hook[] {
|
public static getHooks(customCommandHooks: string): CommandHook[] {
|
||||||
const experimentHooks = customCommandHooks;
|
const experimentHooks = customCommandHooks;
|
||||||
let output = new Array<Hook>();
|
let output = new Array<CommandHook>();
|
||||||
if (experimentHooks && experimentHooks !== '') {
|
if (experimentHooks && experimentHooks !== '') {
|
||||||
try {
|
try {
|
||||||
output = YAML.parse(experimentHooks);
|
output = YAML.parse(experimentHooks);
|
||||||
|
|
@ -38,24 +38,24 @@ echo "---${buildParameters.logId}"`;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...output.filter((x) => x.hook !== undefined && x.hook.length > 0),
|
...output.filter((x) => x.hook !== undefined && x.hook.length > 0),
|
||||||
...CloudRunnerCustomHooks.GetCustomHooksFromFiles(`before`),
|
...CloudRunnerCommandHooks.GetCustomHooksFromFiles(`before`),
|
||||||
...CloudRunnerCustomHooks.GetCustomHooksFromFiles(`after`),
|
...CloudRunnerCommandHooks.GetCustomHooksFromFiles(`after`),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
static GetCustomHooksFromFiles(hookLifecycle: string): Hook[] {
|
static GetCustomHooksFromFiles(hookLifecycle: string): CommandHook[] {
|
||||||
const results: Hook[] = [];
|
const results: CommandHook[] = [];
|
||||||
|
|
||||||
// RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
// RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
||||||
try {
|
try {
|
||||||
const gameCiCustomHooksPath = path.join(process.cwd(), `game-ci`, `hooks`);
|
const gameCiCustomHooksPath = path.join(process.cwd(), `game-ci`, `command-hooks`);
|
||||||
const files = fs.readdirSync(gameCiCustomHooksPath);
|
const files = fs.readdirSync(gameCiCustomHooksPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!CloudRunnerOptions.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
if (!CloudRunnerOptions.commandHookFiles.includes(file.replace(`.yaml`, ``))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fileContents = fs.readFileSync(path.join(gameCiCustomHooksPath, file), `utf8`);
|
const fileContents = fs.readFileSync(path.join(gameCiCustomHooksPath, file), `utf8`);
|
||||||
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
const fileContentsObject = CloudRunnerCommandHooks.ParseHooks(fileContents)[0];
|
||||||
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
||||||
results.push(fileContentsObject);
|
results.push(fileContentsObject);
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ echo "---${buildParameters.logId}"`;
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ConvertYamlSecrets(object: Hook) {
|
private static ConvertYamlSecrets(object: CommandHook) {
|
||||||
if (object.secrets === undefined) {
|
if (object.secrets === undefined) {
|
||||||
object.secrets = [];
|
object.secrets = [];
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ echo "---${buildParameters.logId}"`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParseHooks(hooks: string): Hook[] {
|
public static ParseHooks(hooks: string): CommandHook[] {
|
||||||
if (hooks === '') {
|
if (hooks === '') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
@ -95,9 +95,9 @@ echo "---${buildParameters.logId}"`;
|
||||||
|
|
||||||
// }
|
// }
|
||||||
const isArray = hooks.replace(/\s/g, ``)[0] === `-`;
|
const isArray = hooks.replace(/\s/g, ``)[0] === `-`;
|
||||||
const object: Hook[] = isArray ? YAML.parse(hooks) : [YAML.parse(hooks)];
|
const object: CommandHook[] = isArray ? YAML.parse(hooks) : [YAML.parse(hooks)];
|
||||||
for (const hook of object) {
|
for (const hook of object) {
|
||||||
CloudRunnerCustomHooks.ConvertYamlSecrets(hook);
|
CloudRunnerCommandHooks.ConvertYamlSecrets(hook);
|
||||||
if (hook.secrets === undefined) {
|
if (hook.secrets === undefined) {
|
||||||
hook.secrets = [];
|
hook.secrets = [];
|
||||||
}
|
}
|
||||||
|
|
@ -116,10 +116,3 @@ echo "---${buildParameters.logId}"`;
|
||||||
return secrets.length > 0 ? secrets.reduce((x: any, y: any) => [...x, ...y]) : [];
|
return secrets.length > 0 ? secrets.reduce((x: any, y: any) => [...x, ...y]) : [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class Hook {
|
|
||||||
public commands: string[] = new Array<string>();
|
|
||||||
public secrets: CloudRunnerSecret[] = new Array<CloudRunnerSecret>();
|
|
||||||
public name!: string;
|
|
||||||
public hook!: string[];
|
|
||||||
public step!: string[];
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +1,28 @@
|
||||||
import YAML from 'yaml';
|
import YAML from 'yaml';
|
||||||
import CloudRunner from '../cloud-runner';
|
import CloudRunner from '../../cloud-runner';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { CustomWorkflow } from '../workflows/custom-workflow';
|
import { CustomWorkflow } from '../../workflows/custom-workflow';
|
||||||
import { RemoteClientLogger } from '../remote-client/remote-client-logger';
|
import { RemoteClientLogger } from '../../remote-client/remote-client-logger';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import Input from '../../input';
|
import Input from '../../../input';
|
||||||
import CloudRunnerOptions from '../cloud-runner-options';
|
import CloudRunnerOptions from '../../cloud-runner-options';
|
||||||
import { CustomStep } from './custom-step';
|
import { ContainerHook as ContainerHook } from './container-hook';
|
||||||
import { CloudRunnerStepState } from '../cloud-runner-step-state';
|
import { CloudRunnerStepState } from '../../cloud-runner-step-state';
|
||||||
|
|
||||||
export class CloudRunnerCustomSteps {
|
export class CloudRunnerContainerHook {
|
||||||
static GetCustomStepsFromFiles(hookLifecycle: string): CustomStep[] {
|
static GetContainerHooksFromFiles(hookLifecycle: string): ContainerHook[] {
|
||||||
const results: CustomStep[] = [];
|
const results: ContainerHook[] = [];
|
||||||
|
|
||||||
// RemoteClientLogger.log(
|
|
||||||
// `GetCustomStepFiles: ${hookLifecycle} CustomStepFiles: ${CloudRunnerOptions.customStepFiles}`,
|
|
||||||
// );
|
|
||||||
try {
|
try {
|
||||||
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `steps`);
|
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `container-hooks`);
|
||||||
const files = fs.readdirSync(gameCiCustomStepsPath);
|
const files = fs.readdirSync(gameCiCustomStepsPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!CloudRunnerOptions.customStepFiles.includes(file.replace(`.yaml`, ``))) {
|
if (!CloudRunnerOptions.containerHookFiles.includes(file.replace(`.yaml`, ``))) {
|
||||||
// RemoteClientLogger.log(`Skipping CustomStepFile: ${file}`);
|
// RemoteClientLogger.log(`Skipping CustomStepFile: ${file}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
|
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
|
||||||
const fileContentsObject = CloudRunnerCustomSteps.ParseSteps(fileContents)[0];
|
const fileContentsObject = CloudRunnerContainerHook.ParseContainerHooks(fileContents)[0];
|
||||||
if (fileContentsObject.hook === hookLifecycle) {
|
if (fileContentsObject.hook === hookLifecycle) {
|
||||||
results.push(fileContentsObject);
|
results.push(fileContentsObject);
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +33,7 @@ export class CloudRunnerCustomSteps {
|
||||||
|
|
||||||
// RemoteClientLogger.log(`Active Steps From Files: \n ${JSON.stringify(results, undefined, 4)}`);
|
// RemoteClientLogger.log(`Active Steps From Files: \n ${JSON.stringify(results, undefined, 4)}`);
|
||||||
|
|
||||||
const builtInCustomSteps: CustomStep[] = CloudRunnerCustomSteps.ParseSteps(
|
const builtInContainerHooks: ContainerHook[] = CloudRunnerContainerHook.ParseContainerHooks(
|
||||||
`- name: aws-s3-upload-build
|
`- name: aws-s3-upload-build
|
||||||
image: amazon/aws-cli
|
image: amazon/aws-cli
|
||||||
hook: after
|
hook: after
|
||||||
|
|
@ -179,15 +175,15 @@ export class CloudRunnerCustomSteps {
|
||||||
value: ${process.env.AWS_SECRET_ACCESS_KEY || ``}
|
value: ${process.env.AWS_SECRET_ACCESS_KEY || ``}
|
||||||
- name: awsDefaultRegion
|
- name: awsDefaultRegion
|
||||||
value: ${process.env.AWS_REGION || ``}`,
|
value: ${process.env.AWS_REGION || ``}`,
|
||||||
).filter((x) => CloudRunnerOptions.customStepFiles.includes(x.name) && x.hook === hookLifecycle);
|
).filter((x) => CloudRunnerOptions.containerHookFiles.includes(x.name) && x.hook === hookLifecycle);
|
||||||
if (builtInCustomSteps.length > 0) {
|
if (builtInContainerHooks.length > 0) {
|
||||||
results.push(...builtInCustomSteps);
|
results.push(...builtInContainerHooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ConvertYamlSecrets(object: CustomStep) {
|
private static ConvertYamlSecrets(object: ContainerHook) {
|
||||||
if (object.secrets === undefined) {
|
if (object.secrets === undefined) {
|
||||||
object.secrets = [];
|
object.secrets = [];
|
||||||
|
|
||||||
|
|
@ -202,14 +198,14 @@ export class CloudRunnerCustomSteps {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ParseSteps(steps: string): CustomStep[] {
|
public static ParseContainerHooks(steps: string): ContainerHook[] {
|
||||||
if (steps === '') {
|
if (steps === '') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const isArray = steps.replace(/\s/g, ``)[0] === `-`;
|
const isArray = steps.replace(/\s/g, ``)[0] === `-`;
|
||||||
const object: CustomStep[] = isArray ? YAML.parse(steps) : [YAML.parse(steps)];
|
const object: ContainerHook[] = isArray ? YAML.parse(steps) : [YAML.parse(steps)];
|
||||||
for (const step of object) {
|
for (const step of object) {
|
||||||
CloudRunnerCustomSteps.ConvertYamlSecrets(step);
|
CloudRunnerContainerHook.ConvertYamlSecrets(step);
|
||||||
if (step.secrets === undefined) {
|
if (step.secrets === undefined) {
|
||||||
step.secrets = [];
|
step.secrets = [];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -235,9 +231,9 @@ export class CloudRunnerCustomSteps {
|
||||||
|
|
||||||
static async RunPostBuildSteps(cloudRunnerStepState: CloudRunnerStepState) {
|
static async RunPostBuildSteps(cloudRunnerStepState: CloudRunnerStepState) {
|
||||||
let output = ``;
|
let output = ``;
|
||||||
const steps: CustomStep[] = [
|
const steps: ContainerHook[] = [
|
||||||
...CloudRunnerCustomSteps.ParseSteps(CloudRunner.buildParameters.postBuildSteps),
|
...CloudRunnerContainerHook.ParseContainerHooks(CloudRunner.buildParameters.postBuildContainerHooks),
|
||||||
...CloudRunnerCustomSteps.GetCustomStepsFromFiles(`after`),
|
...CloudRunnerContainerHook.GetContainerHooksFromFiles(`after`),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (steps.length > 0) {
|
if (steps.length > 0) {
|
||||||
|
|
@ -254,9 +250,9 @@ export class CloudRunnerCustomSteps {
|
||||||
}
|
}
|
||||||
static async RunPreBuildSteps(cloudRunnerStepState: CloudRunnerStepState) {
|
static async RunPreBuildSteps(cloudRunnerStepState: CloudRunnerStepState) {
|
||||||
let output = ``;
|
let output = ``;
|
||||||
const steps: CustomStep[] = [
|
const steps: ContainerHook[] = [
|
||||||
...CloudRunnerCustomSteps.ParseSteps(CloudRunner.buildParameters.preBuildSteps),
|
...CloudRunnerContainerHook.ParseContainerHooks(CloudRunner.buildParameters.preBuildContainerHooks),
|
||||||
...CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`),
|
...CloudRunnerContainerHook.GetContainerHooksFromFiles(`before`),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (steps.length > 0) {
|
if (steps.length > 0) {
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import CloudRunnerSecret from '../cloud-runner-secret';
|
||||||
|
|
||||||
|
export class CommandHook {
|
||||||
|
public commands: string[] = new Array<string>();
|
||||||
|
public secrets: CloudRunnerSecret[] = new Array<CloudRunnerSecret>();
|
||||||
|
public name!: string;
|
||||||
|
public hook!: string[];
|
||||||
|
public step!: string[];
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import CloudRunnerSecret from './cloud-runner-secret';
|
import CloudRunnerSecret from '../cloud-runner-secret';
|
||||||
|
|
||||||
export class CustomStep {
|
export class ContainerHook {
|
||||||
public commands!: string;
|
public commands!: string;
|
||||||
public secrets: CloudRunnerSecret[] = new Array<CloudRunnerSecret>();
|
public secrets: CloudRunnerSecret[] = new Array<CloudRunnerSecret>();
|
||||||
public name!: string;
|
public name!: string;
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Input } from '../..';
|
import { Input } from '../..';
|
||||||
import CloudRunnerEnvironmentVariable from './cloud-runner-environment-variable';
|
import CloudRunnerEnvironmentVariable from './cloud-runner-environment-variable';
|
||||||
import { CloudRunnerCustomHooks } from './cloud-runner-custom-hooks';
|
import { CloudRunnerCommandHooks } from './cloud-runner-hooks/cloud-runner-command-hook';
|
||||||
import CloudRunnerSecret from './cloud-runner-secret';
|
import CloudRunnerSecret from './cloud-runner-secret';
|
||||||
import CloudRunnerQueryOverride from './cloud-runner-query-override';
|
import CloudRunnerQueryOverride from './cloud-runner-query-override';
|
||||||
import CloudRunnerOptionsReader from './cloud-runner-options-reader';
|
import CloudRunnerOptionsReader from './cloud-runner-options-reader';
|
||||||
|
|
@ -32,7 +32,7 @@ export class TaskParameterSerializer {
|
||||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||||
...TaskParameterSerializer.serializeInput(),
|
...TaskParameterSerializer.serializeInput(),
|
||||||
...TaskParameterSerializer.serializeCloudRunnerOptions(),
|
...TaskParameterSerializer.serializeCloudRunnerOptions(),
|
||||||
...CloudRunnerCustomHooks.getSecrets(CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks)),
|
...CloudRunnerCommandHooks.getSecrets(CloudRunnerCommandHooks.getHooks(buildParameters.commandHooks)),
|
||||||
]
|
]
|
||||||
.filter(
|
.filter(
|
||||||
(x) =>
|
(x) =>
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import CloudRunnerOptions from '../cloud-runner-options';
|
import CloudRunnerOptions from '../cloud-runner-options';
|
||||||
import setups from './cloud-runner-suite.test';
|
import setups from './cloud-runner-suite.test';
|
||||||
import { CloudRunnerCustomSteps } from '../services/cloud-runner-custom-steps';
|
import { CloudRunnerContainerHook } from '../services/cloud-runner-hooks/cloud-runner-container-hook';
|
||||||
import { CloudRunnerCustomHooks } from '../services/cloud-runner-custom-hooks';
|
import { CloudRunnerCommandHooks } from '../services/cloud-runner-hooks/cloud-runner-command-hook';
|
||||||
|
|
||||||
async function CreateParameters(overrides: any) {
|
async function CreateParameters(overrides: any) {
|
||||||
if (overrides) {
|
if (overrides) {
|
||||||
|
|
@ -33,8 +33,8 @@ commands: echo "test"`;
|
||||||
cacheKey: `test-case-${uuidv4()}`,
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
};
|
};
|
||||||
CloudRunner.setup(await CreateParameters(overrides));
|
CloudRunner.setup(await CreateParameters(overrides));
|
||||||
const stringObject = CloudRunnerCustomSteps.ParseSteps(yamlString);
|
const stringObject = CloudRunnerContainerHook.ParseContainerHooks(yamlString);
|
||||||
const stringObject2 = CloudRunnerCustomSteps.ParseSteps(yamlString2);
|
const stringObject2 = CloudRunnerContainerHook.ParseContainerHooks(yamlString2);
|
||||||
|
|
||||||
CloudRunnerLogger.log(yamlString);
|
CloudRunnerLogger.log(yamlString);
|
||||||
CloudRunnerLogger.log(JSON.stringify(stringObject, undefined, 4));
|
CloudRunnerLogger.log(JSON.stringify(stringObject, undefined, 4));
|
||||||
|
|
@ -44,7 +44,7 @@ commands: echo "test"`;
|
||||||
expect(stringObject2.length).toBe(1);
|
expect(stringObject2.length).toBe(1);
|
||||||
expect(stringObject2[0].hook).toBe(`before`);
|
expect(stringObject2[0].hook).toBe(`before`);
|
||||||
|
|
||||||
const getCustomStepsFromFiles = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
|
const getCustomStepsFromFiles = CloudRunnerContainerHook.GetContainerHooksFromFiles(`before`);
|
||||||
CloudRunnerLogger.log(JSON.stringify(getCustomStepsFromFiles, undefined, 4));
|
CloudRunnerLogger.log(JSON.stringify(getCustomStepsFromFiles, undefined, 4));
|
||||||
});
|
});
|
||||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.providerStrategy !== `k8s`) {
|
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.providerStrategy !== `k8s`) {
|
||||||
|
|
@ -55,13 +55,13 @@ commands: echo "test"`;
|
||||||
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
targetPlatform: 'StandaloneLinux64',
|
targetPlatform: 'StandaloneLinux64',
|
||||||
cacheKey: `test-case-${uuidv4()}`,
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
customStepFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
containerHookFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
||||||
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
||||||
};
|
};
|
||||||
const buildParameter2 = await CreateParameters(overrides);
|
const buildParameter2 = await CreateParameters(overrides);
|
||||||
await CloudRunner.setup(buildParameter2);
|
await CloudRunner.setup(buildParameter2);
|
||||||
const beforeHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`before`);
|
const beforeHooks = CloudRunnerCommandHooks.GetCustomHooksFromFiles(`before`);
|
||||||
const afterHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`after`);
|
const afterHooks = CloudRunnerCommandHooks.GetCustomHooksFromFiles(`after`);
|
||||||
expect(beforeHooks).toHaveLength(1);
|
expect(beforeHooks).toHaveLength(1);
|
||||||
expect(afterHooks).toHaveLength(1);
|
expect(afterHooks).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
@ -72,13 +72,13 @@ commands: echo "test"`;
|
||||||
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
targetPlatform: 'StandaloneLinux64',
|
targetPlatform: 'StandaloneLinux64',
|
||||||
cacheKey: `test-case-${uuidv4()}`,
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
customStepFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
containerHookFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
||||||
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
||||||
};
|
};
|
||||||
const buildParameter2 = await CreateParameters(overrides);
|
const buildParameter2 = await CreateParameters(overrides);
|
||||||
await CloudRunner.setup(buildParameter2);
|
await CloudRunner.setup(buildParameter2);
|
||||||
const beforeSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
|
const beforeSteps = CloudRunnerContainerHook.GetContainerHooksFromFiles(`before`);
|
||||||
const afterSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`after`);
|
const afterSteps = CloudRunnerContainerHook.GetContainerHooksFromFiles(`after`);
|
||||||
expect(beforeSteps).toHaveLength(1);
|
expect(beforeSteps).toHaveLength(1);
|
||||||
expect(afterSteps).toHaveLength(1);
|
expect(afterSteps).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
@ -89,7 +89,7 @@ commands: echo "test"`;
|
||||||
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
targetPlatform: 'StandaloneLinux64',
|
targetPlatform: 'StandaloneLinux64',
|
||||||
cacheKey: `test-case-${uuidv4()}`,
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
customStepFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
containerHookFiles: `my-test-step-pre-build,my-test-step-post-build`,
|
||||||
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
|
||||||
};
|
};
|
||||||
const buildParameter2 = await CreateParameters(overrides);
|
const buildParameter2 = await CreateParameters(overrides);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ describe('Cloud Runner pre-built S3 steps', () => {
|
||||||
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
targetPlatform: 'StandaloneLinux64',
|
targetPlatform: 'StandaloneLinux64',
|
||||||
cacheKey: `test-case-${uuidv4()}`,
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
customStepFiles: `aws-s3-pull-cache,aws-s3-upload-cache,aws-s3-upload-build`,
|
containerHookFiles: `aws-s3-pull-cache,aws-s3-upload-cache,aws-s3-upload-build`,
|
||||||
};
|
};
|
||||||
const buildParameter2 = await CreateParameters(overrides);
|
const buildParameter2 = await CreateParameters(overrides);
|
||||||
const baseImage2 = new ImageTag(buildParameter2);
|
const baseImage2 = new ImageTag(buildParameter2);
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ describe('Cloud Runner Caching', () => {
|
||||||
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
targetPlatform: 'StandaloneLinux64',
|
targetPlatform: 'StandaloneLinux64',
|
||||||
cacheKey: `test-case-${uuidv4()}`,
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
customStepFiles: `debug-cache`,
|
containerHookFiles: `debug-cache`,
|
||||||
};
|
};
|
||||||
if (CloudRunnerOptions.providerStrategy === `k8s`) {
|
if (CloudRunnerOptions.providerStrategy === `k8s`) {
|
||||||
overrides.customStepFiles += `,aws-s3-pull-cache,aws-s3-upload-cache`;
|
overrides.containerHookFiles += `,aws-s3-pull-cache,aws-s3-upload-cache`;
|
||||||
}
|
}
|
||||||
const buildParameter = await CreateParameters(overrides);
|
const buildParameter = await CreateParameters(overrides);
|
||||||
expect(buildParameter.projectPath).toEqual(overrides.projectPath);
|
expect(buildParameter.projectPath).toEqual(overrides.projectPath);
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import { CloudRunnerFolders } from '../services/cloud-runner-folders';
|
||||||
import { CloudRunnerStepState } from '../cloud-runner-step-state';
|
import { CloudRunnerStepState } from '../cloud-runner-step-state';
|
||||||
import { WorkflowInterface } from './workflow-interface';
|
import { WorkflowInterface } from './workflow-interface';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { CloudRunnerCustomHooks } from '../services/cloud-runner-custom-hooks';
|
import { CloudRunnerCommandHooks } from '../services/cloud-runner-hooks/cloud-runner-command-hook';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import CloudRunner from '../cloud-runner';
|
import CloudRunner from '../cloud-runner';
|
||||||
import { CloudRunnerCustomSteps } from '../services/cloud-runner-custom-steps';
|
import { CloudRunnerContainerHook } from '../services/cloud-runner-hooks/cloud-runner-container-hook';
|
||||||
|
|
||||||
export class BuildAutomationWorkflow implements WorkflowInterface {
|
export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
async run(cloudRunnerStepState: CloudRunnerStepState) {
|
async run(cloudRunnerStepState: CloudRunnerStepState) {
|
||||||
|
|
@ -19,7 +19,7 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
|
|
||||||
let output = '';
|
let output = '';
|
||||||
|
|
||||||
output += await CloudRunnerCustomSteps.RunPreBuildSteps(cloudRunnerStepState);
|
output += await CloudRunnerContainerHook.RunPreBuildSteps(cloudRunnerStepState);
|
||||||
CloudRunnerLogger.logWithTime('Configurable pre build step(s) time');
|
CloudRunnerLogger.logWithTime('Configurable pre build step(s) time');
|
||||||
|
|
||||||
if (!CloudRunner.buildParameters.isCliMode) core.startGroup('build');
|
if (!CloudRunner.buildParameters.isCliMode) core.startGroup('build');
|
||||||
|
|
@ -39,7 +39,7 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
if (!CloudRunner.buildParameters.isCliMode) core.endGroup();
|
if (!CloudRunner.buildParameters.isCliMode) core.endGroup();
|
||||||
CloudRunnerLogger.logWithTime('Build time');
|
CloudRunnerLogger.logWithTime('Build time');
|
||||||
|
|
||||||
output += await CloudRunnerCustomSteps.RunPostBuildSteps(cloudRunnerStepState);
|
output += await CloudRunnerContainerHook.RunPostBuildSteps(cloudRunnerStepState);
|
||||||
CloudRunnerLogger.logWithTime('Configurable post build step(s) time');
|
CloudRunnerLogger.logWithTime('Configurable post build step(s) time');
|
||||||
|
|
||||||
CloudRunnerLogger.log(`Cloud Runner finished running standard build automation`);
|
CloudRunnerLogger.log(`Cloud Runner finished running standard build automation`);
|
||||||
|
|
@ -48,10 +48,10 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static get BuildWorkflow() {
|
private static get BuildWorkflow() {
|
||||||
const setupHooks = CloudRunnerCustomHooks.getHooks(CloudRunner.buildParameters.commandHooks).filter((x) =>
|
const setupHooks = CloudRunnerCommandHooks.getHooks(CloudRunner.buildParameters.commandHooks).filter((x) =>
|
||||||
x.step?.includes(`setup`),
|
x.step?.includes(`setup`),
|
||||||
);
|
);
|
||||||
const buildHooks = CloudRunnerCustomHooks.getHooks(CloudRunner.buildParameters.commandHooks).filter((x) =>
|
const buildHooks = CloudRunnerCommandHooks.getHooks(CloudRunner.buildParameters.commandHooks).filter((x) =>
|
||||||
x.step?.includes(`build`),
|
x.step?.includes(`build`),
|
||||||
);
|
);
|
||||||
const builderPath = CloudRunnerFolders.ToLinuxFolder(
|
const builderPath = CloudRunnerFolders.ToLinuxFolder(
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||||
import CloudRunnerSecret from '../services/cloud-runner-secret';
|
import CloudRunnerSecret from '../services/cloud-runner-secret';
|
||||||
import { CloudRunnerFolders } from '../services/cloud-runner-folders';
|
import { CloudRunnerFolders } from '../services/cloud-runner-folders';
|
||||||
import CloudRunnerEnvironmentVariable from '../services/cloud-runner-environment-variable';
|
import CloudRunnerEnvironmentVariable from '../services/cloud-runner-environment-variable';
|
||||||
import { CloudRunnerCustomSteps } from '../services/cloud-runner-custom-steps';
|
import { CloudRunnerContainerHook } from '../services/cloud-runner-hooks/cloud-runner-container-hook';
|
||||||
import { CustomStep } from '../services/custom-step';
|
import { ContainerHook } from '../services/cloud-runner-hooks/container-hook';
|
||||||
import CloudRunner from '../cloud-runner';
|
import CloudRunner from '../cloud-runner';
|
||||||
|
|
||||||
export class CustomWorkflow {
|
export class CustomWorkflow {
|
||||||
|
|
@ -13,14 +13,14 @@ export class CustomWorkflow {
|
||||||
secrets: CloudRunnerSecret[],
|
secrets: CloudRunnerSecret[],
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return await CustomWorkflow.runContainerJob(
|
return await CustomWorkflow.runContainerJob(
|
||||||
CloudRunnerCustomSteps.ParseSteps(buildSteps),
|
CloudRunnerContainerHook.ParseContainerHooks(buildSteps),
|
||||||
environmentVariables,
|
environmentVariables,
|
||||||
secrets,
|
secrets,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async runContainerJob(
|
public static async runContainerJob(
|
||||||
steps: CustomStep[],
|
steps: ContainerHook[],
|
||||||
environmentVariables: CloudRunnerEnvironmentVariable[],
|
environmentVariables: CloudRunnerEnvironmentVariable[],
|
||||||
secrets: CloudRunnerSecret[],
|
secrets: CloudRunnerSecret[],
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue