Refactor and cleanup - no async input, combined setup/build, removed github logs for cli runs
parent
8dffcc1c5c
commit
cfc9d23ea3
|
|
@ -306,6 +306,7 @@ class BuildParameters {
|
|||
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,
|
||||
|
|
@ -514,17 +515,6 @@ const cloud_runner_state_1 = __nccwpck_require__(70912);
|
|||
const setup_cloud_runner_repository_1 = __nccwpck_require__(39656);
|
||||
const SDK = __importStar(__nccwpck_require__(71786));
|
||||
class CLI {
|
||||
static RunCli() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
__1.Input.githubInputEnabled = false;
|
||||
yield __1.Input.PopulateQueryOverrideInput();
|
||||
CLI.logInput();
|
||||
const results = cli_decorator_1.GetCliFunctions(CLI.options.mode);
|
||||
cloud_runner_logger_1.default.log(`Entrypoint: ${results.key}`);
|
||||
CLI.options.versioning = 'None';
|
||||
return yield results.target[results.propertyKey]();
|
||||
});
|
||||
}
|
||||
static InitCliMode() {
|
||||
const program = new commander_ts_1.Command();
|
||||
program.version('0.0.1');
|
||||
|
|
@ -541,6 +531,17 @@ class CLI {
|
|||
__1.Input.cliOptions = CLI.options;
|
||||
return __1.Input.cliMode;
|
||||
}
|
||||
static RunCli() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
__1.Input.githubInputEnabled = false;
|
||||
yield __1.Input.PopulateQueryOverrideInput();
|
||||
CLI.logInput();
|
||||
const results = cli_decorator_1.GetCliFunctions(CLI.options.mode);
|
||||
cloud_runner_logger_1.default.log(`Entrypoint: ${results.key}`);
|
||||
CLI.options.versioning = 'None';
|
||||
return yield results.target[results.propertyKey]();
|
||||
});
|
||||
}
|
||||
static logInput() {
|
||||
core.info(`\n`);
|
||||
core.info(`INPUT:`);
|
||||
|
|
@ -3682,16 +3683,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||
class ImageTag {
|
||||
constructor(imageProperties) {
|
||||
const { repository = 'unityci', name = 'editor', version = '2019.2.11f1', platform, customImage } = imageProperties;
|
||||
const { repository = 'unityci', name = 'editor', version = '2019.2.11f1', platform, cloudRunnerBuilderPlatform, customImage, } = imageProperties;
|
||||
if (!ImageTag.versionPattern.test(version)) {
|
||||
throw new Error(`Invalid version "${version}".`);
|
||||
}
|
||||
const builderPlatform = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
||||
const builderPlatformSuffix = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
||||
this.repository = repository;
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
this.platform = platform;
|
||||
this.builderPlatform = builderPlatform;
|
||||
this.builderPlatformSuffix = builderPlatformSuffix;
|
||||
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
||||
this.customImage = customImage;
|
||||
}
|
||||
static get versionPattern() {
|
||||
|
|
@ -3784,12 +3786,13 @@ class ImageTag {
|
|||
}
|
||||
}
|
||||
get tag() {
|
||||
const tagPlatform = this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : process.platform;
|
||||
//We check the host os so we know what type of the images we need to pull
|
||||
switch (process.platform) {
|
||||
switch (tagPlatform) {
|
||||
case 'win32':
|
||||
return `windows-${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||
return `windows-${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||
case 'linux':
|
||||
return `${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||
return `${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -4151,6 +4154,9 @@ class Input {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
static get cloudRunnerBuilderPlatform() {
|
||||
return Input.getInput('cloudRunnerBuilderPlatform') || false;
|
||||
}
|
||||
static get gitSha() {
|
||||
if (Input.getInput(`GITHUB_SHA`)) {
|
||||
return Input.getInput(`GITHUB_SHA`);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -64,6 +64,7 @@ class BuildParameters {
|
|||
public buildGuid!: string;
|
||||
public cloudRunnerBranch!: string;
|
||||
public cloudRunnerIntegrationTests!: boolean;
|
||||
public cloudRunnerBuilderPlatform!: string;
|
||||
public cliMode!: boolean;
|
||||
|
||||
static async create(): Promise<BuildParameters> {
|
||||
|
|
@ -120,6 +121,7 @@ class BuildParameters {
|
|||
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
||||
chownFilesTo: Input.chownFilesTo,
|
||||
cloudRunnerCluster: Input.cloudRunnerCluster,
|
||||
cloudRunnerBuilderPlatform: Input.cloudRunnerBuilderPlatform,
|
||||
awsBaseStackName: Input.awsBaseStackName,
|
||||
kubeConfig: Input.kubeConfig,
|
||||
cloudRunnerMemory: Input.cloudRunnerMemory,
|
||||
|
|
|
|||
|
|
@ -11,15 +11,6 @@ import * as SDK from 'aws-sdk';
|
|||
|
||||
export class CLI {
|
||||
private static options;
|
||||
static async RunCli(): Promise<void> {
|
||||
Input.githubInputEnabled = false;
|
||||
await Input.PopulateQueryOverrideInput();
|
||||
CLI.logInput();
|
||||
const results = GetCliFunctions(CLI.options.mode);
|
||||
CloudRunnerLogger.log(`Entrypoint: ${results.key}`);
|
||||
CLI.options.versioning = 'None';
|
||||
return await results.target[results.propertyKey]();
|
||||
}
|
||||
|
||||
public static InitCliMode() {
|
||||
const program = new Command();
|
||||
|
|
@ -41,6 +32,16 @@ export class CLI {
|
|||
return Input.cliMode;
|
||||
}
|
||||
|
||||
static async RunCli(): Promise<void> {
|
||||
Input.githubInputEnabled = false;
|
||||
await Input.PopulateQueryOverrideInput();
|
||||
CLI.logInput();
|
||||
const results = GetCliFunctions(CLI.options.mode);
|
||||
CloudRunnerLogger.log(`Entrypoint: ${results.key}`);
|
||||
CLI.options.versioning = 'None';
|
||||
return await results.target[results.propertyKey]();
|
||||
}
|
||||
|
||||
private static logInput() {
|
||||
core.info(`\n`);
|
||||
core.info(`INPUT:`);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ describe('ImageTag', () => {
|
|||
expect(image.name).toStrictEqual(some.name);
|
||||
expect(image.version).toStrictEqual(some.version);
|
||||
expect(image.platform).toStrictEqual(some.platform);
|
||||
expect(image.builderPlatform).toStrictEqual(some.builderPlatform);
|
||||
expect(image.builderPlatformSuffix).toStrictEqual(some.builderPlatform);
|
||||
});
|
||||
|
||||
test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
|
||||
|
|
|
|||
|
|
@ -5,23 +5,32 @@ class ImageTag {
|
|||
public name: string;
|
||||
public version: string;
|
||||
public platform: any;
|
||||
public builderPlatform: string;
|
||||
public builderPlatformSuffix: string;
|
||||
public cloudRunnerBuilderPlatform: string;
|
||||
public customImage: any;
|
||||
|
||||
constructor(imageProperties) {
|
||||
const { repository = 'unityci', name = 'editor', version = '2019.2.11f1', platform, customImage } = imageProperties;
|
||||
const {
|
||||
repository = 'unityci',
|
||||
name = 'editor',
|
||||
version = '2019.2.11f1',
|
||||
platform,
|
||||
cloudRunnerBuilderPlatform,
|
||||
customImage,
|
||||
} = imageProperties;
|
||||
|
||||
if (!ImageTag.versionPattern.test(version)) {
|
||||
throw new Error(`Invalid version "${version}".`);
|
||||
}
|
||||
|
||||
const builderPlatform = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
||||
const builderPlatformSuffix = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
||||
|
||||
this.repository = repository;
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
this.platform = platform;
|
||||
this.builderPlatform = builderPlatform;
|
||||
this.builderPlatformSuffix = builderPlatformSuffix;
|
||||
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
||||
this.customImage = customImage;
|
||||
}
|
||||
|
||||
|
|
@ -120,12 +129,13 @@ class ImageTag {
|
|||
}
|
||||
|
||||
get tag() {
|
||||
const tagPlatform = this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : process.platform;
|
||||
//We check the host os so we know what type of the images we need to pull
|
||||
switch (process.platform) {
|
||||
switch (tagPlatform) {
|
||||
case 'win32':
|
||||
return `windows-${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||
return `windows-${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||
case 'linux':
|
||||
return `${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||
return `${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,9 @@ class Input {
|
|||
return '';
|
||||
}
|
||||
}
|
||||
static get cloudRunnerBuilderPlatform() {
|
||||
return Input.getInput('cloudRunnerBuilderPlatform') || false;
|
||||
}
|
||||
|
||||
static get gitSha() {
|
||||
if (Input.getInput(`GITHUB_SHA`)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue