cli
parent
e4f6734e21
commit
e0f08a973c
|
|
@ -50,7 +50,7 @@ function run() {
|
|||
switch (buildParameters.cloudRunnerCluster) {
|
||||
case 'aws':
|
||||
case 'k8s':
|
||||
yield model_1.CloudRunner.run(buildParameters, baseImage);
|
||||
yield model_1.CloudRunner.run(buildParameters, baseImage.toString());
|
||||
break;
|
||||
// default and local case
|
||||
default:
|
||||
|
|
@ -240,6 +240,7 @@ class BuildParameters {
|
|||
postBuildSteps: input_1.default.postBuildSteps,
|
||||
preBuildSteps: input_1.default.preBuildSteps,
|
||||
customBuildSteps: input_1.default.customBuildSteps,
|
||||
runNumber: input_1.default.runNumber,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
@ -1111,8 +1112,8 @@ const cloud_runner_error_1 = __webpack_require__(2600);
|
|||
class CloudRunner {
|
||||
static setup(buildParameters) {
|
||||
cloud_runner_logger_1.default.setup();
|
||||
cloud_runner_state_1.CloudRunnerState.buildGuid = cloud_runner_namespace_1.default.generateBuildName(cloud_runner_state_1.CloudRunnerState.readRunNumber(), buildParameters.platform);
|
||||
cloud_runner_state_1.CloudRunnerState.buildParams = buildParameters;
|
||||
cloud_runner_state_1.CloudRunnerState.buildGuid = cloud_runner_namespace_1.default.generateBuildName(cloud_runner_state_1.CloudRunnerState.readRunNumber(), buildParameters.platform);
|
||||
cloud_runner_state_1.CloudRunnerState.setupBranchName();
|
||||
cloud_runner_state_1.CloudRunnerState.setupFolderVariables();
|
||||
cloud_runner_state_1.CloudRunnerState.setupDefaultSecrets();
|
||||
|
|
@ -2068,7 +2069,7 @@ class CloudRunnerState {
|
|||
return `git clone -q ${CloudRunnerState.CloudRunnerBranch} ${CloudRunnerState.unityBuilderRepoUrl} ${CloudRunnerState.builderPathFull}`;
|
||||
}
|
||||
static readRunNumber() {
|
||||
const runNumber = process.env.GITHUB_RUN_NUMBER;
|
||||
const runNumber = CloudRunnerState.buildParams.runNumber;
|
||||
if (!runNumber || runNumber === '') {
|
||||
throw new Error('no run number found, exiting');
|
||||
}
|
||||
|
|
@ -2953,103 +2954,116 @@ const core = __webpack_require__(42186);
|
|||
* Note that input is always passed as a string, even booleans.
|
||||
*/
|
||||
class Input {
|
||||
static getInput(query) {
|
||||
return Input.githubEnabled
|
||||
? core.getInput(query)
|
||||
: Input.cliOptions !== undefined
|
||||
? Input.cliOptions[query]
|
||||
: process.env[query] !== undefined
|
||||
? process.env[query]
|
||||
: false;
|
||||
}
|
||||
static get runNumber() {
|
||||
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
||||
}
|
||||
static get unityVersion() {
|
||||
return core.getInput('unityVersion') || 'auto';
|
||||
return Input.getInput('unityVersion') || 'auto';
|
||||
}
|
||||
static get customImage() {
|
||||
return core.getInput('customImage');
|
||||
return Input.getInput('customImage');
|
||||
}
|
||||
static get targetPlatform() {
|
||||
return core.getInput('targetPlatform') || platform_1.default.default;
|
||||
return Input.getInput('targetPlatform') || platform_1.default.default;
|
||||
}
|
||||
static get projectPath() {
|
||||
const rawProjectPath = core.getInput('projectPath') || '.';
|
||||
const rawProjectPath = Input.getInput('projectPath') || '.';
|
||||
return rawProjectPath.replace(/\/$/, '');
|
||||
}
|
||||
static get buildName() {
|
||||
return core.getInput('buildName') || this.targetPlatform;
|
||||
return Input.getInput('buildName') || this.targetPlatform;
|
||||
}
|
||||
static get buildsPath() {
|
||||
return core.getInput('buildsPath') || 'build';
|
||||
return Input.getInput('buildsPath') || 'build';
|
||||
}
|
||||
static get buildMethod() {
|
||||
return core.getInput('buildMethod'); // processed in docker file
|
||||
return Input.getInput('buildMethod'); // processed in docker file
|
||||
}
|
||||
static get versioningStrategy() {
|
||||
return core.getInput('versioning') || 'Semantic';
|
||||
return Input.getInput('versioning') || 'Semantic';
|
||||
}
|
||||
static get specifiedVersion() {
|
||||
return core.getInput('version') || '';
|
||||
return Input.getInput('version') || '';
|
||||
}
|
||||
static get androidVersionCode() {
|
||||
return core.getInput('androidVersionCode');
|
||||
return Input.getInput('androidVersionCode');
|
||||
}
|
||||
static get androidAppBundle() {
|
||||
const input = core.getInput('androidAppBundle') || false;
|
||||
const input = Input.getInput('androidAppBundle') || false;
|
||||
return input === 'true';
|
||||
}
|
||||
static get androidKeystoreName() {
|
||||
return core.getInput('androidKeystoreName') || '';
|
||||
return Input.getInput('androidKeystoreName') || '';
|
||||
}
|
||||
static get androidKeystoreBase64() {
|
||||
return core.getInput('androidKeystoreBase64') || '';
|
||||
return Input.getInput('androidKeystoreBase64') || '';
|
||||
}
|
||||
static get androidKeystorePass() {
|
||||
return core.getInput('androidKeystorePass') || '';
|
||||
return Input.getInput('androidKeystorePass') || '';
|
||||
}
|
||||
static get androidKeyaliasName() {
|
||||
return core.getInput('androidKeyaliasName') || '';
|
||||
return Input.getInput('androidKeyaliasName') || '';
|
||||
}
|
||||
static get androidKeyaliasPass() {
|
||||
return core.getInput('androidKeyaliasPass') || '';
|
||||
return Input.getInput('androidKeyaliasPass') || '';
|
||||
}
|
||||
static get allowDirtyBuild() {
|
||||
const input = core.getInput('allowDirtyBuild') || false;
|
||||
const input = Input.getInput('allowDirtyBuild') || false;
|
||||
return input === 'true';
|
||||
}
|
||||
static get customParameters() {
|
||||
return core.getInput('customParameters') || '';
|
||||
return Input.getInput('customParameters') || '';
|
||||
}
|
||||
static get sshAgent() {
|
||||
return core.getInput('sshAgent') || '';
|
||||
return Input.getInput('sshAgent') || '';
|
||||
}
|
||||
static get chownFilesTo() {
|
||||
return core.getInput('chownFilesTo') || '';
|
||||
return Input.getInput('chownFilesTo') || '';
|
||||
}
|
||||
static get postBuildSteps() {
|
||||
return core.getInput('postBuildSteps');
|
||||
return Input.getInput('postBuildSteps');
|
||||
}
|
||||
static get preBuildSteps() {
|
||||
return core.getInput('preBuildSteps');
|
||||
return Input.getInput('preBuildSteps');
|
||||
}
|
||||
static get customBuildSteps() {
|
||||
return core.getInput('customBuildSteps');
|
||||
return Input.getInput('customBuildSteps');
|
||||
}
|
||||
static get cloudRunnerCluster() {
|
||||
return core.getInput('cloudRunnerCluster') || '';
|
||||
return Input.getInput('cloudRunnerCluster') || '';
|
||||
}
|
||||
static get awsBaseStackName() {
|
||||
return core.getInput('awsBaseStackName') || '';
|
||||
return Input.getInput('awsBaseStackName') || '';
|
||||
}
|
||||
static get kubeConfig() {
|
||||
return core.getInput('kubeConfig') || '';
|
||||
return Input.getInput('kubeConfig') || '';
|
||||
}
|
||||
static get githubToken() {
|
||||
return core.getInput('githubToken') || '';
|
||||
return Input.getInput('githubToken') || '';
|
||||
}
|
||||
static get cloudRunnerMemory() {
|
||||
return core.getInput('cloudRunnerMemory') || '750M';
|
||||
return Input.getInput('cloudRunnerMemory') || '750M';
|
||||
}
|
||||
static get cloudRunnerCpu() {
|
||||
return core.getInput('cloudRunnerCpu') || '1.0';
|
||||
return Input.getInput('cloudRunnerCpu') || '1.0';
|
||||
}
|
||||
static get kubeVolumeSize() {
|
||||
return core.getInput('kubeVolumeSize') || '5Gi';
|
||||
return Input.getInput('kubeVolumeSize') || '5Gi';
|
||||
}
|
||||
static get kubeVolume() {
|
||||
return core.getInput('kubeVolume') || '';
|
||||
return Input.getInput('kubeVolume') || '';
|
||||
}
|
||||
}
|
||||
Input.githubEnabled = true;
|
||||
exports.default = Input;
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -11,7 +11,8 @@
|
|||
"build": "tsc && ncc build lib --source-map --license licenses.txt",
|
||||
"lint": "prettier --check \"src/**/*.{js,ts}\" && eslint src/**/*.ts",
|
||||
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
||||
"test": "jest"
|
||||
"test": "jest",
|
||||
"cli": "npx ts-node src/cli.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
|
|
@ -21,7 +22,10 @@
|
|||
"async-wait-until": "^2.0.7",
|
||||
"aws-sdk": "^2.812.0",
|
||||
"base-64": "^1.0.0",
|
||||
"commander": "^8.3.0",
|
||||
"commander-ts": "^0.2.0",
|
||||
"nanoid": "3.1.20",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rxjs": "^7.4.0",
|
||||
"semver": "^7.3.2",
|
||||
"yaml": "^1.10.2"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
import { BuildParameters, CloudRunner, Input } from './model';
|
||||
import { Command } from 'commander-ts';
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Created base image`);
|
||||
const program = new Command();
|
||||
program.version('0.0.1');
|
||||
program.parse();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Created base image`);
|
||||
|
||||
const options = program.opts();
|
||||
|
||||
Input.githubEnabled = false;
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Created base image`);
|
||||
|
||||
async function run() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Created base image`);
|
||||
options.projectPath = './test-project';
|
||||
options.versioning = 'None';
|
||||
Input.cliOptions = options;
|
||||
const buildParameter = await BuildParameters.create();
|
||||
await CloudRunner.run(buildParameter, ' ');
|
||||
}
|
||||
run();
|
||||
|
|
@ -15,7 +15,7 @@ async function run() {
|
|||
switch (buildParameters.cloudRunnerCluster) {
|
||||
case 'aws':
|
||||
case 'k8s':
|
||||
await CloudRunner.run(buildParameters, baseImage);
|
||||
await CloudRunner.run(buildParameters, baseImage.toString());
|
||||
break;
|
||||
|
||||
// default and local case
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class BuildParameters {
|
|||
public postBuildSteps;
|
||||
public preBuildSteps;
|
||||
public customBuildSteps;
|
||||
public runNumber;
|
||||
|
||||
static async create(): Promise<BuildParameters> {
|
||||
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle);
|
||||
|
|
@ -77,6 +78,7 @@ class BuildParameters {
|
|||
postBuildSteps: Input.postBuildSteps,
|
||||
preBuildSteps: Input.preBuildSteps,
|
||||
customBuildSteps: Input.customBuildSteps,
|
||||
runNumber: Input.runNumber,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ import { CloudRunnerError } from './error/cloud-runner-error';
|
|||
class CloudRunner {
|
||||
private static setup(buildParameters: BuildParameters) {
|
||||
CloudRunnerLogger.setup();
|
||||
CloudRunnerState.buildParams = buildParameters;
|
||||
CloudRunnerState.buildGuid = CloudRunnerNamespace.generateBuildName(
|
||||
CloudRunnerState.readRunNumber(),
|
||||
buildParameters.platform,
|
||||
);
|
||||
CloudRunnerState.buildParams = buildParameters;
|
||||
CloudRunnerState.setupBranchName();
|
||||
CloudRunnerState.setupFolderVariables();
|
||||
CloudRunnerState.setupDefaultSecrets();
|
||||
|
|
@ -36,7 +36,7 @@ class CloudRunner {
|
|||
}
|
||||
}
|
||||
|
||||
static async run(buildParameters: BuildParameters, baseImage) {
|
||||
static async run(buildParameters: BuildParameters, baseImage: string) {
|
||||
CloudRunner.setup(buildParameters);
|
||||
try {
|
||||
await CloudRunnerState.CloudRunnerProviderPlatform.setupSharedBuildResources(
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ export class CloudRunnerState {
|
|||
}
|
||||
|
||||
public static readRunNumber() {
|
||||
const runNumber = process.env.GITHUB_RUN_NUMBER;
|
||||
const runNumber = CloudRunnerState.buildParams.runNumber;
|
||||
if (!runNumber || runNumber === '') {
|
||||
throw new Error('no run number found, exiting');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,133 +8,149 @@ const core = require('@actions/core');
|
|||
* Note that input is always passed as a string, even booleans.
|
||||
*/
|
||||
class Input {
|
||||
public static githubEnabled = true;
|
||||
public static cliOptions;
|
||||
|
||||
private static getInput(query) {
|
||||
return Input.githubEnabled
|
||||
? core.getInput(query)
|
||||
: Input.cliOptions !== undefined
|
||||
? Input.cliOptions[query]
|
||||
: process.env[query] !== undefined
|
||||
? process.env[query]
|
||||
: false;
|
||||
}
|
||||
static get runNumber() {
|
||||
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
||||
}
|
||||
|
||||
static get unityVersion() {
|
||||
return core.getInput('unityVersion') || 'auto';
|
||||
return Input.getInput('unityVersion') || 'auto';
|
||||
}
|
||||
|
||||
static get customImage() {
|
||||
return core.getInput('customImage');
|
||||
return Input.getInput('customImage');
|
||||
}
|
||||
|
||||
static get targetPlatform() {
|
||||
return core.getInput('targetPlatform') || Platform.default;
|
||||
return Input.getInput('targetPlatform') || Platform.default;
|
||||
}
|
||||
|
||||
static get projectPath() {
|
||||
const rawProjectPath = core.getInput('projectPath') || '.';
|
||||
const rawProjectPath = Input.getInput('projectPath') || '.';
|
||||
return rawProjectPath.replace(/\/$/, '');
|
||||
}
|
||||
|
||||
static get buildName() {
|
||||
return core.getInput('buildName') || this.targetPlatform;
|
||||
return Input.getInput('buildName') || this.targetPlatform;
|
||||
}
|
||||
|
||||
static get buildsPath() {
|
||||
return core.getInput('buildsPath') || 'build';
|
||||
return Input.getInput('buildsPath') || 'build';
|
||||
}
|
||||
|
||||
static get buildMethod() {
|
||||
return core.getInput('buildMethod'); // processed in docker file
|
||||
return Input.getInput('buildMethod'); // processed in docker file
|
||||
}
|
||||
|
||||
static get versioningStrategy() {
|
||||
return core.getInput('versioning') || 'Semantic';
|
||||
return Input.getInput('versioning') || 'Semantic';
|
||||
}
|
||||
|
||||
static get specifiedVersion() {
|
||||
return core.getInput('version') || '';
|
||||
return Input.getInput('version') || '';
|
||||
}
|
||||
|
||||
static get androidVersionCode() {
|
||||
return core.getInput('androidVersionCode');
|
||||
return Input.getInput('androidVersionCode');
|
||||
}
|
||||
|
||||
static get androidAppBundle() {
|
||||
const input = core.getInput('androidAppBundle') || false;
|
||||
const input = Input.getInput('androidAppBundle') || false;
|
||||
|
||||
return input === 'true';
|
||||
}
|
||||
|
||||
static get androidKeystoreName() {
|
||||
return core.getInput('androidKeystoreName') || '';
|
||||
return Input.getInput('androidKeystoreName') || '';
|
||||
}
|
||||
|
||||
static get androidKeystoreBase64() {
|
||||
return core.getInput('androidKeystoreBase64') || '';
|
||||
return Input.getInput('androidKeystoreBase64') || '';
|
||||
}
|
||||
|
||||
static get androidKeystorePass() {
|
||||
return core.getInput('androidKeystorePass') || '';
|
||||
return Input.getInput('androidKeystorePass') || '';
|
||||
}
|
||||
|
||||
static get androidKeyaliasName() {
|
||||
return core.getInput('androidKeyaliasName') || '';
|
||||
return Input.getInput('androidKeyaliasName') || '';
|
||||
}
|
||||
|
||||
static get androidKeyaliasPass() {
|
||||
return core.getInput('androidKeyaliasPass') || '';
|
||||
return Input.getInput('androidKeyaliasPass') || '';
|
||||
}
|
||||
|
||||
static get allowDirtyBuild() {
|
||||
const input = core.getInput('allowDirtyBuild') || false;
|
||||
const input = Input.getInput('allowDirtyBuild') || false;
|
||||
|
||||
return input === 'true';
|
||||
}
|
||||
|
||||
static get customParameters() {
|
||||
return core.getInput('customParameters') || '';
|
||||
return Input.getInput('customParameters') || '';
|
||||
}
|
||||
|
||||
static get sshAgent() {
|
||||
return core.getInput('sshAgent') || '';
|
||||
return Input.getInput('sshAgent') || '';
|
||||
}
|
||||
|
||||
static get chownFilesTo() {
|
||||
return core.getInput('chownFilesTo') || '';
|
||||
return Input.getInput('chownFilesTo') || '';
|
||||
}
|
||||
|
||||
static get postBuildSteps() {
|
||||
return core.getInput('postBuildSteps');
|
||||
return Input.getInput('postBuildSteps');
|
||||
}
|
||||
|
||||
static get preBuildSteps() {
|
||||
return core.getInput('preBuildSteps');
|
||||
return Input.getInput('preBuildSteps');
|
||||
}
|
||||
|
||||
static get customBuildSteps() {
|
||||
return core.getInput('customBuildSteps');
|
||||
return Input.getInput('customBuildSteps');
|
||||
}
|
||||
|
||||
static get cloudRunnerCluster() {
|
||||
return core.getInput('cloudRunnerCluster') || '';
|
||||
return Input.getInput('cloudRunnerCluster') || '';
|
||||
}
|
||||
|
||||
static get awsBaseStackName() {
|
||||
return core.getInput('awsBaseStackName') || '';
|
||||
return Input.getInput('awsBaseStackName') || '';
|
||||
}
|
||||
|
||||
static get kubeConfig() {
|
||||
return core.getInput('kubeConfig') || '';
|
||||
return Input.getInput('kubeConfig') || '';
|
||||
}
|
||||
|
||||
static get githubToken() {
|
||||
return core.getInput('githubToken') || '';
|
||||
return Input.getInput('githubToken') || '';
|
||||
}
|
||||
|
||||
static get cloudRunnerMemory() {
|
||||
return core.getInput('cloudRunnerMemory') || '750M';
|
||||
return Input.getInput('cloudRunnerMemory') || '750M';
|
||||
}
|
||||
|
||||
static get cloudRunnerCpu() {
|
||||
return core.getInput('cloudRunnerCpu') || '1.0';
|
||||
return Input.getInput('cloudRunnerCpu') || '1.0';
|
||||
}
|
||||
|
||||
static get kubeVolumeSize() {
|
||||
return core.getInput('kubeVolumeSize') || '5Gi';
|
||||
return Input.getInput('kubeVolumeSize') || '5Gi';
|
||||
}
|
||||
|
||||
static get kubeVolume() {
|
||||
return core.getInput('kubeVolume') || '';
|
||||
return Input.getInput('kubeVolume') || '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
22
yarn.lock
22
yarn.lock
|
|
@ -1659,11 +1659,28 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
|
|||
dependencies:
|
||||
delayed-stream "~1.0.0"
|
||||
|
||||
commander-ts@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/commander-ts/-/commander-ts-0.2.0.tgz#14391337c1c725399cdfca5717da8e4fd0688eda"
|
||||
integrity sha512-9XaUF3/3nmVtkDmAkijjhgEcwrMwKewaAJtN+GyTJBG3CJ5DfGB/JsXCVZcBW6SZB+QqiJxbK3e2/62tweMO8g==
|
||||
dependencies:
|
||||
commander "^7.2.0"
|
||||
|
||||
commander@^6.2.0:
|
||||
version "6.2.1"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
|
||||
integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==
|
||||
|
||||
commander@^7.2.0:
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
|
||||
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
|
||||
|
||||
commander@^8.3.0:
|
||||
version "8.3.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
|
||||
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
|
||||
|
||||
compare-versions@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62"
|
||||
|
|
@ -4611,6 +4628,11 @@ rechoir@^0.6.2:
|
|||
dependencies:
|
||||
resolve "^1.1.6"
|
||||
|
||||
reflect-metadata@^0.1.13:
|
||||
version "0.1.13"
|
||||
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08"
|
||||
integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==
|
||||
|
||||
regex-not@^1.0.0, regex-not@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"
|
||||
|
|
|
|||
Loading…
Reference in New Issue