Various fixes
parent
4165f16f0c
commit
bb7ac06baf
|
|
@ -238,9 +238,10 @@ const cloud_runner_namespace_1 = __importDefault(__nccwpck_require__(63287));
|
|||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||
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 github_cli_1 = __nccwpck_require__(44990);
|
||||
const cli_1 = __nccwpck_require__(55651);
|
||||
class BuildParameters {
|
||||
static create() {
|
||||
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.
|
||||
// ---
|
||||
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
|
||||
if (!process.env.UNITY_LICENSE) {
|
||||
throw new Error(`Missing Unity License File and no Serial was found. If this
|
||||
|
|
@ -265,7 +266,7 @@ class BuildParameters {
|
|||
else {
|
||||
unitySerial = process.env.UNITY_SERIAL;
|
||||
}
|
||||
if (!input_1.default.cliMode) {
|
||||
if (!cli_1.CLI.cliMode) {
|
||||
core.setSecret(unitySerial);
|
||||
}
|
||||
return {
|
||||
|
|
@ -309,7 +310,7 @@ class BuildParameters {
|
|||
cloudRunnerIntegrationTests: input_1.default.cloudRunnerTests,
|
||||
githubRepo: input_1.default.githubRepo || (yield git_repo_1.GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
|
||||
remoteBuildCluster: input_1.default.cloudRunnerCluster,
|
||||
cliMode: input_1.default.cliMode,
|
||||
cliMode: cli_1.CLI.cliMode,
|
||||
awsStackName: input_1.default.awsBaseStackName,
|
||||
gitSha: input_1.default.gitSha,
|
||||
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 cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
||||
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() {
|
||||
const program = new commander_ts_1.Command();
|
||||
program.version('0.0.1');
|
||||
|
|
@ -514,19 +521,18 @@ class CLI {
|
|||
program.option('-m, --mode <mode>', cli_decorator_1.GetAllCliModes()
|
||||
.map((x) => `${x.key} (${x.description})`)
|
||||
.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('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
||||
program.option('--artifactName <artifactName>', 'caching artifact name');
|
||||
program.parse(process.argv);
|
||||
CLI.options = program.opts();
|
||||
__1.Input.cliOptions = CLI.options;
|
||||
return __1.Input.cliMode;
|
||||
return CLI.cliMode;
|
||||
}
|
||||
static RunCli() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
__1.Input.githubInputEnabled = false;
|
||||
if (CLI.options['populate'] === `true`) {
|
||||
if (CLI.options['populateOverride'] === `true`) {
|
||||
yield cloud_runner_query_override_1.default.PopulateQueryOverrideInput();
|
||||
}
|
||||
CLI.logInput();
|
||||
|
|
@ -576,8 +582,8 @@ class CLI {
|
|||
${JSON.stringify(buildParameter, undefined, 4)}
|
||||
`);
|
||||
__1.CloudRunner.buildParameters = buildParameter;
|
||||
yield caching_1.Caching.PushToCache(__1.Input.cliOptions['cachePushFrom'], __1.Input.cliOptions['cachePushTo'], __1.Input.cliOptions['artifactName']);
|
||||
cloud_runner_logger_1.default.log(`${__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(`${CLI.options['cachePushFrom']} ${CLI.options['cachePushTo']} ${CLI.options['artifactName']}`);
|
||||
});
|
||||
}
|
||||
static cachePull() {
|
||||
|
|
@ -2906,6 +2912,11 @@ const formatFunction = (value, arguments_) => {
|
|||
return value;
|
||||
};
|
||||
class CloudRunnerQueryOverride {
|
||||
static query(key) {
|
||||
return CloudRunnerQueryOverride.queryOverrides && CloudRunnerQueryOverride.queryOverrides[key] !== undefined
|
||||
? CloudRunnerQueryOverride.queryOverrides[key]
|
||||
: undefined;
|
||||
}
|
||||
static shouldUseOverride(query) {
|
||||
if (input_1.default.readInputOverrideCommand() !== '') {
|
||||
if (input_1.default.readInputFromOverrideList() !== '') {
|
||||
|
|
@ -2929,10 +2940,10 @@ class CloudRunnerQueryOverride {
|
|||
static PopulateQueryOverrideInput() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const queries = input_1.default.readInputFromOverrideList().split(',');
|
||||
input_1.default.queryOverrides = new Array();
|
||||
CloudRunnerQueryOverride.queryOverrides = new Array();
|
||||
for (const element of queries) {
|
||||
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 image_environment_factory_1 = __importDefault(__nccwpck_require__(25145));
|
||||
const cloud_runner_build_command_process_1 = __nccwpck_require__(71899);
|
||||
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
||||
class TaskParameterSerializer {
|
||||
static readBuildEnvironmentVariables() {
|
||||
return [
|
||||
|
|
@ -3077,8 +3089,9 @@ class TaskParameterSerializer {
|
|||
return array;
|
||||
}
|
||||
static getValue(key) {
|
||||
return __1.Input.queryOverrides !== undefined && __1.Input.queryOverrides[key] !== undefined
|
||||
? __1.Input.queryOverrides[key]
|
||||
return cloud_runner_query_override_1.default.queryOverrides !== undefined &&
|
||||
cloud_runner_query_override_1.default.queryOverrides[key] !== undefined
|
||||
? cloud_runner_query_override_1.default.queryOverrides[key]
|
||||
: process.env[key];
|
||||
}
|
||||
static tryAddInput(array, key) {
|
||||
|
|
@ -3739,7 +3752,7 @@ const project_1 = __importDefault(__nccwpck_require__(88666));
|
|||
exports.Project = project_1.default;
|
||||
const unity_1 = __importDefault(__nccwpck_require__(70498));
|
||||
exports.Unity = unity_1.default;
|
||||
const versioning_1 = __importDefault(__nccwpck_require__(88729));
|
||||
const versioning_1 = __importDefault(__nccwpck_require__(93901));
|
||||
exports.Versioning = versioning_1.default;
|
||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||
exports.CloudRunner = cloud_runner_1.default;
|
||||
|
|
@ -3946,6 +3959,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||
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 core = __nccwpck_require__(42186);
|
||||
/**
|
||||
|
|
@ -3960,19 +3975,16 @@ class Input {
|
|||
static get cloudRunnerTests() {
|
||||
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) {
|
||||
const coreInput = core.getInput(query);
|
||||
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
|
||||
return coreInput;
|
||||
}
|
||||
if (Input.cliMode && Input.cliOptions[query] !== undefined) {
|
||||
return Input.cliOptions[query];
|
||||
if (cli_1.CLI.query(query)) {
|
||||
return cli_1.CLI.query(query);
|
||||
}
|
||||
if (Input.queryOverrides && Input.queryOverrides[query] !== undefined) {
|
||||
return Input.queryOverrides[query];
|
||||
if (cloud_runner_query_override_1.default.query(query)) {
|
||||
return cloud_runner_query_override_1.default.query(query);
|
||||
}
|
||||
if (process.env[query] !== undefined) {
|
||||
return process.env[query];
|
||||
|
|
@ -4119,7 +4131,7 @@ class Input {
|
|||
return Input.getInput('awsBaseStackName') || 'game-ci';
|
||||
}
|
||||
static get cloudRunnerCluster() {
|
||||
if (Input.cliMode) {
|
||||
if (cli_1.CLI.cliMode) {
|
||||
return Input.getInput('cloudRunnerCluster') || 'aws';
|
||||
}
|
||||
return Input.getInput('cloudRunnerCluster') || 'local';
|
||||
|
|
@ -4759,7 +4771,7 @@ exports["default"] = Unity;
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 88729:
|
||||
/***/ 93901:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
|
@ -133498,7 +133510,7 @@ Object.defineProperty(apiLoader.services['clouddirectory'], '2016-05-10', {
|
|||
});
|
||||
Object.defineProperty(apiLoader.services['clouddirectory'], '2017-01-11', {
|
||||
get: function get() {
|
||||
var model = __nccwpck_require__(19073);
|
||||
var model = __nccwpck_require__(88729);
|
||||
model.paginators = (__nccwpck_require__(10156)/* .pagination */ .o);
|
||||
return model;
|
||||
},
|
||||
|
|
@ -383953,7 +383965,7 @@ module.exports = JSON.parse('{"o":{"ListAppliedSchemaArns":{"input_token":"NextT
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 19073:
|
||||
/***/ 88729:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,6 +9,7 @@ import UnityVersioning from './unity-versioning';
|
|||
import Versioning from './versioning';
|
||||
import { GitRepoReader } from './input-readers/git-repo';
|
||||
import { GithubCliReader } from './input-readers/github-cli';
|
||||
import { CLI } from './cli/cli';
|
||||
|
||||
class BuildParameters {
|
||||
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.
|
||||
// ---
|
||||
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
|
||||
if (!process.env.UNITY_LICENSE) {
|
||||
throw new Error(`Missing Unity License File and no Serial was found. If this
|
||||
|
|
@ -89,7 +90,7 @@ class BuildParameters {
|
|||
} else {
|
||||
unitySerial = process.env.UNITY_SERIAL!;
|
||||
}
|
||||
if (!Input.cliMode) {
|
||||
if (!CLI.cliMode) {
|
||||
core.setSecret(unitySerial);
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +136,7 @@ class BuildParameters {
|
|||
cloudRunnerIntegrationTests: Input.cloudRunnerTests,
|
||||
githubRepo: Input.githubRepo || (await GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
|
||||
remoteBuildCluster: Input.cloudRunnerCluster,
|
||||
cliMode: Input.cliMode,
|
||||
cliMode: CLI.cliMode,
|
||||
awsStackName: Input.awsBaseStackName,
|
||||
gitSha: Input.gitSha,
|
||||
logId: customAlphabet(CloudRunnerConstants.alphabet, 9)(),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,13 @@ import { Caching } from './remote-client/remote-client-services/caching';
|
|||
import CloudRunnerQueryOverride from '../cloud-runner/services/cloud-runner-query-override';
|
||||
|
||||
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() {
|
||||
const program = new Command();
|
||||
|
|
@ -27,19 +33,18 @@ export class CLI {
|
|||
.map((x) => `${x.key} (${x.description})`)
|
||||
.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('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
||||
program.option('--artifactName <artifactName>', 'caching artifact name');
|
||||
program.parse(process.argv);
|
||||
CLI.options = program.opts();
|
||||
Input.cliOptions = CLI.options;
|
||||
return Input.cliMode;
|
||||
return CLI.cliMode;
|
||||
}
|
||||
|
||||
static async RunCli(): Promise<void> {
|
||||
Input.githubInputEnabled = false;
|
||||
if (CLI.options['populate'] === `true`) {
|
||||
if (CLI.options['populateOverride'] === `true`) {
|
||||
await CloudRunnerQueryOverride.PopulateQueryOverrideInput();
|
||||
}
|
||||
CLI.logInput();
|
||||
|
|
@ -92,13 +97,9 @@ export class CLI {
|
|||
${JSON.stringify(buildParameter, undefined, 4)}
|
||||
`);
|
||||
CloudRunner.buildParameters = buildParameter;
|
||||
await Caching.PushToCache(
|
||||
Input.cliOptions['cachePushFrom'],
|
||||
Input.cliOptions['cachePushTo'],
|
||||
Input.cliOptions['artifactName'],
|
||||
);
|
||||
await Caching.PushToCache(CLI.options['cachePushFrom'], CLI.options['cachePushTo'], CLI.options['artifactName']);
|
||||
CloudRunnerLogger.log(
|
||||
`${Input.cliOptions['cachePushFrom']} ${Input.cliOptions['cachePushTo']} ${Input.cliOptions['artifactName']}`,
|
||||
`${CLI.options['cachePushFrom']} ${CLI.options['cachePushTo']} ${CLI.options['artifactName']}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import Input from '../input';
|
|||
import { CloudRunnerStatics } from './cloud-runner-statics';
|
||||
import { TaskParameterSerializer } from './services/task-parameter-serializer';
|
||||
import UnityVersioning from '../unity-versioning';
|
||||
import { CLI } from '../cli/cli';
|
||||
|
||||
function guid() {
|
||||
return Math.trunc((1 + Math.random()) * 0x10000)
|
||||
|
|
@ -22,7 +23,7 @@ describe('Cloud Runner', () => {
|
|||
if (Input.cloudRunnerTests) {
|
||||
it('All build parameters sent to cloud runner as env vars', async () => {
|
||||
// build parameters
|
||||
Input.cliOptions = {
|
||||
CLI.options = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
unityVersion: UnityVersioning.read('test-project'),
|
||||
|
|
@ -60,7 +61,7 @@ describe('Cloud Runner', () => {
|
|||
Input.githubInputEnabled = true;
|
||||
}, 1000000);
|
||||
it('Run one build it should not use cache, run subsequent build which should use cache', async () => {
|
||||
Input.cliOptions = {
|
||||
CLI.options = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
unityVersion: UnityVersioning.read('test-project'),
|
||||
|
|
|
|||
|
|
@ -9,6 +9,14 @@ const formatFunction = (value, arguments_) => {
|
|||
};
|
||||
|
||||
class CloudRunnerQueryOverride {
|
||||
static queryOverrides: any;
|
||||
|
||||
public static query(key) {
|
||||
return CloudRunnerQueryOverride.queryOverrides && CloudRunnerQueryOverride.queryOverrides[key] !== undefined
|
||||
? CloudRunnerQueryOverride.queryOverrides[key]
|
||||
: undefined;
|
||||
}
|
||||
|
||||
private static shouldUseOverride(query) {
|
||||
if (Input.readInputOverrideCommand() !== '') {
|
||||
if (Input.readInputFromOverrideList() !== '') {
|
||||
|
|
@ -32,10 +40,10 @@ class CloudRunnerQueryOverride {
|
|||
|
||||
public static async PopulateQueryOverrideInput() {
|
||||
const queries = Input.readInputFromOverrideList().split(',');
|
||||
Input.queryOverrides = new Array();
|
||||
CloudRunnerQueryOverride.queryOverrides = new Array();
|
||||
for (const element of queries) {
|
||||
if (CloudRunnerQueryOverride.shouldUseOverride(element)) {
|
||||
Input.queryOverrides[element] = await CloudRunnerQueryOverride.queryOverride(element);
|
||||
CloudRunnerQueryOverride.queryOverrides[element] = await CloudRunnerQueryOverride.queryOverride(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import ImageEnvironmentFactory from '../../image-environment-factory';
|
|||
import CloudRunnerEnvironmentVariable from './cloud-runner-environment-variable';
|
||||
import { CloudRunnerBuildCommandProcessor } from './cloud-runner-build-command-process';
|
||||
import CloudRunnerSecret from './cloud-runner-secret';
|
||||
import CloudRunnerQueryOverride from './cloud-runner-query-override';
|
||||
|
||||
export class TaskParameterSerializer {
|
||||
public static readBuildEnvironmentVariables(): CloudRunnerEnvironmentVariable[] {
|
||||
|
|
@ -86,8 +87,9 @@ export class TaskParameterSerializer {
|
|||
return array;
|
||||
}
|
||||
private static getValue(key) {
|
||||
return Input.queryOverrides !== undefined && Input.queryOverrides[key] !== undefined
|
||||
? Input.queryOverrides[key]
|
||||
return CloudRunnerQueryOverride.queryOverrides !== undefined &&
|
||||
CloudRunnerQueryOverride.queryOverrides[key] !== undefined
|
||||
? CloudRunnerQueryOverride.queryOverrides[key]
|
||||
: process.env[key];
|
||||
}
|
||||
private static tryAddInput(array, key): CloudRunnerSecret[] {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { CLI } from './cli/cli';
|
||||
import CloudRunnerQueryOverride from './cloud-runner/services/cloud-runner-query-override';
|
||||
import Platform from './platform';
|
||||
|
||||
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
|
||||
*/
|
||||
class Input {
|
||||
public static cliOptions;
|
||||
public static queryOverrides;
|
||||
public static githubInputEnabled: boolean = true;
|
||||
|
||||
// also enabled debug logging for cloud runner
|
||||
|
|
@ -21,22 +21,18 @@ class Input {
|
|||
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) {
|
||||
const coreInput = core.getInput(query);
|
||||
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
|
||||
return coreInput;
|
||||
}
|
||||
|
||||
if (Input.cliMode && Input.cliOptions[query] !== undefined) {
|
||||
return Input.cliOptions[query];
|
||||
if (CLI.query(query)) {
|
||||
return CLI.query(query);
|
||||
}
|
||||
|
||||
if (Input.queryOverrides && Input.queryOverrides[query] !== undefined) {
|
||||
return Input.queryOverrides[query];
|
||||
if (CloudRunnerQueryOverride.query(query)) {
|
||||
return CloudRunnerQueryOverride.query(query);
|
||||
}
|
||||
|
||||
if (process.env[query] !== undefined) {
|
||||
|
|
@ -223,7 +219,7 @@ class Input {
|
|||
}
|
||||
|
||||
static get cloudRunnerCluster() {
|
||||
if (Input.cliMode) {
|
||||
if (CLI.cliMode) {
|
||||
return Input.getInput('cloudRunnerCluster') || 'aws';
|
||||
}
|
||||
return Input.getInput('cloudRunnerCluster') || 'local';
|
||||
|
|
|
|||
Loading…
Reference in New Issue