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()),
|
gitPrivateToken: input_1.default.gitPrivateToken || (yield github_cli_1.GithubCliReader.GetGitHubAuthToken()),
|
||||||
chownFilesTo: input_1.default.chownFilesTo,
|
chownFilesTo: input_1.default.chownFilesTo,
|
||||||
cloudRunnerCluster: input_1.default.cloudRunnerCluster,
|
cloudRunnerCluster: input_1.default.cloudRunnerCluster,
|
||||||
|
cloudRunnerBuilderPlatform: input_1.default.cloudRunnerBuilderPlatform,
|
||||||
awsBaseStackName: input_1.default.awsBaseStackName,
|
awsBaseStackName: input_1.default.awsBaseStackName,
|
||||||
kubeConfig: input_1.default.kubeConfig,
|
kubeConfig: input_1.default.kubeConfig,
|
||||||
cloudRunnerMemory: input_1.default.cloudRunnerMemory,
|
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 setup_cloud_runner_repository_1 = __nccwpck_require__(39656);
|
||||||
const SDK = __importStar(__nccwpck_require__(71786));
|
const SDK = __importStar(__nccwpck_require__(71786));
|
||||||
class CLI {
|
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() {
|
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');
|
||||||
|
|
@ -541,6 +531,17 @@ class CLI {
|
||||||
__1.Input.cliOptions = CLI.options;
|
__1.Input.cliOptions = CLI.options;
|
||||||
return __1.Input.cliMode;
|
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() {
|
static logInput() {
|
||||||
core.info(`\n`);
|
core.info(`\n`);
|
||||||
core.info(`INPUT:`);
|
core.info(`INPUT:`);
|
||||||
|
|
@ -3682,16 +3683,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||||
class ImageTag {
|
class ImageTag {
|
||||||
constructor(imageProperties) {
|
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)) {
|
if (!ImageTag.versionPattern.test(version)) {
|
||||||
throw new Error(`Invalid version "${version}".`);
|
throw new Error(`Invalid version "${version}".`);
|
||||||
}
|
}
|
||||||
const builderPlatform = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
const builderPlatformSuffix = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.builderPlatform = builderPlatform;
|
this.builderPlatformSuffix = builderPlatformSuffix;
|
||||||
|
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
||||||
this.customImage = customImage;
|
this.customImage = customImage;
|
||||||
}
|
}
|
||||||
static get versionPattern() {
|
static get versionPattern() {
|
||||||
|
|
@ -3784,12 +3786,13 @@ class ImageTag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get tag() {
|
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
|
//We check the host os so we know what type of the images we need to pull
|
||||||
switch (process.platform) {
|
switch (tagPlatform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return `windows-${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
return `windows-${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return `${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
return `${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -4151,6 +4154,9 @@ class Input {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static get cloudRunnerBuilderPlatform() {
|
||||||
|
return Input.getInput('cloudRunnerBuilderPlatform') || false;
|
||||||
|
}
|
||||||
static get gitSha() {
|
static get gitSha() {
|
||||||
if (Input.getInput(`GITHUB_SHA`)) {
|
if (Input.getInput(`GITHUB_SHA`)) {
|
||||||
return 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 buildGuid!: string;
|
||||||
public cloudRunnerBranch!: string;
|
public cloudRunnerBranch!: string;
|
||||||
public cloudRunnerIntegrationTests!: boolean;
|
public cloudRunnerIntegrationTests!: boolean;
|
||||||
|
public cloudRunnerBuilderPlatform!: string;
|
||||||
public cliMode!: boolean;
|
public cliMode!: boolean;
|
||||||
|
|
||||||
static async create(): Promise<BuildParameters> {
|
static async create(): Promise<BuildParameters> {
|
||||||
|
|
@ -120,6 +121,7 @@ class BuildParameters {
|
||||||
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
||||||
chownFilesTo: Input.chownFilesTo,
|
chownFilesTo: Input.chownFilesTo,
|
||||||
cloudRunnerCluster: Input.cloudRunnerCluster,
|
cloudRunnerCluster: Input.cloudRunnerCluster,
|
||||||
|
cloudRunnerBuilderPlatform: Input.cloudRunnerBuilderPlatform,
|
||||||
awsBaseStackName: Input.awsBaseStackName,
|
awsBaseStackName: Input.awsBaseStackName,
|
||||||
kubeConfig: Input.kubeConfig,
|
kubeConfig: Input.kubeConfig,
|
||||||
cloudRunnerMemory: Input.cloudRunnerMemory,
|
cloudRunnerMemory: Input.cloudRunnerMemory,
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,6 @@ import * as SDK from 'aws-sdk';
|
||||||
|
|
||||||
export class CLI {
|
export class CLI {
|
||||||
private static options;
|
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() {
|
public static InitCliMode() {
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
@ -41,6 +32,16 @@ export class CLI {
|
||||||
return Input.cliMode;
|
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() {
|
private static logInput() {
|
||||||
core.info(`\n`);
|
core.info(`\n`);
|
||||||
core.info(`INPUT:`);
|
core.info(`INPUT:`);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ describe('ImageTag', () => {
|
||||||
expect(image.name).toStrictEqual(some.name);
|
expect(image.name).toStrictEqual(some.name);
|
||||||
expect(image.version).toStrictEqual(some.version);
|
expect(image.version).toStrictEqual(some.version);
|
||||||
expect(image.platform).toStrictEqual(some.platform);
|
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) => {
|
test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
|
||||||
|
|
|
||||||
|
|
@ -5,23 +5,32 @@ class ImageTag {
|
||||||
public name: string;
|
public name: string;
|
||||||
public version: string;
|
public version: string;
|
||||||
public platform: any;
|
public platform: any;
|
||||||
public builderPlatform: string;
|
public builderPlatformSuffix: string;
|
||||||
|
public cloudRunnerBuilderPlatform: string;
|
||||||
public customImage: any;
|
public customImage: any;
|
||||||
|
|
||||||
constructor(imageProperties) {
|
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)) {
|
if (!ImageTag.versionPattern.test(version)) {
|
||||||
throw new Error(`Invalid version "${version}".`);
|
throw new Error(`Invalid version "${version}".`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const builderPlatform = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
const builderPlatformSuffix = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
||||||
|
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.builderPlatform = builderPlatform;
|
this.builderPlatformSuffix = builderPlatformSuffix;
|
||||||
|
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
||||||
this.customImage = customImage;
|
this.customImage = customImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,12 +129,13 @@ class ImageTag {
|
||||||
}
|
}
|
||||||
|
|
||||||
get tag() {
|
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
|
//We check the host os so we know what type of the images we need to pull
|
||||||
switch (process.platform) {
|
switch (tagPlatform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return `windows-${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
return `windows-${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return `${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
return `${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,9 @@ class Input {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static get cloudRunnerBuilderPlatform() {
|
||||||
|
return Input.getInput('cloudRunnerBuilderPlatform') || false;
|
||||||
|
}
|
||||||
|
|
||||||
static get gitSha() {
|
static get gitSha() {
|
||||||
if (Input.getInput(`GITHUB_SHA`)) {
|
if (Input.getInput(`GITHUB_SHA`)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue