cloud runner options
parent
dcbdfba6ad
commit
2b7c589c7b
|
|
@ -220,6 +220,8 @@ const versioning_1 = __importDefault(__nccwpck_require__(93901));
|
|||
const git_repo_1 = __nccwpck_require__(24271);
|
||||
const github_cli_1 = __nccwpck_require__(44990);
|
||||
const cli_1 = __nccwpck_require__(55651);
|
||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class BuildParameters {
|
||||
static create() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
@ -231,7 +233,7 @@ class BuildParameters {
|
|||
// Todo - Don't use process.env directly, that's what the input model class is for.
|
||||
// ---
|
||||
let unitySerial = '';
|
||||
if (!process.env.UNITY_SERIAL && input_1.default.githubInputEnabled) {
|
||||
if (!process.env.UNITY_SERIAL && github_1.default.githubInputEnabled) {
|
||||
// No serial was present, so it is a personal license that we need to convert
|
||||
if (!process.env.UNITY_LICENSE) {
|
||||
throw new Error(`Missing Unity License File and no Serial was found. If this
|
||||
|
|
@ -268,36 +270,36 @@ class BuildParameters {
|
|||
sshAgent: input_1.default.sshAgent,
|
||||
gitPrivateToken: input_1.default.gitPrivateToken || (yield github_cli_1.GithubCliReader.GetGitHubAuthToken()),
|
||||
chownFilesTo: input_1.default.chownFilesTo,
|
||||
cloudRunnerCluster: input_1.default.cloudRunnerCluster,
|
||||
cloudRunnerBuilderPlatform: input_1.default.cloudRunnerBuilderPlatform,
|
||||
awsBaseStackName: input_1.default.awsBaseStackName,
|
||||
kubeConfig: input_1.default.kubeConfig,
|
||||
cloudRunnerMemory: input_1.default.cloudRunnerMemory,
|
||||
cloudRunnerCpu: input_1.default.cloudRunnerCpu,
|
||||
kubeVolumeSize: input_1.default.kubeVolumeSize,
|
||||
kubeVolume: input_1.default.kubeVolume,
|
||||
postBuildSteps: input_1.default.postBuildSteps,
|
||||
preBuildSteps: input_1.default.preBuildSteps,
|
||||
customJob: input_1.default.customJob,
|
||||
cloudRunnerCluster: cloud_runner_options_1.default.cloudRunnerCluster,
|
||||
cloudRunnerBuilderPlatform: cloud_runner_options_1.default.cloudRunnerBuilderPlatform,
|
||||
awsBaseStackName: cloud_runner_options_1.default.awsBaseStackName,
|
||||
kubeConfig: cloud_runner_options_1.default.kubeConfig,
|
||||
cloudRunnerMemory: cloud_runner_options_1.default.cloudRunnerMemory,
|
||||
cloudRunnerCpu: cloud_runner_options_1.default.cloudRunnerCpu,
|
||||
kubeVolumeSize: cloud_runner_options_1.default.kubeVolumeSize,
|
||||
kubeVolume: cloud_runner_options_1.default.kubeVolume,
|
||||
postBuildSteps: cloud_runner_options_1.default.postBuildSteps,
|
||||
preBuildSteps: cloud_runner_options_1.default.preBuildSteps,
|
||||
customJob: cloud_runner_options_1.default.customJob,
|
||||
runNumber: input_1.default.runNumber,
|
||||
branch: input_1.default.branch.replace('/head', '') || (yield git_repo_1.GitRepoReader.GetBranch()),
|
||||
cloudRunnerBranch: input_1.default.cloudRunnerBranch.split('/').reverse()[0],
|
||||
cloudRunnerIntegrationTests: input_1.default.cloudRunnerTests,
|
||||
cloudRunnerBranch: cloud_runner_options_1.default.cloudRunnerBranch.split('/').reverse()[0],
|
||||
cloudRunnerIntegrationTests: cloud_runner_options_1.default.cloudRunnerTests,
|
||||
githubRepo: input_1.default.githubRepo || (yield git_repo_1.GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
|
||||
isCliMode: cli_1.Cli.isCliMode,
|
||||
awsStackName: input_1.default.awsBaseStackName,
|
||||
awsStackName: cloud_runner_options_1.default.awsBaseStackName,
|
||||
gitSha: input_1.default.gitSha,
|
||||
logId: nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 9)(),
|
||||
buildGuid: cloud_runner_guid_1.default.generateGuid(input_1.default.runNumber, input_1.default.targetPlatform),
|
||||
customJobHooks: input_1.default.customJobHooks(),
|
||||
cachePullOverrideCommand: input_1.default.cachePullOverrideCommand(),
|
||||
cachePushOverrideCommand: input_1.default.cachePushOverrideCommand(),
|
||||
readInputOverrideCommand: input_1.default.readInputOverrideCommand(),
|
||||
readInputFromOverrideList: input_1.default.readInputFromOverrideList(),
|
||||
kubeStorageClass: input_1.default.kubeStorageClass,
|
||||
checkDependencyHealthOverride: input_1.default.checkDependencyHealthOverride,
|
||||
startDependenciesOverride: input_1.default.startDependenciesOverride,
|
||||
cacheKey: input_1.default.cacheKey,
|
||||
customJobHooks: cloud_runner_options_1.default.customJobHooks(),
|
||||
cachePullOverrideCommand: cloud_runner_options_1.default.cachePullOverrideCommand(),
|
||||
cachePushOverrideCommand: cloud_runner_options_1.default.cachePushOverrideCommand(),
|
||||
readInputOverrideCommand: cloud_runner_options_1.default.readInputOverrideCommand(),
|
||||
readInputFromOverrideList: cloud_runner_options_1.default.readInputFromOverrideList(),
|
||||
kubeStorageClass: cloud_runner_options_1.default.kubeStorageClass,
|
||||
checkDependencyHealthOverride: cloud_runner_options_1.default.checkDependencyHealthOverride,
|
||||
startDependenciesOverride: cloud_runner_options_1.default.startDependenciesOverride,
|
||||
cacheKey: cloud_runner_options_1.default.cacheKey,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
@ -483,6 +485,8 @@ const aws_cli_commands_1 = __nccwpck_require__(34340);
|
|||
const caching_1 = __nccwpck_require__(32885);
|
||||
const lfs_hashing_1 = __nccwpck_require__(8915);
|
||||
const remote_client_1 = __nccwpck_require__(48135);
|
||||
const cloud_runner_options_reader_1 = __importDefault(__nccwpck_require__(3343));
|
||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||
class Cli {
|
||||
static get isCliMode() {
|
||||
return Cli.options !== undefined && Cli.options.mode !== undefined && Cli.options.mode !== '';
|
||||
|
|
@ -503,7 +507,7 @@ class Cli {
|
|||
cli_functions_repository_1.CliFunctionsRepository.PushCliFunctionSource(remote_client_1.RemoteClient);
|
||||
const program = new commander_ts_1.Command();
|
||||
program.version('0.0.1');
|
||||
const properties = Object.getOwnPropertyNames(__1.Input);
|
||||
const properties = cloud_runner_options_reader_1.default.GetProperties();
|
||||
const actionYamlReader = new action_yaml_1.ActionYamlReader();
|
||||
for (const element of properties) {
|
||||
program.option(`--${element} <${element}>`, actionYamlReader.GetActionYamlValue(element));
|
||||
|
|
@ -521,7 +525,7 @@ class Cli {
|
|||
}
|
||||
static RunCli() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
__1.Input.githubInputEnabled = false;
|
||||
github_1.default.githubInputEnabled = false;
|
||||
if (Cli.options['populateOverride'] === `true`) {
|
||||
yield cloud_runner_query_override_1.default.PopulateQueryOverrideInput();
|
||||
}
|
||||
|
|
@ -537,7 +541,7 @@ class Cli {
|
|||
static logInput() {
|
||||
core.info(`\n`);
|
||||
core.info(`INPUT:`);
|
||||
const properties = Object.getOwnPropertyNames(__1.Input);
|
||||
const properties = cloud_runner_options_reader_1.default.GetProperties();
|
||||
for (const element of properties) {
|
||||
if (__1.Input[element] !== undefined &&
|
||||
__1.Input[element] !== '' &&
|
||||
|
|
@ -567,6 +571,160 @@ __decorate([
|
|||
exports.Cli = Cli;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 96552:
|
||||
/***/ (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 cli_1 = __nccwpck_require__(55651);
|
||||
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||
const core = __nccwpck_require__(42186);
|
||||
class CloudRunnerOptions {
|
||||
static getInput(query) {
|
||||
if (github_1.default.githubInputEnabled) {
|
||||
const coreInput = core.getInput(query);
|
||||
if (coreInput && coreInput !== '') {
|
||||
return coreInput;
|
||||
}
|
||||
}
|
||||
const alternativeQuery = CloudRunnerOptions.ToEnvVarFormat(query);
|
||||
// Query input sources
|
||||
if (cli_1.Cli.query(query, alternativeQuery)) {
|
||||
return cli_1.Cli.query(query, alternativeQuery);
|
||||
}
|
||||
if (cloud_runner_query_override_1.default.query(query, alternativeQuery)) {
|
||||
return cloud_runner_query_override_1.default.query(query, alternativeQuery);
|
||||
}
|
||||
if (process.env[query] !== undefined) {
|
||||
return process.env[query];
|
||||
}
|
||||
if (alternativeQuery !== query && process.env[alternativeQuery] !== undefined) {
|
||||
return process.env[alternativeQuery];
|
||||
}
|
||||
return;
|
||||
}
|
||||
static get region() {
|
||||
return CloudRunnerOptions.getInput('region') || 'eu-west-2';
|
||||
}
|
||||
static get githubRepo() {
|
||||
return CloudRunnerOptions.getInput('GITHUB_REPOSITORY') || CloudRunnerOptions.getInput('GITHUB_REPO') || undefined;
|
||||
}
|
||||
static get branch() {
|
||||
if (CloudRunnerOptions.getInput(`GITHUB_REF`)) {
|
||||
return CloudRunnerOptions.getInput(`GITHUB_REF`).replace('refs/', '').replace(`head/`, '').replace(`heads/`, '');
|
||||
}
|
||||
else if (CloudRunnerOptions.getInput('branch')) {
|
||||
return CloudRunnerOptions.getInput('branch');
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
static get cloudRunnerBuilderPlatform() {
|
||||
const input = CloudRunnerOptions.getInput('cloudRunnerBuilderPlatform');
|
||||
if (input) {
|
||||
return input;
|
||||
}
|
||||
if (CloudRunnerOptions.cloudRunnerCluster !== 'local') {
|
||||
return 'linux';
|
||||
}
|
||||
return;
|
||||
}
|
||||
static get gitSha() {
|
||||
if (CloudRunnerOptions.getInput(`GITHUB_SHA`)) {
|
||||
return CloudRunnerOptions.getInput(`GITHUB_SHA`);
|
||||
}
|
||||
else if (CloudRunnerOptions.getInput(`GitSHA`)) {
|
||||
return CloudRunnerOptions.getInput(`GitSHA`);
|
||||
}
|
||||
}
|
||||
static get customJob() {
|
||||
return CloudRunnerOptions.getInput('customJob') || '';
|
||||
}
|
||||
static customJobHooks() {
|
||||
return CloudRunnerOptions.getInput('customJobHooks') || '';
|
||||
}
|
||||
static cachePushOverrideCommand() {
|
||||
return CloudRunnerOptions.getInput('cachePushOverrideCommand') || '';
|
||||
}
|
||||
static cachePullOverrideCommand() {
|
||||
return CloudRunnerOptions.getInput('cachePullOverrideCommand') || '';
|
||||
}
|
||||
static readInputFromOverrideList() {
|
||||
return CloudRunnerOptions.getInput('readInputFromOverrideList') || '';
|
||||
}
|
||||
static readInputOverrideCommand() {
|
||||
return CloudRunnerOptions.getInput('readInputOverrideCommand') || '';
|
||||
}
|
||||
static get cloudRunnerBranch() {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerBranch') || 'cloud-runner-develop';
|
||||
}
|
||||
static get postBuildSteps() {
|
||||
return CloudRunnerOptions.getInput('postBuildSteps') || '';
|
||||
}
|
||||
static get preBuildSteps() {
|
||||
return CloudRunnerOptions.getInput('preBuildSteps') || '';
|
||||
}
|
||||
static get awsBaseStackName() {
|
||||
return CloudRunnerOptions.getInput('awsBaseStackName') || 'game-ci';
|
||||
}
|
||||
static get cloudRunnerCluster() {
|
||||
if (cli_1.Cli.isCliMode) {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerCluster') || 'aws';
|
||||
}
|
||||
return CloudRunnerOptions.getInput('cloudRunnerCluster') || 'local';
|
||||
}
|
||||
static get cloudRunnerCpu() {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerCpu');
|
||||
}
|
||||
static get cloudRunnerMemory() {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerMemory');
|
||||
}
|
||||
static get kubeConfig() {
|
||||
return CloudRunnerOptions.getInput('kubeConfig') || '';
|
||||
}
|
||||
static get kubeVolume() {
|
||||
return CloudRunnerOptions.getInput('kubeVolume') || '';
|
||||
}
|
||||
static get kubeVolumeSize() {
|
||||
return CloudRunnerOptions.getInput('kubeVolumeSize') || '5Gi';
|
||||
}
|
||||
static get kubeStorageClass() {
|
||||
return CloudRunnerOptions.getInput('kubeStorageClass') || '';
|
||||
}
|
||||
static get checkDependencyHealthOverride() {
|
||||
return CloudRunnerOptions.getInput('checkDependencyHealthOverride') || '';
|
||||
}
|
||||
static get startDependenciesOverride() {
|
||||
return CloudRunnerOptions.getInput('startDependenciesOverride') || '';
|
||||
}
|
||||
static get cacheKey() {
|
||||
return CloudRunnerOptions.getInput('cacheKey') || CloudRunnerOptions.branch;
|
||||
}
|
||||
static get cloudRunnerTests() {
|
||||
return CloudRunnerOptions.getInput(`cloudRunnerTests`) || false;
|
||||
}
|
||||
static ToEnvVarFormat(input) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
}
|
||||
return input
|
||||
.replace(/([A-Z])/g, ' $1')
|
||||
.trim()
|
||||
.toUpperCase()
|
||||
.replace(/ /g, '_');
|
||||
}
|
||||
}
|
||||
exports["default"] = CloudRunnerOptions;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 90828:
|
||||
|
|
@ -2383,7 +2541,7 @@ class TaskService {
|
|||
if (list.length > 0) {
|
||||
const describeInput = { tasks: list, cluster: element };
|
||||
const describeList = (yield ecs.describeTasks(describeInput).promise()).tasks || [];
|
||||
if (describeList === []) {
|
||||
if (describeList.length === 0) {
|
||||
continue;
|
||||
}
|
||||
cloud_runner_logger_1.default.log(`Tasks ${describeList.length}`);
|
||||
|
|
@ -4015,6 +4173,27 @@ class CloudRunnerLogger {
|
|||
exports["default"] = CloudRunnerLogger;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3343:
|
||||
/***/ (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 input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class CloudRunnerOptionsReader {
|
||||
static GetProperties() {
|
||||
return [...Object.getOwnPropertyNames(input_1.default), ...Object.getOwnPropertyNames(cloud_runner_options_1.default)];
|
||||
}
|
||||
}
|
||||
exports["default"] = CloudRunnerOptionsReader;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 31011:
|
||||
|
|
@ -4037,6 +4216,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const generic_input_reader_1 = __nccwpck_require__(2263);
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
const formatFunction = (value, arguments_) => {
|
||||
for (const element of arguments_) {
|
||||
value = value.replace(`{${element.key}}`, element.value);
|
||||
|
|
@ -4056,10 +4236,10 @@ class CloudRunnerQueryOverride {
|
|||
return;
|
||||
}
|
||||
static shouldUseOverride(query) {
|
||||
if (input_1.default.readInputOverrideCommand() !== '') {
|
||||
if (input_1.default.readInputFromOverrideList() !== '') {
|
||||
const doesInclude = input_1.default.readInputFromOverrideList().split(',').includes(query) ||
|
||||
input_1.default.readInputFromOverrideList().split(',').includes(input_1.default.ToEnvVarFormat(query));
|
||||
if (cloud_runner_options_1.default.readInputOverrideCommand() !== '') {
|
||||
if (cloud_runner_options_1.default.readInputFromOverrideList() !== '') {
|
||||
const doesInclude = cloud_runner_options_1.default.readInputFromOverrideList().split(',').includes(query) ||
|
||||
cloud_runner_options_1.default.readInputFromOverrideList().split(',').includes(input_1.default.ToEnvVarFormat(query));
|
||||
return doesInclude ? true : false;
|
||||
}
|
||||
else {
|
||||
|
|
@ -4072,12 +4252,12 @@ class CloudRunnerQueryOverride {
|
|||
if (!this.shouldUseOverride(query)) {
|
||||
throw new Error(`Should not be trying to run override query on ${query}`);
|
||||
}
|
||||
return yield generic_input_reader_1.GenericInputReader.Run(formatFunction(input_1.default.readInputOverrideCommand(), [{ key: 0, value: query }]));
|
||||
return yield generic_input_reader_1.GenericInputReader.Run(formatFunction(cloud_runner_options_1.default.readInputOverrideCommand(), [{ key: 0, value: query }]));
|
||||
});
|
||||
}
|
||||
static PopulateQueryOverrideInput() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const queries = input_1.default.readInputFromOverrideList().split(',');
|
||||
const queries = cloud_runner_options_1.default.readInputFromOverrideList().split(',');
|
||||
CloudRunnerQueryOverride.queryOverrides = new Array();
|
||||
for (const element of queries) {
|
||||
if (CloudRunnerQueryOverride.shouldUseOverride(element)) {
|
||||
|
|
@ -4177,14 +4357,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class DependencyOverrideService {
|
||||
static CheckHealth() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (input_1.default.checkDependencyHealthOverride) {
|
||||
if (cloud_runner_options_1.default.checkDependencyHealthOverride) {
|
||||
try {
|
||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(input_1.default.checkDependencyHealthOverride);
|
||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(cloud_runner_options_1.default.checkDependencyHealthOverride);
|
||||
}
|
||||
catch (_a) {
|
||||
return false;
|
||||
|
|
@ -4195,8 +4375,8 @@ class DependencyOverrideService {
|
|||
}
|
||||
static TryStartDependencies() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (input_1.default.startDependenciesOverride) {
|
||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(input_1.default.startDependenciesOverride);
|
||||
if (cloud_runner_options_1.default.startDependenciesOverride) {
|
||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(cloud_runner_options_1.default.startDependenciesOverride);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -4372,6 +4552,7 @@ const __1 = __nccwpck_require__(41359);
|
|||
const image_environment_factory_1 = __importDefault(__nccwpck_require__(25145));
|
||||
const cloud_runner_custom_hooks_1 = __nccwpck_require__(58873);
|
||||
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
||||
const cloud_runner_options_reader_1 = __importDefault(__nccwpck_require__(3343));
|
||||
class TaskParameterSerializer {
|
||||
static readBuildEnvironmentVariables() {
|
||||
return [
|
||||
|
|
@ -4420,7 +4601,7 @@ class TaskParameterSerializer {
|
|||
return array;
|
||||
}
|
||||
static readInput(array) {
|
||||
const input = Object.getOwnPropertyNames(__1.Input);
|
||||
const input = cloud_runner_options_reader_1.default.GetProperties();
|
||||
for (const element of input) {
|
||||
if (typeof __1.Input[element] !== 'function' && array.filter((x) => x.name === element).length === 0) {
|
||||
array.push({
|
||||
|
|
@ -4852,6 +5033,20 @@ class ValidationError extends Error {
|
|||
exports["default"] = ValidationError;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 83654:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
class GitHub {
|
||||
}
|
||||
GitHub.githubInputEnabled = true;
|
||||
exports["default"] = GitHub;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 25145:
|
||||
|
|
@ -5168,11 +5363,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.GenericInputReader = void 0;
|
||||
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class GenericInputReader {
|
||||
static Run(command) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (input_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
return yield cloud_runner_system_1.CloudRunnerSystem.Run(command, false, true);
|
||||
|
|
@ -5207,11 +5402,11 @@ const console_1 = __nccwpck_require__(96206);
|
|||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class GitRepoReader {
|
||||
static GetRemote() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (input_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
console_1.assert(fs_1.default.existsSync(`.git`));
|
||||
|
|
@ -5223,7 +5418,7 @@ class GitRepoReader {
|
|||
}
|
||||
static GetBranch() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (input_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
console_1.assert(fs_1.default.existsSync(`.git`));
|
||||
|
|
@ -5279,11 +5474,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
exports.GithubCliReader = void 0;
|
||||
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
||||
const core = __importStar(__nccwpck_require__(42186));
|
||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class GithubCliReader {
|
||||
static GetGitHubAuthToken() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (input_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
|
|
@ -5321,9 +5516,9 @@ exports.ReadLicense = void 0;
|
|||
const path_1 = __importDefault(__nccwpck_require__(71017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
function ReadLicense() {
|
||||
if (input_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
const pipelineFile = path_1.default.join(__dirname, `.github`, `workflows`, `cloud-runner-k8s-pipeline.yml`);
|
||||
|
|
@ -5348,6 +5543,7 @@ const path_1 = __importDefault(__nccwpck_require__(71017));
|
|||
const cli_1 = __nccwpck_require__(55651);
|
||||
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
||||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||
const core = __nccwpck_require__(42186);
|
||||
/**
|
||||
* Input variables specified in workflows using "with" prop.
|
||||
|
|
@ -5358,7 +5554,7 @@ const core = __nccwpck_require__(42186);
|
|||
*/
|
||||
class Input {
|
||||
static getInput(query) {
|
||||
if (Input.githubInputEnabled) {
|
||||
if (github_1.default.githubInputEnabled) {
|
||||
const coreInput = core.getInput(query);
|
||||
if (coreInput && coreInput !== '') {
|
||||
return coreInput;
|
||||
|
|
@ -5397,16 +5593,6 @@ class Input {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
static get cloudRunnerBuilderPlatform() {
|
||||
const input = Input.getInput('cloudRunnerBuilderPlatform');
|
||||
if (input) {
|
||||
return input;
|
||||
}
|
||||
if (Input.cloudRunnerCluster !== 'local') {
|
||||
return 'linux';
|
||||
}
|
||||
return;
|
||||
}
|
||||
static get gitSha() {
|
||||
if (Input.getInput(`GITHUB_SHA`)) {
|
||||
return Input.getInput(`GITHUB_SHA`);
|
||||
|
|
@ -5486,27 +5672,6 @@ class Input {
|
|||
static get gitPrivateToken() {
|
||||
return core.getInput('gitPrivateToken') || false;
|
||||
}
|
||||
static get customJob() {
|
||||
return Input.getInput('customJob') || '';
|
||||
}
|
||||
static customJobHooks() {
|
||||
return Input.getInput('customJobHooks') || '';
|
||||
}
|
||||
static cachePushOverrideCommand() {
|
||||
return Input.getInput('cachePushOverrideCommand') || '';
|
||||
}
|
||||
static cachePullOverrideCommand() {
|
||||
return Input.getInput('cachePullOverrideCommand') || '';
|
||||
}
|
||||
static readInputFromOverrideList() {
|
||||
return Input.getInput('readInputFromOverrideList') || '';
|
||||
}
|
||||
static readInputOverrideCommand() {
|
||||
return Input.getInput('readInputOverrideCommand') || '';
|
||||
}
|
||||
static get cloudRunnerBranch() {
|
||||
return Input.getInput('cloudRunnerBranch') || 'cloud-runner-develop';
|
||||
}
|
||||
static get chownFilesTo() {
|
||||
return Input.getInput('chownFilesTo') || '';
|
||||
}
|
||||
|
|
@ -5514,51 +5679,6 @@ class Input {
|
|||
const input = Input.getInput('allowDirtyBuild') || false;
|
||||
return input === 'true';
|
||||
}
|
||||
static get postBuildSteps() {
|
||||
return Input.getInput('postBuildSteps') || '';
|
||||
}
|
||||
static get preBuildSteps() {
|
||||
return Input.getInput('preBuildSteps') || '';
|
||||
}
|
||||
static get awsBaseStackName() {
|
||||
return Input.getInput('awsBaseStackName') || 'game-ci';
|
||||
}
|
||||
static get cloudRunnerCluster() {
|
||||
if (cli_1.Cli.isCliMode) {
|
||||
return Input.getInput('cloudRunnerCluster') || 'aws';
|
||||
}
|
||||
return Input.getInput('cloudRunnerCluster') || 'local';
|
||||
}
|
||||
static get cloudRunnerCpu() {
|
||||
return Input.getInput('cloudRunnerCpu');
|
||||
}
|
||||
static get cloudRunnerMemory() {
|
||||
return Input.getInput('cloudRunnerMemory');
|
||||
}
|
||||
static get kubeConfig() {
|
||||
return Input.getInput('kubeConfig') || '';
|
||||
}
|
||||
static get kubeVolume() {
|
||||
return Input.getInput('kubeVolume') || '';
|
||||
}
|
||||
static get kubeVolumeSize() {
|
||||
return Input.getInput('kubeVolumeSize') || '5Gi';
|
||||
}
|
||||
static get kubeStorageClass() {
|
||||
return Input.getInput('kubeStorageClass') || '';
|
||||
}
|
||||
static get checkDependencyHealthOverride() {
|
||||
return Input.getInput('checkDependencyHealthOverride') || '';
|
||||
}
|
||||
static get startDependenciesOverride() {
|
||||
return Input.getInput('startDependenciesOverride') || '';
|
||||
}
|
||||
static get cacheKey() {
|
||||
return Input.getInput('cacheKey') || Input.branch;
|
||||
}
|
||||
static get cloudRunnerTests() {
|
||||
return Input.getInput(`cloudRunnerTests`) || false;
|
||||
}
|
||||
static ToEnvVarFormat(input) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
|
@ -5570,7 +5690,6 @@ class Input {
|
|||
.replace(/ /g, '_');
|
||||
}
|
||||
}
|
||||
Input.githubInputEnabled = true;
|
||||
exports["default"] = Input;
|
||||
|
||||
|
||||
|
|
@ -134969,7 +135088,7 @@ Object.defineProperty(apiLoader.services['cloudfront'], '2016-11-25', {
|
|||
Object.defineProperty(apiLoader.services['cloudfront'], '2017-03-25', {
|
||||
get: function get() {
|
||||
var model = __nccwpck_require__(76944);
|
||||
model.paginators = (__nccwpck_require__(83654)/* .pagination */ .o);
|
||||
model.paginators = (__nccwpck_require__(34974)/* .pagination */ .o);
|
||||
model.waiters = (__nccwpck_require__(83406)/* .waiters */ .V);
|
||||
return model;
|
||||
},
|
||||
|
|
@ -385433,7 +385552,7 @@ module.exports = JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2017-03-
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 83654:
|
||||
/***/ 34974:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,6 +9,8 @@ import Versioning from './versioning';
|
|||
import { GitRepoReader } from './input-readers/git-repo';
|
||||
import { GithubCliReader } from './input-readers/github-cli';
|
||||
import { Cli } from './cli/cli';
|
||||
import GitHub from './github';
|
||||
import CloudRunnerOptions from './cloud-runner/cloud-runner-options';
|
||||
|
||||
class BuildParameters {
|
||||
public editorVersion!: string;
|
||||
|
|
@ -76,7 +78,7 @@ class BuildParameters {
|
|||
// Todo - Don't use process.env directly, that's what the input model class is for.
|
||||
// ---
|
||||
let unitySerial = '';
|
||||
if (!process.env.UNITY_SERIAL && Input.githubInputEnabled) {
|
||||
if (!process.env.UNITY_SERIAL && GitHub.githubInputEnabled) {
|
||||
// No serial was present, so it is a personal license that we need to convert
|
||||
if (!process.env.UNITY_LICENSE) {
|
||||
throw new Error(`Missing Unity License File and no Serial was found. If this
|
||||
|
|
@ -114,36 +116,36 @@ class BuildParameters {
|
|||
sshAgent: Input.sshAgent,
|
||||
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
||||
chownFilesTo: Input.chownFilesTo,
|
||||
cloudRunnerCluster: Input.cloudRunnerCluster,
|
||||
cloudRunnerBuilderPlatform: Input.cloudRunnerBuilderPlatform,
|
||||
awsBaseStackName: Input.awsBaseStackName,
|
||||
kubeConfig: Input.kubeConfig,
|
||||
cloudRunnerMemory: Input.cloudRunnerMemory,
|
||||
cloudRunnerCpu: Input.cloudRunnerCpu,
|
||||
kubeVolumeSize: Input.kubeVolumeSize,
|
||||
kubeVolume: Input.kubeVolume,
|
||||
postBuildSteps: Input.postBuildSteps,
|
||||
preBuildSteps: Input.preBuildSteps,
|
||||
customJob: Input.customJob,
|
||||
cloudRunnerCluster: CloudRunnerOptions.cloudRunnerCluster,
|
||||
cloudRunnerBuilderPlatform: CloudRunnerOptions.cloudRunnerBuilderPlatform,
|
||||
awsBaseStackName: CloudRunnerOptions.awsBaseStackName,
|
||||
kubeConfig: CloudRunnerOptions.kubeConfig,
|
||||
cloudRunnerMemory: CloudRunnerOptions.cloudRunnerMemory,
|
||||
cloudRunnerCpu: CloudRunnerOptions.cloudRunnerCpu,
|
||||
kubeVolumeSize: CloudRunnerOptions.kubeVolumeSize,
|
||||
kubeVolume: CloudRunnerOptions.kubeVolume,
|
||||
postBuildSteps: CloudRunnerOptions.postBuildSteps,
|
||||
preBuildSteps: CloudRunnerOptions.preBuildSteps,
|
||||
customJob: CloudRunnerOptions.customJob,
|
||||
runNumber: Input.runNumber,
|
||||
branch: Input.branch.replace('/head', '') || (await GitRepoReader.GetBranch()),
|
||||
cloudRunnerBranch: Input.cloudRunnerBranch.split('/').reverse()[0],
|
||||
cloudRunnerIntegrationTests: Input.cloudRunnerTests,
|
||||
cloudRunnerBranch: CloudRunnerOptions.cloudRunnerBranch.split('/').reverse()[0],
|
||||
cloudRunnerIntegrationTests: CloudRunnerOptions.cloudRunnerTests,
|
||||
githubRepo: Input.githubRepo || (await GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
|
||||
isCliMode: Cli.isCliMode,
|
||||
awsStackName: Input.awsBaseStackName,
|
||||
awsStackName: CloudRunnerOptions.awsBaseStackName,
|
||||
gitSha: Input.gitSha,
|
||||
logId: customAlphabet(CloudRunnerConstants.alphabet, 9)(),
|
||||
buildGuid: CloudRunnerBuildGuid.generateGuid(Input.runNumber, Input.targetPlatform),
|
||||
customJobHooks: Input.customJobHooks(),
|
||||
cachePullOverrideCommand: Input.cachePullOverrideCommand(),
|
||||
cachePushOverrideCommand: Input.cachePushOverrideCommand(),
|
||||
readInputOverrideCommand: Input.readInputOverrideCommand(),
|
||||
readInputFromOverrideList: Input.readInputFromOverrideList(),
|
||||
kubeStorageClass: Input.kubeStorageClass,
|
||||
checkDependencyHealthOverride: Input.checkDependencyHealthOverride,
|
||||
startDependenciesOverride: Input.startDependenciesOverride,
|
||||
cacheKey: Input.cacheKey,
|
||||
customJobHooks: CloudRunnerOptions.customJobHooks(),
|
||||
cachePullOverrideCommand: CloudRunnerOptions.cachePullOverrideCommand(),
|
||||
cachePushOverrideCommand: CloudRunnerOptions.cachePushOverrideCommand(),
|
||||
readInputOverrideCommand: CloudRunnerOptions.readInputOverrideCommand(),
|
||||
readInputFromOverrideList: CloudRunnerOptions.readInputFromOverrideList(),
|
||||
kubeStorageClass: CloudRunnerOptions.kubeStorageClass,
|
||||
checkDependencyHealthOverride: CloudRunnerOptions.checkDependencyHealthOverride,
|
||||
startDependenciesOverride: CloudRunnerOptions.startDependenciesOverride,
|
||||
cacheKey: CloudRunnerOptions.cacheKey,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import { AwsCliCommands } from '../cloud-runner/providers/aws/commands/aws-cli-c
|
|||
import { Caching } from '../cloud-runner/remote-client/caching';
|
||||
import { LfsHashing } from '../cloud-runner/services/lfs-hashing';
|
||||
import { RemoteClient } from '../cloud-runner/remote-client';
|
||||
import CloudRunnerOptionsReader from '../cloud-runner/services/cloud-runner-options-reader';
|
||||
import GitHub from '../github';
|
||||
|
||||
export class Cli {
|
||||
public static options;
|
||||
|
|
@ -33,7 +35,8 @@ export class Cli {
|
|||
CliFunctionsRepository.PushCliFunctionSource(RemoteClient);
|
||||
const program = new Command();
|
||||
program.version('0.0.1');
|
||||
const properties = Object.getOwnPropertyNames(Input);
|
||||
|
||||
const properties = CloudRunnerOptionsReader.GetProperties();
|
||||
const actionYamlReader: ActionYamlReader = new ActionYamlReader();
|
||||
for (const element of properties) {
|
||||
program.option(`--${element} <${element}>`, actionYamlReader.GetActionYamlValue(element));
|
||||
|
|
@ -55,7 +58,7 @@ export class Cli {
|
|||
}
|
||||
|
||||
static async RunCli(): Promise<void> {
|
||||
Input.githubInputEnabled = false;
|
||||
GitHub.githubInputEnabled = false;
|
||||
if (Cli.options['populateOverride'] === `true`) {
|
||||
await CloudRunnerQueryOverride.PopulateQueryOverrideInput();
|
||||
}
|
||||
|
|
@ -73,7 +76,7 @@ export class Cli {
|
|||
private static logInput() {
|
||||
core.info(`\n`);
|
||||
core.info(`INPUT:`);
|
||||
const properties = Object.getOwnPropertyNames(Input);
|
||||
const properties = CloudRunnerOptionsReader.GetProperties();
|
||||
for (const element of properties) {
|
||||
if (
|
||||
Input[element] !== undefined &&
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { Cli } from '../cli/cli';
|
||||
import CloudRunnerQueryOverride from './services/cloud-runner-query-override';
|
||||
import Input from '../input';
|
||||
import GitHub from '../github';
|
||||
const core = require('@actions/core');
|
||||
|
||||
class CloudRunnerOptions {
|
||||
public static getInput(query) {
|
||||
if (Input.githubInputEnabled) {
|
||||
if (GitHub.githubInputEnabled) {
|
||||
const coreInput = core.getInput(query);
|
||||
if (coreInput && coreInput !== '') {
|
||||
return coreInput;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import UnityVersioning from '../unity-versioning';
|
|||
import { Cli } from '../cli/cli';
|
||||
import CloudRunnerLogger from './services/cloud-runner-logger';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import CloudRunnerOptions from './cloud-runner-options';
|
||||
import GitHub from '../github';
|
||||
|
||||
describe('Cloud Runner', () => {
|
||||
it('responds', () => {});
|
||||
|
|
@ -14,7 +16,7 @@ describe('Cloud Runner', () => {
|
|||
describe('Cloud Runner', () => {
|
||||
const testSecretName = 'testSecretName';
|
||||
const testSecretValue = 'testSecretValue';
|
||||
if (Input.cloudRunnerTests) {
|
||||
if (CloudRunnerOptions.cloudRunnerTests) {
|
||||
it('All build parameters sent to cloud runner as env vars', async () => {
|
||||
// Build parameters
|
||||
Cli.options = {
|
||||
|
|
@ -31,11 +33,11 @@ describe('Cloud Runner', () => {
|
|||
value: '${testSecretValue}'
|
||||
`,
|
||||
};
|
||||
Input.githubInputEnabled = false;
|
||||
GitHub.githubInputEnabled = false;
|
||||
|
||||
// Setup parameters
|
||||
const buildParameter = await BuildParameters.create();
|
||||
Input.githubInputEnabled = true;
|
||||
GitHub.githubInputEnabled = true;
|
||||
const baseImage = new ImageTag(buildParameter);
|
||||
|
||||
// Run the job
|
||||
|
|
@ -72,7 +74,7 @@ describe('Cloud Runner', () => {
|
|||
targetPlatform: 'StandaloneLinux64',
|
||||
cacheKey: `test-case-${uuidv4()}`,
|
||||
};
|
||||
Input.githubInputEnabled = false;
|
||||
GitHub.githubInputEnabled = false;
|
||||
const buildParameter = await BuildParameters.create();
|
||||
const baseImage = new ImageTag(buildParameter);
|
||||
const results = await CloudRunner.run(buildParameter, baseImage.toString());
|
||||
|
|
@ -87,7 +89,7 @@ describe('Cloud Runner', () => {
|
|||
CloudRunnerLogger.log(`run 2 succeeded`);
|
||||
expect(results2).toContain(buildSucceededString);
|
||||
expect(results2).toEqual(expect.not.stringContaining(libraryString));
|
||||
Input.githubInputEnabled = true;
|
||||
GitHub.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
}
|
||||
|
|
@ -108,7 +110,7 @@ describe('Cloud Runner', () => {
|
|||
value: '${testSecretValue}'
|
||||
`,
|
||||
};
|
||||
Input.githubInputEnabled = false;
|
||||
GitHub.githubInputEnabled = false;
|
||||
|
||||
// Setup parameters
|
||||
const buildParameter = await BuildParameters.create();
|
||||
|
|
@ -116,7 +118,7 @@ describe('Cloud Runner', () => {
|
|||
|
||||
// Run the job
|
||||
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
||||
Input.githubInputEnabled = true;
|
||||
GitHub.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
it('Test cloud runner returns commands', async () => {
|
||||
|
|
@ -128,7 +130,7 @@ describe('Cloud Runner', () => {
|
|||
cloudRunnerCluster: 'test',
|
||||
targetPlatform: 'StandaloneLinux64',
|
||||
};
|
||||
Input.githubInputEnabled = false;
|
||||
GitHub.githubInputEnabled = false;
|
||||
|
||||
// Setup parameters
|
||||
const buildParameter = await BuildParameters.create();
|
||||
|
|
@ -136,7 +138,7 @@ describe('Cloud Runner', () => {
|
|||
|
||||
// Run the job
|
||||
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
||||
Input.githubInputEnabled = true;
|
||||
GitHub.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export class TaskService {
|
|||
if (list.length > 0) {
|
||||
const describeInput: AWS.ECS.DescribeTasksRequest = { tasks: list, cluster: element };
|
||||
const describeList = (await ecs.describeTasks(describeInput).promise()).tasks || [];
|
||||
if (describeList === []) {
|
||||
if (describeList.length === 0) {
|
||||
continue;
|
||||
}
|
||||
CloudRunnerLogger.log(`Tasks ${describeList.length}`);
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import BuildParameters from '../../build-parameters';
|
||||
import { Cli } from '../../cli/cli';
|
||||
import Input from '../../input';
|
||||
import UnityVersioning from '../../unity-versioning';
|
||||
import CloudRunner from '../cloud-runner';
|
||||
import { CloudRunnerSystem } from '../services/cloud-runner-system';
|
||||
import { Caching } from './caching';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import GitHub from '../../github';
|
||||
|
||||
describe('Cloud Runner Caching', () => {
|
||||
it('responds', () => {});
|
||||
|
|
@ -22,7 +22,7 @@ describe('Cloud Runner Caching', () => {
|
|||
targetPlatform: 'StandaloneLinux64',
|
||||
cacheKey: `test-case-${uuidv4()}`,
|
||||
};
|
||||
Input.githubInputEnabled = false;
|
||||
GitHub.githubInputEnabled = false;
|
||||
const buildParameter = await BuildParameters.create();
|
||||
CloudRunner.buildParameters = buildParameter;
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ describe('Cloud Runner Caching', () => {
|
|||
fs.rmdirSync(testFolder, { recursive: true });
|
||||
fs.rmdirSync(cacheFolder, { recursive: true });
|
||||
|
||||
Input.githubInputEnabled = true;
|
||||
GitHub.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import Input from '../../input';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
|
||||
class CloudRunnerOptionsReader {
|
||||
static GetProperties() {
|
||||
return [...Object.getOwnPropertyNames(Input), ...Object.getOwnPropertyNames(CloudRunnerOptions)];
|
||||
}
|
||||
}
|
||||
|
||||
export default CloudRunnerOptionsReader;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import Input from '../../input';
|
||||
import { GenericInputReader } from '../../input-readers/generic-input-reader';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
|
||||
const formatFunction = (value, arguments_) => {
|
||||
for (const element of arguments_) {
|
||||
|
|
@ -28,11 +29,11 @@ class CloudRunnerQueryOverride {
|
|||
}
|
||||
|
||||
private static shouldUseOverride(query) {
|
||||
if (Input.readInputOverrideCommand() !== '') {
|
||||
if (Input.readInputFromOverrideList() !== '') {
|
||||
if (CloudRunnerOptions.readInputOverrideCommand() !== '') {
|
||||
if (CloudRunnerOptions.readInputFromOverrideList() !== '') {
|
||||
const doesInclude =
|
||||
Input.readInputFromOverrideList().split(',').includes(query) ||
|
||||
Input.readInputFromOverrideList().split(',').includes(Input.ToEnvVarFormat(query));
|
||||
CloudRunnerOptions.readInputFromOverrideList().split(',').includes(query) ||
|
||||
CloudRunnerOptions.readInputFromOverrideList().split(',').includes(Input.ToEnvVarFormat(query));
|
||||
|
||||
return doesInclude ? true : false;
|
||||
} else {
|
||||
|
|
@ -46,11 +47,13 @@ class CloudRunnerQueryOverride {
|
|||
throw new Error(`Should not be trying to run override query on ${query}`);
|
||||
}
|
||||
|
||||
return await GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand(), [{ key: 0, value: query }]));
|
||||
return await GenericInputReader.Run(
|
||||
formatFunction(CloudRunnerOptions.readInputOverrideCommand(), [{ key: 0, value: query }]),
|
||||
);
|
||||
}
|
||||
|
||||
public static async PopulateQueryOverrideInput() {
|
||||
const queries = Input.readInputFromOverrideList().split(',');
|
||||
const queries = CloudRunnerOptions.readInputFromOverrideList().split(',');
|
||||
CloudRunnerQueryOverride.queryOverrides = new Array();
|
||||
for (const element of queries) {
|
||||
if (CloudRunnerQueryOverride.shouldUseOverride(element)) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import Input from '../../input';
|
||||
import { CloudRunnerSystem } from './cloud-runner-system';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
|
||||
class DependencyOverrideService {
|
||||
public static async CheckHealth() {
|
||||
if (Input.checkDependencyHealthOverride) {
|
||||
if (CloudRunnerOptions.checkDependencyHealthOverride) {
|
||||
try {
|
||||
await CloudRunnerSystem.Run(Input.checkDependencyHealthOverride);
|
||||
await CloudRunnerSystem.Run(CloudRunnerOptions.checkDependencyHealthOverride);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -14,8 +14,8 @@ class DependencyOverrideService {
|
|||
return true;
|
||||
}
|
||||
public static async TryStartDependencies() {
|
||||
if (Input.startDependenciesOverride) {
|
||||
await CloudRunnerSystem.Run(Input.startDependenciesOverride);
|
||||
if (CloudRunnerOptions.startDependenciesOverride) {
|
||||
await CloudRunnerSystem.Run(CloudRunnerOptions.startDependenciesOverride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import CloudRunnerEnvironmentVariable from './cloud-runner-environment-variable'
|
|||
import { CloudRunnerCustomHooks } from './cloud-runner-custom-hooks';
|
||||
import CloudRunnerSecret from './cloud-runner-secret';
|
||||
import CloudRunnerQueryOverride from './cloud-runner-query-override';
|
||||
import CloudRunnerOptionsReader from './cloud-runner-options-reader';
|
||||
|
||||
export class TaskParameterSerializer {
|
||||
public static readBuildEnvironmentVariables(): CloudRunnerEnvironmentVariable[] {
|
||||
|
|
@ -61,7 +62,7 @@ export class TaskParameterSerializer {
|
|||
}
|
||||
|
||||
private static readInput(array: any[]) {
|
||||
const input = Object.getOwnPropertyNames(Input);
|
||||
const input = CloudRunnerOptionsReader.GetProperties();
|
||||
for (const element of input) {
|
||||
if (typeof Input[element] !== 'function' && array.filter((x) => x.name === element).length === 0) {
|
||||
array.push({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class GitHub {
|
||||
public static githubInputEnabled: boolean = true;
|
||||
}
|
||||
|
||||
export default GitHub;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { CloudRunnerSystem } from '../cloud-runner/services/cloud-runner-system';
|
||||
import Input from '../input';
|
||||
import CloudRunnerOptions from '../cloud-runner/cloud-runner-options';
|
||||
|
||||
export class GenericInputReader {
|
||||
public static async Run(command) {
|
||||
if (Input.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import { assert } from 'console';
|
|||
import fs from 'fs';
|
||||
import { CloudRunnerSystem } from '../cloud-runner/services/cloud-runner-system';
|
||||
import CloudRunnerLogger from '../cloud-runner/services/cloud-runner-logger';
|
||||
import Input from '../input';
|
||||
import CloudRunnerOptions from '../cloud-runner/cloud-runner-options';
|
||||
|
||||
export class GitRepoReader {
|
||||
public static async GetRemote() {
|
||||
if (Input.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
assert(fs.existsSync(`.git`));
|
||||
|
|
@ -18,7 +18,7 @@ export class GitRepoReader {
|
|||
}
|
||||
|
||||
public static async GetBranch() {
|
||||
if (Input.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
assert(fs.existsSync(`.git`));
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { CloudRunnerSystem } from '../cloud-runner/services/cloud-runner-system';
|
||||
import * as core from '@actions/core';
|
||||
import Input from '../input';
|
||||
import CloudRunnerOptions from '../cloud-runner/cloud-runner-options';
|
||||
|
||||
export class GithubCliReader {
|
||||
static async GetGitHubAuthToken() {
|
||||
if (Input.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import YAML from 'yaml';
|
||||
import Input from '../input';
|
||||
import CloudRunnerOptions from '../cloud-runner/cloud-runner-options';
|
||||
|
||||
export function ReadLicense() {
|
||||
if (Input.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
const pipelineFile = path.join(__dirname, `.github`, `workflows`, `cloud-runner-k8s-pipeline.yml`);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import path from 'path';
|
|||
import { Cli } from './cli/cli';
|
||||
import CloudRunnerQueryOverride from './cloud-runner/services/cloud-runner-query-override';
|
||||
import Platform from './platform';
|
||||
import GitHub from './github';
|
||||
|
||||
const core = require('@actions/core');
|
||||
|
||||
|
|
@ -14,10 +15,8 @@ const core = require('@actions/core');
|
|||
* Todo: rename to UserInput and remove anything that is not direct input from the user / ci workflow
|
||||
*/
|
||||
class Input {
|
||||
public static githubInputEnabled: boolean = true;
|
||||
|
||||
public static getInput(query) {
|
||||
if (Input.githubInputEnabled) {
|
||||
if (GitHub.githubInputEnabled) {
|
||||
const coreInput = core.getInput(query);
|
||||
if (coreInput && coreInput !== '') {
|
||||
return coreInput;
|
||||
|
|
@ -61,17 +60,6 @@ class Input {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
static get cloudRunnerBuilderPlatform() {
|
||||
const input = Input.getInput('cloudRunnerBuilderPlatform');
|
||||
if (input) {
|
||||
return input;
|
||||
}
|
||||
if (Input.cloudRunnerCluster !== 'local') {
|
||||
return 'linux';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static get gitSha() {
|
||||
if (Input.getInput(`GITHUB_SHA`)) {
|
||||
|
|
@ -175,34 +163,6 @@ class Input {
|
|||
return core.getInput('gitPrivateToken') || false;
|
||||
}
|
||||
|
||||
static get customJob() {
|
||||
return Input.getInput('customJob') || '';
|
||||
}
|
||||
|
||||
static customJobHooks() {
|
||||
return Input.getInput('customJobHooks') || '';
|
||||
}
|
||||
|
||||
static cachePushOverrideCommand() {
|
||||
return Input.getInput('cachePushOverrideCommand') || '';
|
||||
}
|
||||
|
||||
static cachePullOverrideCommand() {
|
||||
return Input.getInput('cachePullOverrideCommand') || '';
|
||||
}
|
||||
|
||||
static readInputFromOverrideList() {
|
||||
return Input.getInput('readInputFromOverrideList') || '';
|
||||
}
|
||||
|
||||
static readInputOverrideCommand() {
|
||||
return Input.getInput('readInputOverrideCommand') || '';
|
||||
}
|
||||
|
||||
static get cloudRunnerBranch() {
|
||||
return Input.getInput('cloudRunnerBranch') || 'cloud-runner-develop';
|
||||
}
|
||||
|
||||
static get chownFilesTo() {
|
||||
return Input.getInput('chownFilesTo') || '';
|
||||
}
|
||||
|
|
@ -213,66 +173,6 @@ class Input {
|
|||
return input === 'true';
|
||||
}
|
||||
|
||||
static get postBuildSteps() {
|
||||
return Input.getInput('postBuildSteps') || '';
|
||||
}
|
||||
|
||||
static get preBuildSteps() {
|
||||
return Input.getInput('preBuildSteps') || '';
|
||||
}
|
||||
|
||||
static get awsBaseStackName() {
|
||||
return Input.getInput('awsBaseStackName') || 'game-ci';
|
||||
}
|
||||
|
||||
static get cloudRunnerCluster() {
|
||||
if (Cli.isCliMode) {
|
||||
return Input.getInput('cloudRunnerCluster') || 'aws';
|
||||
}
|
||||
|
||||
return Input.getInput('cloudRunnerCluster') || 'local';
|
||||
}
|
||||
|
||||
static get cloudRunnerCpu() {
|
||||
return Input.getInput('cloudRunnerCpu');
|
||||
}
|
||||
|
||||
static get cloudRunnerMemory() {
|
||||
return Input.getInput('cloudRunnerMemory');
|
||||
}
|
||||
|
||||
static get kubeConfig() {
|
||||
return Input.getInput('kubeConfig') || '';
|
||||
}
|
||||
|
||||
static get kubeVolume() {
|
||||
return Input.getInput('kubeVolume') || '';
|
||||
}
|
||||
|
||||
static get kubeVolumeSize() {
|
||||
return Input.getInput('kubeVolumeSize') || '5Gi';
|
||||
}
|
||||
|
||||
static get kubeStorageClass(): string {
|
||||
return Input.getInput('kubeStorageClass') || '';
|
||||
}
|
||||
|
||||
static get checkDependencyHealthOverride(): string {
|
||||
return Input.getInput('checkDependencyHealthOverride') || '';
|
||||
}
|
||||
|
||||
static get startDependenciesOverride(): string {
|
||||
return Input.getInput('startDependenciesOverride') || '';
|
||||
}
|
||||
|
||||
static get cacheKey(): string {
|
||||
return Input.getInput('cacheKey') || Input.branch;
|
||||
}
|
||||
|
||||
static get cloudRunnerTests(): boolean {
|
||||
return Input.getInput(`cloudRunnerTests`) || false;
|
||||
}
|
||||
|
||||
public static ToEnvVarFormat(input: string) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
|
|
|||
Loading…
Reference in New Issue