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