shorter names
parent
12d548abf2
commit
0ac1fe821d
|
@ -45,7 +45,7 @@ async function runMain() {
|
|||
const { workspace, actionFolder } = model_1.Action;
|
||||
const buildParameters = await model_1.BuildParameters.create();
|
||||
const baseImage = new model_1.ImageTag(buildParameters);
|
||||
if (buildParameters.cloudRunnerCluster === 'local') {
|
||||
if (buildParameters.providerStrategy === 'local') {
|
||||
core.info('Building locally');
|
||||
await platform_setup_1.default.setup(buildParameters, actionFolder);
|
||||
if (process.platform === 'darwin') {
|
||||
|
@ -270,11 +270,11 @@ class BuildParameters {
|
|||
sshAgent: input_1.default.sshAgent,
|
||||
gitPrivateToken: input_1.default.gitPrivateToken || (await github_cli_1.GithubCliReader.GetGitHubAuthToken()),
|
||||
chownFilesTo: input_1.default.chownFilesTo,
|
||||
cloudRunnerCluster: cloud_runner_options_1.default.cloudRunnerCluster,
|
||||
cloudRunnerBuilderPlatform: cloud_runner_options_1.default.cloudRunnerBuilderPlatform,
|
||||
providerStrategy: cloud_runner_options_1.default.providerStrategy,
|
||||
buildPlatform: cloud_runner_options_1.default.buildPlatform,
|
||||
kubeConfig: cloud_runner_options_1.default.kubeConfig,
|
||||
cloudRunnerMemory: cloud_runner_options_1.default.containerMemory,
|
||||
cloudRunnerCpu: cloud_runner_options_1.default.containerCpu,
|
||||
containerMemory: cloud_runner_options_1.default.containerMemory,
|
||||
containerCpu: cloud_runner_options_1.default.containerCpu,
|
||||
kubeVolumeSize: cloud_runner_options_1.default.kubeVolumeSize,
|
||||
kubeVolume: cloud_runner_options_1.default.kubeVolume,
|
||||
postBuildSteps: cloud_runner_options_1.default.postBuildSteps,
|
||||
|
@ -290,19 +290,19 @@ class BuildParameters {
|
|||
gitSha: input_1.default.gitSha,
|
||||
logId: nanoid_1.customAlphabet(cloud_runner_constants_1.default.alphabet, 9)(),
|
||||
buildGuid: cloud_runner_guid_1.default.generateGuid(input_1.default.runNumber, input_1.default.targetPlatform),
|
||||
customCommandHooks: cloud_runner_options_1.default.customCommandHooks(),
|
||||
commandHooks: cloud_runner_options_1.default.commandHooks(),
|
||||
inputPullCommand: cloud_runner_options_1.default.inputPullCommand(),
|
||||
pullInputList: cloud_runner_options_1.default.pullInputList(),
|
||||
kubeStorageClass: cloud_runner_options_1.default.kubeStorageClass,
|
||||
cacheKey: cloud_runner_options_1.default.cacheKey,
|
||||
retainWorkspaces: cloud_runner_options_1.default.retainWorkspaces,
|
||||
useSharedLargePackages: cloud_runner_options_1.default.useSharedLargePackages,
|
||||
useLargePackages: cloud_runner_options_1.default.useLargePackages,
|
||||
compressionStrategy: cloud_runner_options_1.default.compressionStrategy,
|
||||
garbageCollectionMaxAge: cloud_runner_options_1.default.garbageCollectionMaxAge,
|
||||
garbageMaxAge: cloud_runner_options_1.default.garbageMaxAge,
|
||||
githubChecks: cloud_runner_options_1.default.githubChecks,
|
||||
asyncWorkflow: cloud_runner_options_1.default.asyncCloudRunner,
|
||||
githubCheckId: cloud_runner_options_1.default.githubCheckId,
|
||||
triggerWorkflowOnComplete: cloud_runner_options_1.default.finalHooks,
|
||||
finalHooks: cloud_runner_options_1.default.finalHooks,
|
||||
skipLFS: cloud_runner_options_1.default.skipLFS,
|
||||
skipCache: cloud_runner_options_1.default.skipCache,
|
||||
cacheUnityInstallationOnMac: input_1.default.cacheUnityInstallationOnMac,
|
||||
|
@ -781,12 +781,12 @@ class CloudRunnerOptions {
|
|||
// ### ### ###
|
||||
// Cloud Runner parameters
|
||||
// ### ### ###
|
||||
static get cloudRunnerBuilderPlatform() {
|
||||
const input = CloudRunnerOptions.getInput('cloudRunnerBuilderPlatform');
|
||||
static get buildPlatform() {
|
||||
const input = CloudRunnerOptions.getInput('buildPlatform');
|
||||
if (input) {
|
||||
return input;
|
||||
}
|
||||
if (CloudRunnerOptions.cloudRunnerCluster !== 'local') {
|
||||
if (CloudRunnerOptions.providerStrategy !== 'local') {
|
||||
return 'linux';
|
||||
}
|
||||
return;
|
||||
|
@ -794,11 +794,12 @@ class CloudRunnerOptions {
|
|||
static get cloudRunnerBranch() {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerBranch') || 'main';
|
||||
}
|
||||
static get cloudRunnerCluster() {
|
||||
static get providerStrategy() {
|
||||
const provider = CloudRunnerOptions.getInput('cloudRunnerCluster') || CloudRunnerOptions.getInput('providerStrategy');
|
||||
if (cli_1.Cli.isCliMode) {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerCluster') || 'aws';
|
||||
return provider || 'aws';
|
||||
}
|
||||
return CloudRunnerOptions.getInput('cloudRunnerCluster') || 'local';
|
||||
return provider || 'local';
|
||||
}
|
||||
static get containerCpu() {
|
||||
return CloudRunnerOptions.getInput('containerCpu');
|
||||
|
@ -821,8 +822,8 @@ class CloudRunnerOptions {
|
|||
// ### ### ###
|
||||
// Custom commands from yaml parameters
|
||||
// ### ### ###
|
||||
static customCommandHooks() {
|
||||
return CloudRunnerOptions.getInput('customCommandHooks') || '';
|
||||
static commandHooks() {
|
||||
return CloudRunnerOptions.getInput('commandHooks') || '';
|
||||
}
|
||||
static get postBuildSteps() {
|
||||
return CloudRunnerOptions.getInput('postBuildSteps') || '';
|
||||
|
@ -892,8 +893,8 @@ class CloudRunnerOptions {
|
|||
static get asyncCloudRunner() {
|
||||
return (CloudRunnerOptions.getInput('asyncCloudRunner') || `false`) === `true` || false;
|
||||
}
|
||||
static get useSharedLargePackages() {
|
||||
return (CloudRunnerOptions.getInput(`useSharedLargePackages`) || 'false') === 'true';
|
||||
static get useLargePackages() {
|
||||
return (CloudRunnerOptions.getInput(`useLargePackages`) || 'false') === 'true';
|
||||
}
|
||||
static get useSharedBuilder() {
|
||||
return (CloudRunnerOptions.getInput(`useSharedBuilder`) || 'false') === 'true';
|
||||
|
@ -913,8 +914,8 @@ class CloudRunnerOptions {
|
|||
// ### ### ###
|
||||
// Garbage Collection
|
||||
// ### ### ###
|
||||
static get garbageCollectionMaxAge() {
|
||||
return Number(CloudRunnerOptions.getInput(`garbageCollectionMaxAge`)) || 24;
|
||||
static get garbageMaxAge() {
|
||||
return Number(CloudRunnerOptions.getInput(`garbageMaxAge`)) || 24;
|
||||
}
|
||||
}
|
||||
exports["default"] = CloudRunnerOptions;
|
||||
|
@ -1030,8 +1031,8 @@ class CloudRunner {
|
|||
}
|
||||
}
|
||||
static setupSelectedBuildPlatform() {
|
||||
cloud_runner_logger_1.default.log(`Cloud Runner platform selected ${CloudRunner.buildParameters.cloudRunnerCluster}`);
|
||||
switch (CloudRunner.buildParameters.cloudRunnerCluster) {
|
||||
cloud_runner_logger_1.default.log(`Cloud Runner platform selected ${CloudRunner.buildParameters.providerStrategy}`);
|
||||
switch (CloudRunner.buildParameters.providerStrategy) {
|
||||
case 'k8s':
|
||||
CloudRunner.Provider = new k8s_1.default(CloudRunner.buildParameters);
|
||||
break;
|
||||
|
@ -1095,9 +1096,9 @@ class CloudRunner {
|
|||
}
|
||||
CloudRunner.lockedWorkspace = undefined;
|
||||
}
|
||||
await github_1.default.triggerWorkflowOnComplete(CloudRunner.buildParameters.triggerWorkflowOnComplete);
|
||||
await github_1.default.triggerWorkflowOnComplete(CloudRunner.buildParameters.finalHooks);
|
||||
if (buildParameters.constantGarbageCollection) {
|
||||
CloudRunner.Provider.garbageCollect(``, true, buildParameters.garbageCollectionMaxAge, true, true);
|
||||
CloudRunner.Provider.garbageCollect(``, true, buildParameters.garbageMaxAge, true, true);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
@ -1412,8 +1413,8 @@ class AWSJobStack {
|
|||
async setupCloudFormations(CF, buildGuid, image, entrypoint, commands, mountdir, workingdir, secrets) {
|
||||
const taskDefStackName = `${this.baseStackName}-${buildGuid}`;
|
||||
let taskDefCloudFormation = aws_cloud_formation_templates_1.AWSCloudFormationTemplates.readTaskCloudFormationTemplate();
|
||||
const cpu = cloud_runner_1.default.buildParameters.cloudRunnerCpu || '1024';
|
||||
const memory = cloud_runner_1.default.buildParameters.cloudRunnerMemory || '3072';
|
||||
const cpu = cloud_runner_1.default.buildParameters.containerCpu || '1024';
|
||||
const memory = cloud_runner_1.default.buildParameters.containerMemory || '3072';
|
||||
taskDefCloudFormation = taskDefCloudFormation.replace(`ContainerCpu:
|
||||
Default: 1024`, `ContainerCpu:
|
||||
Default: ${Number.parseInt(cpu)}`);
|
||||
|
@ -1475,7 +1476,7 @@ class AWSJobStack {
|
|||
},
|
||||
...secretsMappedToCloudFormationParameters,
|
||||
];
|
||||
cloud_runner_logger_1.default.log(`Starting AWS job with memory: ${cloud_runner_1.default.buildParameters.cloudRunnerMemory} cpu: ${cloud_runner_1.default.buildParameters.cloudRunnerCpu}`);
|
||||
cloud_runner_logger_1.default.log(`Starting AWS job with memory: ${cloud_runner_1.default.buildParameters.containerMemory} cpu: ${cloud_runner_1.default.buildParameters.containerCpu}`);
|
||||
let previousStackExists = true;
|
||||
while (previousStackExists) {
|
||||
previousStackExists = false;
|
||||
|
@ -3409,8 +3410,8 @@ class KubernetesJobSpecFactory {
|
|||
workingDir: `${workingDirectory}`,
|
||||
resources: {
|
||||
requests: {
|
||||
memory: buildParameters.cloudRunnerMemory || '750M',
|
||||
cpu: buildParameters.cloudRunnerCpu || '1',
|
||||
memory: buildParameters.containerMemory || '750M',
|
||||
cpu: buildParameters.containerCpu || '1',
|
||||
},
|
||||
},
|
||||
env: [
|
||||
|
@ -4282,9 +4283,9 @@ class RemoteClient {
|
|||
remote_client_logger_1.RemoteClientLogger.log(`Checked out ${cloud_runner_1.default.buildParameters.branch}`);
|
||||
}
|
||||
static async replaceLargePackageReferencesWithSharedReferences() {
|
||||
cloud_runner_logger_1.default.log(`Use Shared Pkgs ${cloud_runner_1.default.buildParameters.useSharedLargePackages}`);
|
||||
github_1.default.updateGitHubCheck(`Use Shared Pkgs ${cloud_runner_1.default.buildParameters.useSharedLargePackages}`, ``);
|
||||
if (cloud_runner_1.default.buildParameters.useSharedLargePackages) {
|
||||
cloud_runner_logger_1.default.log(`Use Shared Pkgs ${cloud_runner_1.default.buildParameters.useLargePackages}`);
|
||||
github_1.default.updateGitHubCheck(`Use Shared Pkgs ${cloud_runner_1.default.buildParameters.useLargePackages}`, ``);
|
||||
if (cloud_runner_1.default.buildParameters.useLargePackages) {
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`tree -L 2 ${cloud_runner_folders_1.CloudRunnerFolders.projectPathAbsolute}`);
|
||||
const filePath = node_path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.projectPathAbsolute, `Packages/manifest.json`);
|
||||
let manifest = node_fs_1.default.readFileSync(filePath, 'utf8');
|
||||
|
@ -4413,7 +4414,7 @@ const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
|||
// import CloudRunnerLogger from './cloud-runner-logger';
|
||||
class CloudRunnerCustomHooks {
|
||||
static ApplyHooksToCommands(commands, buildParameters) {
|
||||
const hooks = CloudRunnerCustomHooks.getHooks(buildParameters.customCommandHooks);
|
||||
const hooks = CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks);
|
||||
cloud_runner_logger_1.default.log(`Applying hooks ${hooks.length}`);
|
||||
return `echo "---"
|
||||
echo "start cloud runner init"
|
||||
|
@ -5506,7 +5507,7 @@ class TaskParameterSerializer {
|
|||
],
|
||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||
...TaskParameterSerializer.readInput(),
|
||||
...cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getSecrets(cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(buildParameters.customCommandHooks)),
|
||||
...cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getSecrets(cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks)),
|
||||
]
|
||||
.filter((x) => !TaskParameterSerializer.blocked.has(x.name) &&
|
||||
x.value !== '' &&
|
||||
|
@ -5756,8 +5757,8 @@ class BuildAutomationWorkflow {
|
|||
return output;
|
||||
}
|
||||
static get BuildWorkflow() {
|
||||
const setupHooks = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(cloud_runner_1.default.buildParameters.customCommandHooks).filter((x) => x.step?.includes(`setup`));
|
||||
const buildHooks = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(cloud_runner_1.default.buildParameters.customCommandHooks).filter((x) => x.step?.includes(`build`));
|
||||
const setupHooks = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(cloud_runner_1.default.buildParameters.commandHooks).filter((x) => x.step?.includes(`setup`));
|
||||
const buildHooks = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(cloud_runner_1.default.buildParameters.commandHooks).filter((x) => x.step?.includes(`build`));
|
||||
const builderPath = cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(node_path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute, 'dist', `index.js`));
|
||||
return `apt-get update > /dev/null
|
||||
apt-get install -y curl tar tree npm git-lfs jq git > /dev/null
|
||||
|
@ -6589,7 +6590,7 @@ const cloud_runner_system_1 = __nccwpck_require__(99393);
|
|||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class GenericInputReader {
|
||||
static async Run(command) {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
return await cloud_runner_system_1.CloudRunnerSystem.Run(command, false, true);
|
||||
|
@ -6618,7 +6619,7 @@ const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
|||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||
class GitRepoReader {
|
||||
static async GetRemote() {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
node_console_1.assert(node_fs_1.default.existsSync(`.git`));
|
||||
|
@ -6628,7 +6629,7 @@ class GitRepoReader {
|
|||
return value.split('github.com')[1].split('.git')[0].slice(1);
|
||||
}
|
||||
static async GetBranch() {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
node_console_1.assert(node_fs_1.default.existsSync(`.git`));
|
||||
|
@ -6677,7 +6678,7 @@ const core = __importStar(__nccwpck_require__(42186));
|
|||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class GithubCliReader {
|
||||
static async GetGitHubAuthToken() {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
|
@ -6716,7 +6717,7 @@ const node_fs_1 = __importDefault(__nccwpck_require__(87561));
|
|||
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
function ReadLicense() {
|
||||
if (cloud_runner_options_1.default.cloudRunnerCluster === 'local') {
|
||||
if (cloud_runner_options_1.default.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
const pipelineFile = node_path_1.default.join(__dirname, `.github`, `workflows`, `cloud-runner-k8s-pipeline.yml`);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,7 @@ async function runMain() {
|
|||
const buildParameters = await BuildParameters.create();
|
||||
const baseImage = new ImageTag(buildParameters);
|
||||
|
||||
if (buildParameters.cloudRunnerCluster === 'local') {
|
||||
if (buildParameters.providerStrategy === 'local') {
|
||||
core.info('Building locally');
|
||||
await PlatformSetup.setup(buildParameters, actionFolder);
|
||||
if (process.platform === 'darwin') {
|
||||
|
|
|
@ -41,17 +41,17 @@ class BuildParameters {
|
|||
|
||||
public customParameters!: string;
|
||||
public sshAgent!: string;
|
||||
public cloudRunnerCluster!: string;
|
||||
public providerStrategy!: string;
|
||||
public gitPrivateToken!: string;
|
||||
public awsStackName!: string;
|
||||
public kubeConfig!: string;
|
||||
public cloudRunnerMemory!: string | undefined;
|
||||
public cloudRunnerCpu!: string | undefined;
|
||||
public containerMemory!: string | undefined;
|
||||
public containerCpu!: string | undefined;
|
||||
public kubeVolumeSize!: string;
|
||||
public kubeVolume!: string;
|
||||
public kubeStorageClass!: string;
|
||||
public chownFilesTo!: string;
|
||||
public customCommandHooks!: string;
|
||||
public commandHooks!: string;
|
||||
public pullInputList!: string[];
|
||||
public inputPullCommand!: string;
|
||||
public cacheKey!: string;
|
||||
|
@ -67,16 +67,16 @@ class BuildParameters {
|
|||
public buildGuid!: string;
|
||||
public cloudRunnerBranch!: string;
|
||||
public cloudRunnerDebug!: boolean | undefined;
|
||||
public cloudRunnerBuilderPlatform!: string | undefined;
|
||||
public buildPlatform!: string | undefined;
|
||||
public isCliMode!: boolean;
|
||||
public retainWorkspaces!: number;
|
||||
public useSharedLargePackages!: boolean;
|
||||
public useLargePackages!: boolean;
|
||||
public compressionStrategy!: boolean;
|
||||
public garbageCollectionMaxAge!: number;
|
||||
public garbageMaxAge!: number;
|
||||
public githubChecks!: boolean;
|
||||
public asyncWorkflow!: boolean;
|
||||
public githubCheckId!: string;
|
||||
public triggerWorkflowOnComplete!: string[];
|
||||
public finalHooks!: string[];
|
||||
public skipLFS!: boolean;
|
||||
public skipCache!: boolean;
|
||||
public cacheUnityInstallationOnMac!: boolean;
|
||||
|
@ -149,11 +149,11 @@ class BuildParameters {
|
|||
sshAgent: Input.sshAgent,
|
||||
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
||||
chownFilesTo: Input.chownFilesTo,
|
||||
cloudRunnerCluster: CloudRunnerOptions.cloudRunnerCluster,
|
||||
cloudRunnerBuilderPlatform: CloudRunnerOptions.cloudRunnerBuilderPlatform,
|
||||
providerStrategy: CloudRunnerOptions.providerStrategy,
|
||||
buildPlatform: CloudRunnerOptions.buildPlatform,
|
||||
kubeConfig: CloudRunnerOptions.kubeConfig,
|
||||
cloudRunnerMemory: CloudRunnerOptions.containerMemory,
|
||||
cloudRunnerCpu: CloudRunnerOptions.containerCpu,
|
||||
containerMemory: CloudRunnerOptions.containerMemory,
|
||||
containerCpu: CloudRunnerOptions.containerCpu,
|
||||
kubeVolumeSize: CloudRunnerOptions.kubeVolumeSize,
|
||||
kubeVolume: CloudRunnerOptions.kubeVolume,
|
||||
postBuildSteps: CloudRunnerOptions.postBuildSteps,
|
||||
|
@ -169,19 +169,19 @@ class BuildParameters {
|
|||
gitSha: Input.gitSha,
|
||||
logId: customAlphabet(CloudRunnerConstants.alphabet, 9)(),
|
||||
buildGuid: CloudRunnerBuildGuid.generateGuid(Input.runNumber, Input.targetPlatform),
|
||||
customCommandHooks: CloudRunnerOptions.customCommandHooks(),
|
||||
commandHooks: CloudRunnerOptions.commandHooks(),
|
||||
inputPullCommand: CloudRunnerOptions.inputPullCommand(),
|
||||
pullInputList: CloudRunnerOptions.pullInputList(),
|
||||
kubeStorageClass: CloudRunnerOptions.kubeStorageClass,
|
||||
cacheKey: CloudRunnerOptions.cacheKey,
|
||||
retainWorkspaces: CloudRunnerOptions.retainWorkspaces,
|
||||
useSharedLargePackages: CloudRunnerOptions.useSharedLargePackages,
|
||||
useLargePackages: CloudRunnerOptions.useLargePackages,
|
||||
compressionStrategy: CloudRunnerOptions.compressionStrategy,
|
||||
garbageCollectionMaxAge: CloudRunnerOptions.garbageCollectionMaxAge,
|
||||
garbageMaxAge: CloudRunnerOptions.garbageMaxAge,
|
||||
githubChecks: CloudRunnerOptions.githubChecks,
|
||||
asyncWorkflow: CloudRunnerOptions.asyncCloudRunner,
|
||||
githubCheckId: CloudRunnerOptions.githubCheckId,
|
||||
triggerWorkflowOnComplete: CloudRunnerOptions.finalHooks,
|
||||
finalHooks: CloudRunnerOptions.finalHooks,
|
||||
skipLFS: CloudRunnerOptions.skipLFS,
|
||||
skipCache: CloudRunnerOptions.skipCache,
|
||||
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
||||
|
|
|
@ -111,12 +111,12 @@ class CloudRunnerOptions {
|
|||
// Cloud Runner parameters
|
||||
// ### ### ###
|
||||
|
||||
static get cloudRunnerBuilderPlatform() {
|
||||
const input = CloudRunnerOptions.getInput('cloudRunnerBuilderPlatform');
|
||||
static get buildPlatform() {
|
||||
const input = CloudRunnerOptions.getInput('buildPlatform');
|
||||
if (input) {
|
||||
return input;
|
||||
}
|
||||
if (CloudRunnerOptions.cloudRunnerCluster !== 'local') {
|
||||
if (CloudRunnerOptions.providerStrategy !== 'local') {
|
||||
return 'linux';
|
||||
}
|
||||
|
||||
|
@ -127,12 +127,14 @@ class CloudRunnerOptions {
|
|||
return CloudRunnerOptions.getInput('cloudRunnerBranch') || 'main';
|
||||
}
|
||||
|
||||
static get cloudRunnerCluster() {
|
||||
static get providerStrategy() {
|
||||
const provider =
|
||||
CloudRunnerOptions.getInput('cloudRunnerCluster') || CloudRunnerOptions.getInput('providerStrategy');
|
||||
if (Cli.isCliMode) {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerCluster') || 'aws';
|
||||
return provider || 'aws';
|
||||
}
|
||||
|
||||
return CloudRunnerOptions.getInput('cloudRunnerCluster') || 'local';
|
||||
return provider || 'local';
|
||||
}
|
||||
|
||||
static get containerCpu() {
|
||||
|
@ -163,8 +165,8 @@ class CloudRunnerOptions {
|
|||
// Custom commands from yaml parameters
|
||||
// ### ### ###
|
||||
|
||||
static customCommandHooks() {
|
||||
return CloudRunnerOptions.getInput('customCommandHooks') || '';
|
||||
static commandHooks() {
|
||||
return CloudRunnerOptions.getInput('commandHooks') || '';
|
||||
}
|
||||
|
||||
static get postBuildSteps() {
|
||||
|
@ -255,8 +257,8 @@ class CloudRunnerOptions {
|
|||
return (CloudRunnerOptions.getInput('asyncCloudRunner') || `false`) === `true` || false;
|
||||
}
|
||||
|
||||
public static get useSharedLargePackages(): boolean {
|
||||
return (CloudRunnerOptions.getInput(`useSharedLargePackages`) || 'false') === 'true';
|
||||
public static get useLargePackages(): boolean {
|
||||
return (CloudRunnerOptions.getInput(`useLargePackages`) || 'false') === 'true';
|
||||
}
|
||||
|
||||
public static get useSharedBuilder(): boolean {
|
||||
|
@ -283,8 +285,8 @@ class CloudRunnerOptions {
|
|||
// Garbage Collection
|
||||
// ### ### ###
|
||||
|
||||
static get garbageCollectionMaxAge(): number {
|
||||
return Number(CloudRunnerOptions.getInput(`garbageCollectionMaxAge`)) || 24;
|
||||
static get garbageMaxAge(): number {
|
||||
return Number(CloudRunnerOptions.getInput(`garbageMaxAge`)) || 24;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ class CloudRunner {
|
|||
}
|
||||
|
||||
private static setupSelectedBuildPlatform() {
|
||||
CloudRunnerLogger.log(`Cloud Runner platform selected ${CloudRunner.buildParameters.cloudRunnerCluster}`);
|
||||
switch (CloudRunner.buildParameters.cloudRunnerCluster) {
|
||||
CloudRunnerLogger.log(`Cloud Runner platform selected ${CloudRunner.buildParameters.providerStrategy}`);
|
||||
switch (CloudRunner.buildParameters.providerStrategy) {
|
||||
case 'k8s':
|
||||
CloudRunner.Provider = new Kubernetes(CloudRunner.buildParameters);
|
||||
break;
|
||||
|
@ -150,10 +150,10 @@ class CloudRunner {
|
|||
CloudRunner.lockedWorkspace = undefined;
|
||||
}
|
||||
|
||||
await GitHub.triggerWorkflowOnComplete(CloudRunner.buildParameters.triggerWorkflowOnComplete);
|
||||
await GitHub.triggerWorkflowOnComplete(CloudRunner.buildParameters.finalHooks);
|
||||
|
||||
if (buildParameters.constantGarbageCollection) {
|
||||
CloudRunner.Provider.garbageCollect(``, true, buildParameters.garbageCollectionMaxAge, true, true);
|
||||
CloudRunner.Provider.garbageCollect(``, true, buildParameters.garbageMaxAge, true, true);
|
||||
}
|
||||
|
||||
return output;
|
||||
|
|
|
@ -27,8 +27,8 @@ export class AWSJobStack {
|
|||
): Promise<CloudRunnerAWSTaskDef> {
|
||||
const taskDefStackName = `${this.baseStackName}-${buildGuid}`;
|
||||
let taskDefCloudFormation = AWSCloudFormationTemplates.readTaskCloudFormationTemplate();
|
||||
const cpu = CloudRunner.buildParameters.cloudRunnerCpu || '1024';
|
||||
const memory = CloudRunner.buildParameters.cloudRunnerMemory || '3072';
|
||||
const cpu = CloudRunner.buildParameters.containerCpu || '1024';
|
||||
const memory = CloudRunner.buildParameters.containerMemory || '3072';
|
||||
taskDefCloudFormation = taskDefCloudFormation.replace(
|
||||
`ContainerCpu:
|
||||
Default: 1024`,
|
||||
|
@ -116,7 +116,7 @@ export class AWSJobStack {
|
|||
...secretsMappedToCloudFormationParameters,
|
||||
];
|
||||
CloudRunnerLogger.log(
|
||||
`Starting AWS job with memory: ${CloudRunner.buildParameters.cloudRunnerMemory} cpu: ${CloudRunner.buildParameters.cloudRunnerCpu}`,
|
||||
`Starting AWS job with memory: ${CloudRunner.buildParameters.containerMemory} cpu: ${CloudRunner.buildParameters.containerCpu}`,
|
||||
);
|
||||
let previousStackExists = true;
|
||||
while (previousStackExists) {
|
||||
|
|
|
@ -110,8 +110,8 @@ class KubernetesJobSpecFactory {
|
|||
workingDir: `${workingDirectory}`,
|
||||
resources: {
|
||||
requests: {
|
||||
memory: buildParameters.cloudRunnerMemory || '750M',
|
||||
cpu: buildParameters.cloudRunnerCpu || '1',
|
||||
memory: buildParameters.containerMemory || '750M',
|
||||
cpu: buildParameters.containerCpu || '1',
|
||||
},
|
||||
},
|
||||
env: [
|
||||
|
|
|
@ -132,9 +132,9 @@ export class RemoteClient {
|
|||
}
|
||||
|
||||
static async replaceLargePackageReferencesWithSharedReferences() {
|
||||
CloudRunnerLogger.log(`Use Shared Pkgs ${CloudRunner.buildParameters.useSharedLargePackages}`);
|
||||
GitHub.updateGitHubCheck(`Use Shared Pkgs ${CloudRunner.buildParameters.useSharedLargePackages}`, ``);
|
||||
if (CloudRunner.buildParameters.useSharedLargePackages) {
|
||||
CloudRunnerLogger.log(`Use Shared Pkgs ${CloudRunner.buildParameters.useLargePackages}`);
|
||||
GitHub.updateGitHubCheck(`Use Shared Pkgs ${CloudRunner.buildParameters.useLargePackages}`, ``);
|
||||
if (CloudRunner.buildParameters.useLargePackages) {
|
||||
await CloudRunnerSystem.Run(`tree -L 2 ${CloudRunnerFolders.projectPathAbsolute}`);
|
||||
const filePath = path.join(CloudRunnerFolders.projectPathAbsolute, `Packages/manifest.json`);
|
||||
let manifest = fs.readFileSync(filePath, 'utf8');
|
||||
|
|
|
@ -11,7 +11,7 @@ import CloudRunnerLogger from './cloud-runner-logger';
|
|||
|
||||
export class CloudRunnerCustomHooks {
|
||||
public static ApplyHooksToCommands(commands: string, buildParameters: BuildParameters): string {
|
||||
const hooks = CloudRunnerCustomHooks.getHooks(buildParameters.customCommandHooks);
|
||||
const hooks = CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks);
|
||||
CloudRunnerLogger.log(`Applying hooks ${hooks.length}`);
|
||||
|
||||
return `echo "---"
|
||||
|
|
|
@ -22,7 +22,7 @@ export class TaskParameterSerializer {
|
|||
],
|
||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||
...TaskParameterSerializer.readInput(),
|
||||
...CloudRunnerCustomHooks.getSecrets(CloudRunnerCustomHooks.getHooks(buildParameters.customCommandHooks)),
|
||||
...CloudRunnerCustomHooks.getSecrets(CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks)),
|
||||
]
|
||||
.filter(
|
||||
(x) =>
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('Cloud Runner Async Workflows', () => {
|
|||
setups();
|
||||
it('Responds', () => {});
|
||||
|
||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.cloudRunnerCluster !== `local-docker`) {
|
||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.providerStrategy !== `local-docker`) {
|
||||
it('Async Workflows', async () => {
|
||||
// Setup parameters
|
||||
const buildParameter = await CreateParameters({
|
||||
|
|
|
@ -11,7 +11,7 @@ import GitHub from '../../github';
|
|||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
describe('Cloud Runner (Remote Client) Caching', () => {
|
||||
it('responds', () => {});
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === `local-docker`) {
|
||||
if (CloudRunnerOptions.providerStrategy === `local-docker`) {
|
||||
it('Simple caching works', async () => {
|
||||
Cli.options = {
|
||||
versioning: 'None',
|
||||
|
|
|
@ -47,7 +47,7 @@ commands: echo "test"`;
|
|||
const getCustomStepsFromFiles = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
|
||||
CloudRunnerLogger.log(JSON.stringify(getCustomStepsFromFiles, undefined, 4));
|
||||
});
|
||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.cloudRunnerCluster !== `k8s`) {
|
||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.providerStrategy !== `k8s`) {
|
||||
it('Should be 1 before and 1 after hook', async () => {
|
||||
const overrides = {
|
||||
versioning: 'None',
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('Cloud Runner Local Docker Workflows', () => {
|
|||
setups();
|
||||
it('Responds', () => {});
|
||||
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === `local-docker`) {
|
||||
if (CloudRunnerOptions.providerStrategy === `local-docker`) {
|
||||
it('inspect stateful folder of Workflows', async () => {
|
||||
const testValue = `the state in a job exits in the expected local-docker folder`;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ async function CreateParameters(overrides: OptionValues | undefined) {
|
|||
describe('Cloud Runner pre-built S3 steps', () => {
|
||||
it('Responds', () => {});
|
||||
setups();
|
||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.cloudRunnerCluster !== `local-docker`) {
|
||||
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.providerStrategy !== `local-docker`) {
|
||||
it('Run build and prebuilt s3 cache pull, cache push and upload build', async () => {
|
||||
const overrides = {
|
||||
versioning: 'None',
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('Cloud Runner Caching', () => {
|
|||
cacheKey: `test-case-${uuidv4()}`,
|
||||
customStepFiles: `debug-cache`,
|
||||
};
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === `k8s`) {
|
||||
if (CloudRunnerOptions.providerStrategy === `k8s`) {
|
||||
overrides.customStepFiles += `,aws-s3-pull-cache,aws-s3-upload-cache`;
|
||||
}
|
||||
const buildParameter = await CreateParameters(overrides);
|
||||
|
@ -48,7 +48,7 @@ describe('Cloud Runner Caching', () => {
|
|||
|
||||
CloudRunnerLogger.log(`run 1 succeeded`);
|
||||
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === `local-docker`) {
|
||||
if (CloudRunnerOptions.providerStrategy === `local-docker`) {
|
||||
await CloudRunnerSystem.Run(`tree ./cloud-runner-cache/cache`);
|
||||
await CloudRunnerSystem.Run(
|
||||
`cp ./cloud-runner-cache/cache/${buildParameter.cacheKey}/Library/lib-${buildParameter.buildGuid}.tar ./`,
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('Cloud Runner Retain Workspace', () => {
|
|||
expect(results).toContain(buildSucceededString);
|
||||
expect(results).not.toContain(cachePushFail);
|
||||
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === `local-docker`) {
|
||||
if (CloudRunnerOptions.providerStrategy === `local-docker`) {
|
||||
const cacheFolderExists = fs.existsSync(`cloud-runner-cache/cache/${overrides.cacheKey}`);
|
||||
expect(cacheFolderExists).toBeTruthy();
|
||||
await CloudRunnerSystem.Run(`tree -d ./cloud-runner-cache`);
|
||||
|
|
|
@ -49,10 +49,10 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
|||
}
|
||||
|
||||
private static get BuildWorkflow() {
|
||||
const setupHooks = CloudRunnerCustomHooks.getHooks(CloudRunner.buildParameters.customCommandHooks).filter((x) =>
|
||||
const setupHooks = CloudRunnerCustomHooks.getHooks(CloudRunner.buildParameters.commandHooks).filter((x) =>
|
||||
x.step?.includes(`setup`),
|
||||
);
|
||||
const buildHooks = CloudRunnerCustomHooks.getHooks(CloudRunner.buildParameters.customCommandHooks).filter((x) =>
|
||||
const buildHooks = CloudRunnerCustomHooks.getHooks(CloudRunner.buildParameters.commandHooks).filter((x) =>
|
||||
x.step?.includes(`build`),
|
||||
);
|
||||
const builderPath = CloudRunnerFolders.ToLinuxFolder(
|
||||
|
|
|
@ -3,7 +3,7 @@ import CloudRunnerOptions from '../cloud-runner/cloud-runner-options';
|
|||
|
||||
export class GenericInputReader {
|
||||
public static async Run(command: string) {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ describe(`git repo tests`, () => {
|
|||
it(`returns valid branch name when using https`, async () => {
|
||||
const mockValue = 'https://github.com/example/example.git';
|
||||
await jest.spyOn(CloudRunnerSystem, 'Run').mockReturnValue(Promise.resolve(mockValue));
|
||||
await jest.spyOn(CloudRunnerOptions, 'cloudRunnerCluster', 'get').mockReturnValue('not-local');
|
||||
await jest.spyOn(CloudRunnerOptions, 'providerStrategy', 'get').mockReturnValue('not-local');
|
||||
expect(await GitRepoReader.GetRemote()).toEqual(`example/example`);
|
||||
});
|
||||
|
||||
it(`returns valid branch name when using ssh`, async () => {
|
||||
const mockValue = 'git@github.com:example/example.git';
|
||||
await jest.spyOn(CloudRunnerSystem, 'Run').mockReturnValue(Promise.resolve(mockValue));
|
||||
await jest.spyOn(CloudRunnerOptions, 'cloudRunnerCluster', 'get').mockReturnValue('not-local');
|
||||
await jest.spyOn(CloudRunnerOptions, 'providerStrategy', 'get').mockReturnValue('not-local');
|
||||
expect(await GitRepoReader.GetRemote()).toEqual(`example/example`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ import Input from '../input';
|
|||
|
||||
export class GitRepoReader {
|
||||
public static async GetRemote() {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
assert(fs.existsSync(`.git`));
|
||||
|
@ -22,7 +22,7 @@ export class GitRepoReader {
|
|||
}
|
||||
|
||||
public static async GetBranch() {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
assert(fs.existsSync(`.git`));
|
||||
|
|
|
@ -4,7 +4,7 @@ import CloudRunnerOptions from '../cloud-runner/cloud-runner-options';
|
|||
|
||||
export class GithubCliReader {
|
||||
static async GetGitHubAuthToken() {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -4,7 +4,7 @@ import YAML from 'yaml';
|
|||
import CloudRunnerOptions from '../cloud-runner/cloud-runner-options';
|
||||
|
||||
export function ReadLicense(): string {
|
||||
if (CloudRunnerOptions.cloudRunnerCluster === 'local') {
|
||||
if (CloudRunnerOptions.providerStrategy === 'local') {
|
||||
return '';
|
||||
}
|
||||
const pipelineFile = path.join(__dirname, `.github`, `workflows`, `cloud-runner-k8s-pipeline.yml`);
|
||||
|
|
Loading…
Reference in New Issue