Various fixes

pull/353/head
Frostebite 2022-04-04 23:09:26 +01:00
parent 4165f16f0c
commit bb7ac06baf
8 changed files with 79 additions and 58 deletions

64
dist/index.js vendored
View File

@ -238,9 +238,10 @@ const cloud_runner_namespace_1 = __importDefault(__nccwpck_require__(63287));
const input_1 = __importDefault(__nccwpck_require__(91933)); const input_1 = __importDefault(__nccwpck_require__(91933));
const platform_1 = __importDefault(__nccwpck_require__(9707)); const platform_1 = __importDefault(__nccwpck_require__(9707));
const unity_versioning_1 = __importDefault(__nccwpck_require__(17146)); const unity_versioning_1 = __importDefault(__nccwpck_require__(17146));
const versioning_1 = __importDefault(__nccwpck_require__(88729)); const versioning_1 = __importDefault(__nccwpck_require__(93901));
const git_repo_1 = __nccwpck_require__(24271); const git_repo_1 = __nccwpck_require__(24271);
const github_cli_1 = __nccwpck_require__(44990); const github_cli_1 = __nccwpck_require__(44990);
const cli_1 = __nccwpck_require__(55651);
class BuildParameters { class BuildParameters {
static create() { static create() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -252,7 +253,7 @@ class BuildParameters {
// Todo - Don't use process.env directly, that's what the input model class is for. // Todo - Don't use process.env directly, that's what the input model class is for.
// --- // ---
let unitySerial = ''; let unitySerial = '';
if (!process.env.UNITY_SERIAL && input_1.default.githubInputEnabled && input_1.default.cliOptions === undefined) { if (!process.env.UNITY_SERIAL && input_1.default.githubInputEnabled && cli_1.CLI.options === undefined) {
//No serial was present so it is a personal license that we need to convert //No serial was present so it is a personal license that we need to convert
if (!process.env.UNITY_LICENSE) { if (!process.env.UNITY_LICENSE) {
throw new Error(`Missing Unity License File and no Serial was found. If this throw new Error(`Missing Unity License File and no Serial was found. If this
@ -265,7 +266,7 @@ class BuildParameters {
else { else {
unitySerial = process.env.UNITY_SERIAL; unitySerial = process.env.UNITY_SERIAL;
} }
if (!input_1.default.cliMode) { if (!cli_1.CLI.cliMode) {
core.setSecret(unitySerial); core.setSecret(unitySerial);
} }
return { return {
@ -309,7 +310,7 @@ class BuildParameters {
cloudRunnerIntegrationTests: input_1.default.cloudRunnerTests, cloudRunnerIntegrationTests: input_1.default.cloudRunnerTests,
githubRepo: input_1.default.githubRepo || (yield git_repo_1.GitRepoReader.GetRemote()) || 'game-ci/unity-builder', githubRepo: input_1.default.githubRepo || (yield git_repo_1.GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
remoteBuildCluster: input_1.default.cloudRunnerCluster, remoteBuildCluster: input_1.default.cloudRunnerCluster,
cliMode: input_1.default.cliMode, cliMode: cli_1.CLI.cliMode,
awsStackName: input_1.default.awsBaseStackName, awsStackName: input_1.default.awsBaseStackName,
gitSha: input_1.default.gitSha, gitSha: input_1.default.gitSha,
logId: nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 9)(), logId: nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 9)(),
@ -503,6 +504,12 @@ const SDK = __importStar(__nccwpck_require__(71786));
const caching_1 = __nccwpck_require__(38759); const caching_1 = __nccwpck_require__(38759);
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011)); const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
class CLI { class CLI {
static get cliMode() {
return CLI.options !== undefined && CLI.options.mode !== undefined && CLI.options.mode !== '';
}
static query(key) {
return CLI.cliMode && CLI.options[key] !== undefined ? CLI.options[key] : undefined;
}
static InitCliMode() { static InitCliMode() {
const program = new commander_ts_1.Command(); const program = new commander_ts_1.Command();
program.version('0.0.1'); program.version('0.0.1');
@ -514,19 +521,18 @@ class CLI {
program.option('-m, --mode <mode>', cli_decorator_1.GetAllCliModes() program.option('-m, --mode <mode>', cli_decorator_1.GetAllCliModes()
.map((x) => `${x.key} (${x.description})`) .map((x) => `${x.key} (${x.description})`)
.join(` | `)); .join(` | `));
program.option('--populateOverride <populate>', 'should use override query to pull input false by default'); program.option('--populateOverride <populateOverride>', 'should use override query to pull input false by default');
program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder'); program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder');
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder'); program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
program.option('--artifactName <artifactName>', 'caching artifact name'); program.option('--artifactName <artifactName>', 'caching artifact name');
program.parse(process.argv); program.parse(process.argv);
CLI.options = program.opts(); CLI.options = program.opts();
__1.Input.cliOptions = CLI.options; return CLI.cliMode;
return __1.Input.cliMode;
} }
static RunCli() { static RunCli() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
__1.Input.githubInputEnabled = false; __1.Input.githubInputEnabled = false;
if (CLI.options['populate'] === `true`) { if (CLI.options['populateOverride'] === `true`) {
yield cloud_runner_query_override_1.default.PopulateQueryOverrideInput(); yield cloud_runner_query_override_1.default.PopulateQueryOverrideInput();
} }
CLI.logInput(); CLI.logInput();
@ -576,8 +582,8 @@ class CLI {
${JSON.stringify(buildParameter, undefined, 4)} ${JSON.stringify(buildParameter, undefined, 4)}
`); `);
__1.CloudRunner.buildParameters = buildParameter; __1.CloudRunner.buildParameters = buildParameter;
yield caching_1.Caching.PushToCache(__1.Input.cliOptions['cachePushFrom'], __1.Input.cliOptions['cachePushTo'], __1.Input.cliOptions['artifactName']); yield caching_1.Caching.PushToCache(CLI.options['cachePushFrom'], CLI.options['cachePushTo'], CLI.options['artifactName']);
cloud_runner_logger_1.default.log(`${__1.Input.cliOptions['cachePushFrom']} ${__1.Input.cliOptions['cachePushTo']} ${__1.Input.cliOptions['artifactName']}`); cloud_runner_logger_1.default.log(`${CLI.options['cachePushFrom']} ${CLI.options['cachePushTo']} ${CLI.options['artifactName']}`);
}); });
} }
static cachePull() { static cachePull() {
@ -2906,6 +2912,11 @@ const formatFunction = (value, arguments_) => {
return value; return value;
}; };
class CloudRunnerQueryOverride { class CloudRunnerQueryOverride {
static query(key) {
return CloudRunnerQueryOverride.queryOverrides && CloudRunnerQueryOverride.queryOverrides[key] !== undefined
? CloudRunnerQueryOverride.queryOverrides[key]
: undefined;
}
static shouldUseOverride(query) { static shouldUseOverride(query) {
if (input_1.default.readInputOverrideCommand() !== '') { if (input_1.default.readInputOverrideCommand() !== '') {
if (input_1.default.readInputFromOverrideList() !== '') { if (input_1.default.readInputFromOverrideList() !== '') {
@ -2929,10 +2940,10 @@ class CloudRunnerQueryOverride {
static PopulateQueryOverrideInput() { static PopulateQueryOverrideInput() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const queries = input_1.default.readInputFromOverrideList().split(','); const queries = input_1.default.readInputFromOverrideList().split(',');
input_1.default.queryOverrides = new Array(); CloudRunnerQueryOverride.queryOverrides = new Array();
for (const element of queries) { for (const element of queries) {
if (CloudRunnerQueryOverride.shouldUseOverride(element)) { if (CloudRunnerQueryOverride.shouldUseOverride(element)) {
input_1.default.queryOverrides[element] = yield CloudRunnerQueryOverride.queryOverride(element); CloudRunnerQueryOverride.queryOverrides[element] = yield CloudRunnerQueryOverride.queryOverride(element);
} }
} }
}); });
@ -3003,6 +3014,7 @@ exports.TaskParameterSerializer = void 0;
const __1 = __nccwpck_require__(41359); const __1 = __nccwpck_require__(41359);
const image_environment_factory_1 = __importDefault(__nccwpck_require__(25145)); const image_environment_factory_1 = __importDefault(__nccwpck_require__(25145));
const cloud_runner_build_command_process_1 = __nccwpck_require__(71899); const cloud_runner_build_command_process_1 = __nccwpck_require__(71899);
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
class TaskParameterSerializer { class TaskParameterSerializer {
static readBuildEnvironmentVariables() { static readBuildEnvironmentVariables() {
return [ return [
@ -3077,8 +3089,9 @@ class TaskParameterSerializer {
return array; return array;
} }
static getValue(key) { static getValue(key) {
return __1.Input.queryOverrides !== undefined && __1.Input.queryOverrides[key] !== undefined return cloud_runner_query_override_1.default.queryOverrides !== undefined &&
? __1.Input.queryOverrides[key] cloud_runner_query_override_1.default.queryOverrides[key] !== undefined
? cloud_runner_query_override_1.default.queryOverrides[key]
: process.env[key]; : process.env[key];
} }
static tryAddInput(array, key) { static tryAddInput(array, key) {
@ -3739,7 +3752,7 @@ const project_1 = __importDefault(__nccwpck_require__(88666));
exports.Project = project_1.default; exports.Project = project_1.default;
const unity_1 = __importDefault(__nccwpck_require__(70498)); const unity_1 = __importDefault(__nccwpck_require__(70498));
exports.Unity = unity_1.default; exports.Unity = unity_1.default;
const versioning_1 = __importDefault(__nccwpck_require__(88729)); const versioning_1 = __importDefault(__nccwpck_require__(93901));
exports.Versioning = versioning_1.default; exports.Versioning = versioning_1.default;
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144)); const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
exports.CloudRunner = cloud_runner_1.default; exports.CloudRunner = cloud_runner_1.default;
@ -3946,6 +3959,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const fs_1 = __importDefault(__nccwpck_require__(57147)); const fs_1 = __importDefault(__nccwpck_require__(57147));
const path_1 = __importDefault(__nccwpck_require__(71017)); 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 platform_1 = __importDefault(__nccwpck_require__(9707));
const core = __nccwpck_require__(42186); const core = __nccwpck_require__(42186);
/** /**
@ -3960,19 +3975,16 @@ class Input {
static get cloudRunnerTests() { static get cloudRunnerTests() {
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false; return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
} }
static get cliMode() {
return Input.cliOptions !== undefined && Input.cliOptions.mode !== undefined && Input.cliOptions.mode !== '';
}
static getInput(query) { static getInput(query) {
const coreInput = core.getInput(query); const coreInput = core.getInput(query);
if (Input.githubInputEnabled && coreInput && coreInput !== '') { if (Input.githubInputEnabled && coreInput && coreInput !== '') {
return coreInput; return coreInput;
} }
if (Input.cliMode && Input.cliOptions[query] !== undefined) { if (cli_1.CLI.query(query)) {
return Input.cliOptions[query]; return cli_1.CLI.query(query);
} }
if (Input.queryOverrides && Input.queryOverrides[query] !== undefined) { if (cloud_runner_query_override_1.default.query(query)) {
return Input.queryOverrides[query]; return cloud_runner_query_override_1.default.query(query);
} }
if (process.env[query] !== undefined) { if (process.env[query] !== undefined) {
return process.env[query]; return process.env[query];
@ -4119,7 +4131,7 @@ class Input {
return Input.getInput('awsBaseStackName') || 'game-ci'; return Input.getInput('awsBaseStackName') || 'game-ci';
} }
static get cloudRunnerCluster() { static get cloudRunnerCluster() {
if (Input.cliMode) { if (cli_1.CLI.cliMode) {
return Input.getInput('cloudRunnerCluster') || 'aws'; return Input.getInput('cloudRunnerCluster') || 'aws';
} }
return Input.getInput('cloudRunnerCluster') || 'local'; return Input.getInput('cloudRunnerCluster') || 'local';
@ -4759,7 +4771,7 @@ exports["default"] = Unity;
/***/ }), /***/ }),
/***/ 88729: /***/ 93901:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -133498,7 +133510,7 @@ Object.defineProperty(apiLoader.services['clouddirectory'], '2016-05-10', {
}); });
Object.defineProperty(apiLoader.services['clouddirectory'], '2017-01-11', { Object.defineProperty(apiLoader.services['clouddirectory'], '2017-01-11', {
get: function get() { get: function get() {
var model = __nccwpck_require__(19073); var model = __nccwpck_require__(88729);
model.paginators = (__nccwpck_require__(10156)/* .pagination */ .o); model.paginators = (__nccwpck_require__(10156)/* .pagination */ .o);
return model; return model;
}, },
@ -383953,7 +383965,7 @@ module.exports = JSON.parse('{"o":{"ListAppliedSchemaArns":{"input_token":"NextT
/***/ }), /***/ }),
/***/ 19073: /***/ 88729:
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,7 @@ import UnityVersioning from './unity-versioning';
import Versioning from './versioning'; import Versioning from './versioning';
import { GitRepoReader } from './input-readers/git-repo'; import { GitRepoReader } from './input-readers/git-repo';
import { GithubCliReader } from './input-readers/github-cli'; import { GithubCliReader } from './input-readers/github-cli';
import { CLI } from './cli/cli';
class BuildParameters { class BuildParameters {
public editorVersion!: string; public editorVersion!: string;
@ -77,7 +78,7 @@ class BuildParameters {
// Todo - Don't use process.env directly, that's what the input model class is for. // Todo - Don't use process.env directly, that's what the input model class is for.
// --- // ---
let unitySerial = ''; let unitySerial = '';
if (!process.env.UNITY_SERIAL && Input.githubInputEnabled && Input.cliOptions === undefined) { if (!process.env.UNITY_SERIAL && Input.githubInputEnabled && CLI.options === undefined) {
//No serial was present so it is a personal license that we need to convert //No serial was present so it is a personal license that we need to convert
if (!process.env.UNITY_LICENSE) { if (!process.env.UNITY_LICENSE) {
throw new Error(`Missing Unity License File and no Serial was found. If this throw new Error(`Missing Unity License File and no Serial was found. If this
@ -89,7 +90,7 @@ class BuildParameters {
} else { } else {
unitySerial = process.env.UNITY_SERIAL!; unitySerial = process.env.UNITY_SERIAL!;
} }
if (!Input.cliMode) { if (!CLI.cliMode) {
core.setSecret(unitySerial); core.setSecret(unitySerial);
} }
@ -135,7 +136,7 @@ class BuildParameters {
cloudRunnerIntegrationTests: Input.cloudRunnerTests, cloudRunnerIntegrationTests: Input.cloudRunnerTests,
githubRepo: Input.githubRepo || (await GitRepoReader.GetRemote()) || 'game-ci/unity-builder', githubRepo: Input.githubRepo || (await GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
remoteBuildCluster: Input.cloudRunnerCluster, remoteBuildCluster: Input.cloudRunnerCluster,
cliMode: Input.cliMode, cliMode: CLI.cliMode,
awsStackName: Input.awsBaseStackName, awsStackName: Input.awsBaseStackName,
gitSha: Input.gitSha, gitSha: Input.gitSha,
logId: customAlphabet(CloudRunnerConstants.alphabet, 9)(), logId: customAlphabet(CloudRunnerConstants.alphabet, 9)(),

View File

@ -11,7 +11,13 @@ import { Caching } from './remote-client/remote-client-services/caching';
import CloudRunnerQueryOverride from '../cloud-runner/services/cloud-runner-query-override'; import CloudRunnerQueryOverride from '../cloud-runner/services/cloud-runner-query-override';
export class CLI { export class CLI {
private static options; public static options;
static get cliMode() {
return CLI.options !== undefined && CLI.options.mode !== undefined && CLI.options.mode !== '';
}
public static query(key) {
return CLI.cliMode && CLI.options[key] !== undefined ? CLI.options[key] : undefined;
}
public static InitCliMode() { public static InitCliMode() {
const program = new Command(); const program = new Command();
@ -27,19 +33,18 @@ export class CLI {
.map((x) => `${x.key} (${x.description})`) .map((x) => `${x.key} (${x.description})`)
.join(` | `), .join(` | `),
); );
program.option('--populateOverride <populate>', 'should use override query to pull input false by default'); program.option('--populateOverride <populateOverride>', 'should use override query to pull input false by default');
program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder'); program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder');
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder'); program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
program.option('--artifactName <artifactName>', 'caching artifact name'); program.option('--artifactName <artifactName>', 'caching artifact name');
program.parse(process.argv); program.parse(process.argv);
CLI.options = program.opts(); CLI.options = program.opts();
Input.cliOptions = CLI.options; return CLI.cliMode;
return Input.cliMode;
} }
static async RunCli(): Promise<void> { static async RunCli(): Promise<void> {
Input.githubInputEnabled = false; Input.githubInputEnabled = false;
if (CLI.options['populate'] === `true`) { if (CLI.options['populateOverride'] === `true`) {
await CloudRunnerQueryOverride.PopulateQueryOverrideInput(); await CloudRunnerQueryOverride.PopulateQueryOverrideInput();
} }
CLI.logInput(); CLI.logInput();
@ -92,13 +97,9 @@ export class CLI {
${JSON.stringify(buildParameter, undefined, 4)} ${JSON.stringify(buildParameter, undefined, 4)}
`); `);
CloudRunner.buildParameters = buildParameter; CloudRunner.buildParameters = buildParameter;
await Caching.PushToCache( await Caching.PushToCache(CLI.options['cachePushFrom'], CLI.options['cachePushTo'], CLI.options['artifactName']);
Input.cliOptions['cachePushFrom'],
Input.cliOptions['cachePushTo'],
Input.cliOptions['artifactName'],
);
CloudRunnerLogger.log( CloudRunnerLogger.log(
`${Input.cliOptions['cachePushFrom']} ${Input.cliOptions['cachePushTo']} ${Input.cliOptions['artifactName']}`, `${CLI.options['cachePushFrom']} ${CLI.options['cachePushTo']} ${CLI.options['artifactName']}`,
); );
} }

View File

@ -4,6 +4,7 @@ import Input from '../input';
import { CloudRunnerStatics } from './cloud-runner-statics'; import { CloudRunnerStatics } from './cloud-runner-statics';
import { TaskParameterSerializer } from './services/task-parameter-serializer'; import { TaskParameterSerializer } from './services/task-parameter-serializer';
import UnityVersioning from '../unity-versioning'; import UnityVersioning from '../unity-versioning';
import { CLI } from '../cli/cli';
function guid() { function guid() {
return Math.trunc((1 + Math.random()) * 0x10000) return Math.trunc((1 + Math.random()) * 0x10000)
@ -22,7 +23,7 @@ describe('Cloud Runner', () => {
if (Input.cloudRunnerTests) { if (Input.cloudRunnerTests) {
it('All build parameters sent to cloud runner as env vars', async () => { it('All build parameters sent to cloud runner as env vars', async () => {
// build parameters // build parameters
Input.cliOptions = { CLI.options = {
versioning: 'None', versioning: 'None',
projectPath: 'test-project', projectPath: 'test-project',
unityVersion: UnityVersioning.read('test-project'), unityVersion: UnityVersioning.read('test-project'),
@ -60,7 +61,7 @@ describe('Cloud Runner', () => {
Input.githubInputEnabled = true; Input.githubInputEnabled = true;
}, 1000000); }, 1000000);
it('Run one build it should not use cache, run subsequent build which should use cache', async () => { it('Run one build it should not use cache, run subsequent build which should use cache', async () => {
Input.cliOptions = { CLI.options = {
versioning: 'None', versioning: 'None',
projectPath: 'test-project', projectPath: 'test-project',
unityVersion: UnityVersioning.read('test-project'), unityVersion: UnityVersioning.read('test-project'),

View File

@ -9,6 +9,14 @@ const formatFunction = (value, arguments_) => {
}; };
class CloudRunnerQueryOverride { class CloudRunnerQueryOverride {
static queryOverrides: any;
public static query(key) {
return CloudRunnerQueryOverride.queryOverrides && CloudRunnerQueryOverride.queryOverrides[key] !== undefined
? CloudRunnerQueryOverride.queryOverrides[key]
: undefined;
}
private static shouldUseOverride(query) { private static shouldUseOverride(query) {
if (Input.readInputOverrideCommand() !== '') { if (Input.readInputOverrideCommand() !== '') {
if (Input.readInputFromOverrideList() !== '') { if (Input.readInputFromOverrideList() !== '') {
@ -32,10 +40,10 @@ class CloudRunnerQueryOverride {
public static async PopulateQueryOverrideInput() { public static async PopulateQueryOverrideInput() {
const queries = Input.readInputFromOverrideList().split(','); const queries = Input.readInputFromOverrideList().split(',');
Input.queryOverrides = new Array(); CloudRunnerQueryOverride.queryOverrides = new Array();
for (const element of queries) { for (const element of queries) {
if (CloudRunnerQueryOverride.shouldUseOverride(element)) { if (CloudRunnerQueryOverride.shouldUseOverride(element)) {
Input.queryOverrides[element] = await CloudRunnerQueryOverride.queryOverride(element); CloudRunnerQueryOverride.queryOverrides[element] = await CloudRunnerQueryOverride.queryOverride(element);
} }
} }
} }

View File

@ -3,6 +3,7 @@ import ImageEnvironmentFactory from '../../image-environment-factory';
import CloudRunnerEnvironmentVariable from './cloud-runner-environment-variable'; import CloudRunnerEnvironmentVariable from './cloud-runner-environment-variable';
import { CloudRunnerBuildCommandProcessor } from './cloud-runner-build-command-process'; import { CloudRunnerBuildCommandProcessor } from './cloud-runner-build-command-process';
import CloudRunnerSecret from './cloud-runner-secret'; import CloudRunnerSecret from './cloud-runner-secret';
import CloudRunnerQueryOverride from './cloud-runner-query-override';
export class TaskParameterSerializer { export class TaskParameterSerializer {
public static readBuildEnvironmentVariables(): CloudRunnerEnvironmentVariable[] { public static readBuildEnvironmentVariables(): CloudRunnerEnvironmentVariable[] {
@ -86,8 +87,9 @@ export class TaskParameterSerializer {
return array; return array;
} }
private static getValue(key) { private static getValue(key) {
return Input.queryOverrides !== undefined && Input.queryOverrides[key] !== undefined return CloudRunnerQueryOverride.queryOverrides !== undefined &&
? Input.queryOverrides[key] CloudRunnerQueryOverride.queryOverrides[key] !== undefined
? CloudRunnerQueryOverride.queryOverrides[key]
: process.env[key]; : process.env[key];
} }
private static tryAddInput(array, key): CloudRunnerSecret[] { private static tryAddInput(array, key): CloudRunnerSecret[] {

View File

@ -1,5 +1,7 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { CLI } from './cli/cli';
import CloudRunnerQueryOverride from './cloud-runner/services/cloud-runner-query-override';
import Platform from './platform'; import Platform from './platform';
const core = require('@actions/core'); const core = require('@actions/core');
@ -12,8 +14,6 @@ const core = require('@actions/core');
* Todo: rename to UserInput and remove anything that is not direct input from the user / ci workflow * Todo: rename to UserInput and remove anything that is not direct input from the user / ci workflow
*/ */
class Input { class Input {
public static cliOptions;
public static queryOverrides;
public static githubInputEnabled: boolean = true; public static githubInputEnabled: boolean = true;
// also enabled debug logging for cloud runner // also enabled debug logging for cloud runner
@ -21,22 +21,18 @@ class Input {
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false; return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
} }
static get cliMode() {
return Input.cliOptions !== undefined && Input.cliOptions.mode !== undefined && Input.cliOptions.mode !== '';
}
public static getInput(query) { public static getInput(query) {
const coreInput = core.getInput(query); const coreInput = core.getInput(query);
if (Input.githubInputEnabled && coreInput && coreInput !== '') { if (Input.githubInputEnabled && coreInput && coreInput !== '') {
return coreInput; return coreInput;
} }
if (Input.cliMode && Input.cliOptions[query] !== undefined) { if (CLI.query(query)) {
return Input.cliOptions[query]; return CLI.query(query);
} }
if (Input.queryOverrides && Input.queryOverrides[query] !== undefined) { if (CloudRunnerQueryOverride.query(query)) {
return Input.queryOverrides[query]; return CloudRunnerQueryOverride.query(query);
} }
if (process.env[query] !== undefined) { if (process.env[query] !== undefined) {
@ -223,7 +219,7 @@ class Input {
} }
static get cloudRunnerCluster() { static get cloudRunnerCluster() {
if (Input.cliMode) { if (CLI.cliMode) {
return Input.getInput('cloudRunnerCluster') || 'aws'; return Input.getInput('cloudRunnerCluster') || 'aws';
} }
return Input.getInput('cloudRunnerCluster') || 'local'; return Input.getInput('cloudRunnerCluster') || 'local';