Various fixes
parent
bc6e89c036
commit
a5dc42af42
|
|
@ -500,6 +500,7 @@ const cli_decorator_1 = __nccwpck_require__(8731);
|
||||||
const remote_client_logger_1 = __nccwpck_require__(28082);
|
const remote_client_logger_1 = __nccwpck_require__(28082);
|
||||||
const setup_cloud_runner_repository_1 = __nccwpck_require__(39656);
|
const setup_cloud_runner_repository_1 = __nccwpck_require__(39656);
|
||||||
const SDK = __importStar(__nccwpck_require__(71786));
|
const SDK = __importStar(__nccwpck_require__(71786));
|
||||||
|
const caching_1 = __nccwpck_require__(38759);
|
||||||
class CLI {
|
class CLI {
|
||||||
static InitCliMode() {
|
static InitCliMode() {
|
||||||
const program = new commander_ts_1.Command();
|
const program = new commander_ts_1.Command();
|
||||||
|
|
@ -512,6 +513,7 @@ 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.parse(process.argv);
|
program.parse(process.argv);
|
||||||
CLI.options = program.opts();
|
CLI.options = program.opts();
|
||||||
__1.Input.cliOptions = CLI.options;
|
__1.Input.cliOptions = CLI.options;
|
||||||
|
|
@ -520,7 +522,9 @@ class CLI {
|
||||||
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`) {
|
||||||
yield __1.Input.PopulateQueryOverrideInput();
|
yield __1.Input.PopulateQueryOverrideInput();
|
||||||
|
}
|
||||||
CLI.logInput();
|
CLI.logInput();
|
||||||
const results = cli_decorator_1.GetCliFunctions(CLI.options.mode);
|
const results = cli_decorator_1.GetCliFunctions(CLI.options.mode);
|
||||||
cloud_runner_logger_1.default.log(`Entrypoint: ${results.key}`);
|
cloud_runner_logger_1.default.log(`Entrypoint: ${results.key}`);
|
||||||
|
|
@ -562,7 +566,15 @@ class CLI {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static cachePush() {
|
static cachePush() {
|
||||||
return __awaiter(this, void 0, void 0, function* () { });
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const buildParameter = JSON.parse(process.env.BUILD_PARAMETERS || '{}');
|
||||||
|
remote_client_logger_1.RemoteClientLogger.log(`Build Params:
|
||||||
|
${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']}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
static cachePull() {
|
static cachePull() {
|
||||||
return __awaiter(this, void 0, void 0, function* () { });
|
return __awaiter(this, void 0, void 0, function* () { });
|
||||||
|
|
@ -3159,9 +3171,9 @@ class BuildAutomationWorkflow {
|
||||||
zip -r "build-${cloud_runner_1.default.buildParameters.buildGuid}.zip" "build"
|
zip -r "build-${cloud_runner_1.default.buildParameters.buildGuid}.zip" "build"
|
||||||
mv "build-${cloud_runner_1.default.buildParameters.buildGuid}.zip" "${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}"
|
mv "build-${cloud_runner_1.default.buildParameters.buildGuid}.zip" "${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}"
|
||||||
chmod +x ${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
chmod +x ${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
||||||
node "${path_1.default
|
node ${path_1.default
|
||||||
.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`)
|
.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`)
|
||||||
.replace(/\\/g, `/`)}" -m cache-push "Library" "lib-${cloud_runner_1.default.buildParameters.buildGuid}.zip" "${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}/Library"
|
.replace(/\\/g, `/`)} -m cache-push --cachePushFrom "Library" --artifactName "lib-${cloud_runner_1.default.buildParameters.buildGuid}.zip" --cachePushTo "${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}/Library"
|
||||||
${cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests ? '' : '#'} tree -lh "${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull}"`;
|
${cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests ? '' : '#'} tree -lh "${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull}"`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3932,19 +3944,14 @@ class Input {
|
||||||
if (Input.cliMode && Input.cliOptions[query] !== undefined) {
|
if (Input.cliMode && Input.cliOptions[query] !== undefined) {
|
||||||
return Input.cliOptions[query];
|
return Input.cliOptions[query];
|
||||||
}
|
}
|
||||||
if (Input.queryOverrides !== undefined) {
|
if (Input.queryOverrides && Input.queryOverrides[query] !== undefined) {
|
||||||
if (Input.queryOverrides[query] !== undefined) {
|
|
||||||
return Input.queryOverrides[query];
|
return Input.queryOverrides[query];
|
||||||
}
|
}
|
||||||
if (Input.queryOverrides[Input.ToEnvVarFormat(query)] !== undefined) {
|
|
||||||
return Input.queryOverrides[Input.ToEnvVarFormat(query)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (process.env[query] !== undefined) {
|
if (process.env[query] !== undefined) {
|
||||||
return process.env[query];
|
return process.env[query];
|
||||||
}
|
}
|
||||||
if (process.env[Input.ToEnvVarFormat(query)] !== undefined) {
|
if (Input.ToEnvVarFormat(query) !== query) {
|
||||||
return process.env[Input.ToEnvVarFormat(query)];
|
return Input.getInput(Input.ToEnvVarFormat(query));
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
@ -4118,6 +4125,9 @@ class Input {
|
||||||
return Input.getInput('cacheKey') || '';
|
return Input.getInput('cacheKey') || '';
|
||||||
}
|
}
|
||||||
static ToEnvVarFormat(input) {
|
static ToEnvVarFormat(input) {
|
||||||
|
if (input.toUpperCase() === input) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
return input
|
return input
|
||||||
.replace(/([A-Z])/g, ' $1')
|
.replace(/([A-Z])/g, ' $1')
|
||||||
.trim()
|
.trim()
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -12,7 +12,7 @@
|
||||||
"lint": "prettier --check \"src/**/*.{js,ts}\" && eslint src/**/*.ts",
|
"lint": "prettier --check \"src/**/*.{js,ts}\" && eslint src/**/*.ts",
|
||||||
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
||||||
"cli": "yarn ts-node src/index.ts -m cli",
|
"cli": "yarn ts-node src/index.ts -m cli",
|
||||||
"gcp-secrets-cli": "cross-env cloudRunnerTests=true readInputOverrideCommand=\"gcloud secrets versions access 1 --secret=\"{0}\"\" yarn ts-node src/index.ts -m cli --readInputFromOverrideList UNITY_EMAIL,UNITY_SERIAL,UNITY_PASSWORD",
|
"gcp-secrets-cli": "cross-env cloudRunnerTests=true readInputOverrideCommand=\"gcloud secrets versions access 1 --secret=\"{0}\"\" yarn ts-node src/index.ts -m cli --populateOverride true --readInputFromOverrideList UNITY_EMAIL,UNITY_SERIAL,UNITY_PASSWORD",
|
||||||
"cli-aws": "cross-env cloudRunnerCluster=aws yarn run test-cli",
|
"cli-aws": "cross-env cloudRunnerCluster=aws yarn run test-cli",
|
||||||
"cli-k8s": "cross-env cloudRunnerCluster=k8s yarn run test-cli",
|
"cli-k8s": "cross-env cloudRunnerCluster=k8s yarn run test-cli",
|
||||||
"test-cli": "cross-env cloudRunnerTests=true yarn ts-node src/index.ts -m cli --projectPath test-project",
|
"test-cli": "cross-env cloudRunnerTests=true yarn ts-node src/index.ts -m cli --projectPath test-project",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { CliFunction, GetAllCliModes, GetCliFunctions } from './cli-decorator';
|
||||||
import { RemoteClientLogger } from './remote-client/remote-client-services/remote-client-logger';
|
import { RemoteClientLogger } from './remote-client/remote-client-services/remote-client-logger';
|
||||||
import { SetupCloudRunnerRepository } from './remote-client/setup-cloud-runner-repository';
|
import { SetupCloudRunnerRepository } from './remote-client/setup-cloud-runner-repository';
|
||||||
import * as SDK from 'aws-sdk';
|
import * as SDK from 'aws-sdk';
|
||||||
|
import { Caching } from './remote-client/remote-client-services/caching';
|
||||||
|
|
||||||
export class CLI {
|
export class CLI {
|
||||||
private static options;
|
private static options;
|
||||||
|
|
@ -25,6 +26,7 @@ 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.parse(process.argv);
|
program.parse(process.argv);
|
||||||
CLI.options = program.opts();
|
CLI.options = program.opts();
|
||||||
Input.cliOptions = CLI.options;
|
Input.cliOptions = CLI.options;
|
||||||
|
|
@ -33,7 +35,9 @@ export class CLI {
|
||||||
|
|
||||||
static async RunCli(): Promise<void> {
|
static async RunCli(): Promise<void> {
|
||||||
Input.githubInputEnabled = false;
|
Input.githubInputEnabled = false;
|
||||||
|
if (CLI.options['populate'] === `true`) {
|
||||||
await Input.PopulateQueryOverrideInput();
|
await Input.PopulateQueryOverrideInput();
|
||||||
|
}
|
||||||
CLI.logInput();
|
CLI.logInput();
|
||||||
const results = GetCliFunctions(CLI.options.mode);
|
const results = GetCliFunctions(CLI.options.mode);
|
||||||
CloudRunnerLogger.log(`Entrypoint: ${results.key}`);
|
CloudRunnerLogger.log(`Entrypoint: ${results.key}`);
|
||||||
|
|
@ -78,7 +82,21 @@ export class CLI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@CliFunction(`cache-push`, `push to cache`)
|
@CliFunction(`cache-push`, `push to cache`)
|
||||||
static async cachePush() {}
|
static async cachePush() {
|
||||||
|
const buildParameter = JSON.parse(process.env.BUILD_PARAMETERS || '{}');
|
||||||
|
RemoteClientLogger.log(`Build Params:
|
||||||
|
${JSON.stringify(buildParameter, undefined, 4)}
|
||||||
|
`);
|
||||||
|
CloudRunner.buildParameters = buildParameter;
|
||||||
|
await Caching.PushToCache(
|
||||||
|
Input.cliOptions['cachePushFrom'],
|
||||||
|
Input.cliOptions['cachePushTo'],
|
||||||
|
Input.cliOptions['artifactName'],
|
||||||
|
);
|
||||||
|
CloudRunnerLogger.log(
|
||||||
|
`${Input.cliOptions['cachePushFrom']} ${Input.cliOptions['cachePushTo']} ${Input.cliOptions['artifactName']}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@CliFunction(`cache-pull`, `pull from cache`)
|
@CliFunction(`cache-pull`, `pull from cache`)
|
||||||
static async cachePull() {}
|
static async cachePull() {}
|
||||||
|
|
|
||||||
|
|
@ -122,11 +122,11 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
zip -r "build-${CloudRunner.buildParameters.buildGuid}.zip" "build"
|
zip -r "build-${CloudRunner.buildParameters.buildGuid}.zip" "build"
|
||||||
mv "build-${CloudRunner.buildParameters.buildGuid}.zip" "${CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}"
|
mv "build-${CloudRunner.buildParameters.buildGuid}.zip" "${CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}"
|
||||||
chmod +x ${path.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
chmod +x ${path.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
||||||
node "${path
|
node ${path
|
||||||
.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`)
|
.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`)
|
||||||
.replace(/\\/g, `/`)}" -m cache-push "Library" "lib-${
|
.replace(/\\/g, `/`)} -m cache-push --cachePushFrom "Library" --artifactName "lib-${
|
||||||
CloudRunner.buildParameters.buildGuid
|
CloudRunner.buildParameters.buildGuid
|
||||||
}.zip" "${CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}/Library"
|
}.zip" --cachePushTo "${CloudRunnerFolders.cacheFolderFull.replace(/\\/g, `/`)}/Library"
|
||||||
${CloudRunner.buildParameters.cloudRunnerIntegrationTests ? '' : '#'} tree -lh "${
|
${CloudRunner.buildParameters.cloudRunnerIntegrationTests ? '' : '#'} tree -lh "${
|
||||||
CloudRunnerFolders.cacheFolderFull
|
CloudRunnerFolders.cacheFolderFull
|
||||||
}"`;
|
}"`;
|
||||||
|
|
|
||||||
|
|
@ -70,22 +70,16 @@ class Input {
|
||||||
return Input.cliOptions[query];
|
return Input.cliOptions[query];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.queryOverrides !== undefined) {
|
if (Input.queryOverrides && Input.queryOverrides[query] !== undefined) {
|
||||||
if (Input.queryOverrides[query] !== undefined) {
|
|
||||||
return Input.queryOverrides[query];
|
return Input.queryOverrides[query];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.queryOverrides[Input.ToEnvVarFormat(query)] !== undefined) {
|
|
||||||
return Input.queryOverrides[Input.ToEnvVarFormat(query)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env[query] !== undefined) {
|
if (process.env[query] !== undefined) {
|
||||||
return process.env[query];
|
return process.env[query];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env[Input.ToEnvVarFormat(query)] !== undefined) {
|
if (Input.ToEnvVarFormat(query) !== query) {
|
||||||
return process.env[Input.ToEnvVarFormat(query)];
|
return Input.getInput(Input.ToEnvVarFormat(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
@ -304,6 +298,9 @@ class Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ToEnvVarFormat(input: string) {
|
public static ToEnvVarFormat(input: string) {
|
||||||
|
if (input.toUpperCase() === input) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
return input
|
return input
|
||||||
.replace(/([A-Z])/g, ' $1')
|
.replace(/([A-Z])/g, ' $1')
|
||||||
.trim()
|
.trim()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue