shorter names
parent
7e91369f79
commit
a571858332
|
|
@ -208,7 +208,7 @@ const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||||
class BuildParameters {
|
class BuildParameters {
|
||||||
static useRetainedWorkspaceMode(buildParameters) {
|
static useRetainedWorkspaceMode(buildParameters) {
|
||||||
return buildParameters.retainWorkspaces > 0;
|
return buildParameters.maxRetainedWorkspaces > 0;
|
||||||
}
|
}
|
||||||
static async create() {
|
static async create() {
|
||||||
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType);
|
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType);
|
||||||
|
|
@ -295,9 +295,9 @@ class BuildParameters {
|
||||||
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,
|
maxRetainedWorkspaces: cloud_runner_options_1.default.maxRetainedWorkspaces,
|
||||||
useLargePackages: cloud_runner_options_1.default.useLargePackages,
|
useLargePackages: cloud_runner_options_1.default.useLargePackages,
|
||||||
compressionStrategy: cloud_runner_options_1.default.compressionStrategy,
|
useCompressionStrategy: cloud_runner_options_1.default.useCompressionStrategy,
|
||||||
garbageMaxAge: cloud_runner_options_1.default.garbageMaxAge,
|
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,
|
||||||
|
|
@ -770,14 +770,6 @@ class CloudRunnerOptions {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static get gitSha() {
|
|
||||||
if (CloudRunnerOptions.getInput(`GITHUB_SHA`)) {
|
|
||||||
return CloudRunnerOptions.getInput(`GITHUB_SHA`);
|
|
||||||
}
|
|
||||||
else if (CloudRunnerOptions.getInput(`GitSHA`)) {
|
|
||||||
return CloudRunnerOptions.getInput(`GitSHA`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
// Cloud Runner parameters
|
// Cloud Runner parameters
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
@ -880,27 +872,27 @@ class CloudRunnerOptions {
|
||||||
static get cloudRunnerDebug() {
|
static get cloudRunnerDebug() {
|
||||||
return (CloudRunnerOptions.getInput(`cloudRunnerTests`) === `true` ||
|
return (CloudRunnerOptions.getInput(`cloudRunnerTests`) === `true` ||
|
||||||
CloudRunnerOptions.getInput(`cloudRunnerDebug`) === `true` ||
|
CloudRunnerOptions.getInput(`cloudRunnerDebug`) === `true` ||
|
||||||
CloudRunnerOptions.getInput(`cloudRunnerDebug`) === `true` ||
|
CloudRunnerOptions.getInput(`cloudRunnerDebugTree`) === `true` ||
|
||||||
CloudRunnerOptions.getInput(`cloudRunnerDebugEnv`) === `true` ||
|
CloudRunnerOptions.getInput(`cloudRunnerDebugEnv`) === `true` ||
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
static get skipLfs() {
|
static get skipLfs() {
|
||||||
return CloudRunnerOptions.getInput(`skipLfs`) === `true` || false;
|
return CloudRunnerOptions.getInput(`skipLfs`) === `true`;
|
||||||
}
|
}
|
||||||
static get skipCache() {
|
static get skipCache() {
|
||||||
return CloudRunnerOptions.getInput(`skipCache`) === `true` || false;
|
return CloudRunnerOptions.getInput(`skipCache`) === `true`;
|
||||||
}
|
}
|
||||||
static get asyncCloudRunner() {
|
static get asyncCloudRunner() {
|
||||||
return (CloudRunnerOptions.getInput('asyncCloudRunner') || `false`) === `true` || false;
|
return CloudRunnerOptions.getInput('asyncCloudRunner') === 'true';
|
||||||
}
|
}
|
||||||
static get useLargePackages() {
|
static get useLargePackages() {
|
||||||
return (CloudRunnerOptions.getInput(`useLargePackages`) || 'false') === 'true';
|
return CloudRunnerOptions.getInput(`useLargePackages`) === `true`;
|
||||||
}
|
}
|
||||||
static get useSharedBuilder() {
|
static get useSharedBuilder() {
|
||||||
return (CloudRunnerOptions.getInput(`useSharedBuilder`) || 'false') === 'true';
|
return CloudRunnerOptions.getInput(`useSharedBuilder`) === `true`;
|
||||||
}
|
}
|
||||||
static get compressionStrategy() {
|
static get useCompressionStrategy() {
|
||||||
return (CloudRunnerOptions.getInput(`compressionStrategy`) || 'false') === 'true';
|
return CloudRunnerOptions.getInput(`useCompressionStrategy`) === `true`;
|
||||||
}
|
}
|
||||||
static get useCleanupCron() {
|
static get useCleanupCron() {
|
||||||
return (CloudRunnerOptions.getInput(`useCleanupCron`) || 'true') === 'true';
|
return (CloudRunnerOptions.getInput(`useCleanupCron`) || 'true') === 'true';
|
||||||
|
|
@ -908,8 +900,8 @@ class CloudRunnerOptions {
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
// Retained Workspace
|
// Retained Workspace
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
static get retainWorkspaces() {
|
static get maxRetainedWorkspaces() {
|
||||||
return CloudRunnerOptions.getInput(`retainWorkspaces`) || 0;
|
return CloudRunnerOptions.getInput(`maxRetainedWorkspaces`) || 0;
|
||||||
}
|
}
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
// Garbage Collection
|
// Garbage Collection
|
||||||
|
|
@ -1027,7 +1019,7 @@ class CloudRunner {
|
||||||
// CloudRunnerLogger.log(`Cloud Runner output ${Input.ToEnvVarFormat(element)} = ${buildParameters[element]}`);
|
// CloudRunnerLogger.log(`Cloud Runner output ${Input.ToEnvVarFormat(element)} = ${buildParameters[element]}`);
|
||||||
core.setOutput(__1.Input.ToEnvVarFormat(element), buildParameters[element]);
|
core.setOutput(__1.Input.ToEnvVarFormat(element), buildParameters[element]);
|
||||||
}
|
}
|
||||||
core.setOutput(__1.Input.ToEnvVarFormat(`buildArtifact`), `build-${CloudRunner.buildParameters.buildGuid}.tar${CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''}`);
|
core.setOutput(__1.Input.ToEnvVarFormat(`buildArtifact`), `build-${CloudRunner.buildParameters.buildGuid}.tar${CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static setupSelectedBuildPlatform() {
|
static setupSelectedBuildPlatform() {
|
||||||
|
|
@ -1069,8 +1061,8 @@ class CloudRunner {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cloud_runner_logger_1.default.log(`Max retained workspaces reached ${buildParameters.retainWorkspaces}`);
|
cloud_runner_logger_1.default.log(`Max retained workspaces reached ${buildParameters.maxRetainedWorkspaces}`);
|
||||||
buildParameters.retainWorkspaces = 0;
|
buildParameters.maxRetainedWorkspaces = 0;
|
||||||
CloudRunner.lockedWorkspace = undefined;
|
CloudRunner.lockedWorkspace = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2946,9 +2938,9 @@ class LocalDockerCloudRunner {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
defaultSecretsArray) {
|
defaultSecretsArray) {
|
||||||
const { workspace } = __1.Action;
|
const { workspace } = __1.Action;
|
||||||
if (fs.existsSync(`${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.compressionStrategy ? '.lz4' : ''}`)) {
|
if (fs.existsSync(`${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.useCompressionStrategy ? '.lz4' : ''}`)) {
|
||||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`ls ${workspace}/cloud-runner-cache/cache/build/`);
|
await cloud_runner_system_1.CloudRunnerSystem.Run(`ls ${workspace}/cloud-runner-cache/cache/build/`);
|
||||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`rm -r ${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.compressionStrategy ? '.lz4' : ''}`);
|
await cloud_runner_system_1.CloudRunnerSystem.Run(`rm -r ${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.useCompressionStrategy ? '.lz4' : ''}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupWorkflow(buildGuid, buildParameters,
|
setupWorkflow(buildGuid, buildParameters,
|
||||||
|
|
@ -4061,10 +4053,10 @@ class Caching {
|
||||||
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
||||||
const startPath = process.cwd();
|
const startPath = process.cwd();
|
||||||
let compressionSuffix = '';
|
let compressionSuffix = '';
|
||||||
if (cloud_runner_1.default.buildParameters.compressionStrategy === true) {
|
if (cloud_runner_1.default.buildParameters.useCompressionStrategy === true) {
|
||||||
compressionSuffix = `.lz4`;
|
compressionSuffix = `.lz4`;
|
||||||
}
|
}
|
||||||
cloud_runner_logger_1.default.log(`Compression: ${cloud_runner_1.default.buildParameters.compressionStrategy} ${compressionSuffix}`);
|
cloud_runner_logger_1.default.log(`Compression: ${cloud_runner_1.default.buildParameters.useCompressionStrategy} ${compressionSuffix}`);
|
||||||
try {
|
try {
|
||||||
if (!(await fileExists(cacheFolder))) {
|
if (!(await fileExists(cacheFolder))) {
|
||||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`mkdir -p ${cacheFolder}`);
|
await cloud_runner_system_1.CloudRunnerSystem.Run(`mkdir -p ${cacheFolder}`);
|
||||||
|
|
@ -4102,7 +4094,7 @@ class Caching {
|
||||||
}
|
}
|
||||||
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
||||||
let compressionSuffix = '';
|
let compressionSuffix = '';
|
||||||
if (cloud_runner_1.default.buildParameters.compressionStrategy === true) {
|
if (cloud_runner_1.default.buildParameters.useCompressionStrategy === true) {
|
||||||
compressionSuffix = `.lz4`;
|
compressionSuffix = `.lz4`;
|
||||||
}
|
}
|
||||||
const startPath = process.cwd();
|
const startPath = process.cwd();
|
||||||
|
|
@ -4413,7 +4405,7 @@ exports.Hook = exports.CloudRunnerCustomHooks = void 0;
|
||||||
const __1 = __nccwpck_require__(41359);
|
const __1 = __nccwpck_require__(41359);
|
||||||
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
const yaml_1 = __importDefault(__nccwpck_require__(44603));
|
||||||
const remote_client_logger_1 = __nccwpck_require__(59412);
|
const remote_client_logger_1 = __nccwpck_require__(59412);
|
||||||
const path_1 = __importDefault(__nccwpck_require__(71017));
|
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||||
const fs = __importStar(__nccwpck_require__(87561));
|
const fs = __importStar(__nccwpck_require__(87561));
|
||||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||||
|
|
@ -4453,13 +4445,13 @@ echo "---${buildParameters.logId}"`;
|
||||||
const results = [];
|
const results = [];
|
||||||
// RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
// RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
|
||||||
try {
|
try {
|
||||||
const gameCiCustomHooksPath = path_1.default.join(process.cwd(), `game-ci`, `hooks`);
|
const gameCiCustomHooksPath = node_path_1.default.join(process.cwd(), `game-ci`, `hooks`);
|
||||||
const files = fs.readdirSync(gameCiCustomHooksPath);
|
const files = fs.readdirSync(gameCiCustomHooksPath);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!cloud_runner_options_1.default.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
if (!cloud_runner_options_1.default.customHookFiles.includes(file.replace(`.yaml`, ``))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomHooksPath, file), `utf8`);
|
const fileContents = fs.readFileSync(node_path_1.default.join(gameCiCustomHooksPath, file), `utf8`);
|
||||||
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
|
||||||
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
if (fileContentsObject.hook.includes(hookLifecycle)) {
|
||||||
results.push(fileContentsObject);
|
results.push(fileContentsObject);
|
||||||
|
|
@ -4514,6 +4506,7 @@ echo "---${buildParameters.logId}"`;
|
||||||
exports.CloudRunnerCustomHooks = CloudRunnerCustomHooks;
|
exports.CloudRunnerCustomHooks = CloudRunnerCustomHooks;
|
||||||
class Hook {
|
class Hook {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.commands = new Array();
|
||||||
this.secrets = new Array();
|
this.secrets = new Array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4592,8 +4585,8 @@ class CloudRunnerCustomSteps {
|
||||||
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile default
|
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile default
|
||||||
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default
|
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default
|
||||||
aws configure set region $AWS_DEFAULT_REGION --profile default
|
aws configure set region $AWS_DEFAULT_REGION --profile default
|
||||||
aws s3 cp /data/cache/$CI_CACHE_KEY/build/build-${cloud_runner_1.default.buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.compressionStrategy ? '.lz4' : ''} s3://${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID.tar${cloud_runner_1.default.buildParameters.compressionStrategy ? '.lz4' : ''}
|
aws s3 cp /data/cache/$CI_CACHE_KEY/build/build-${cloud_runner_1.default.buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.useCompressionStrategy ? '.lz4' : ''} s3://${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID.tar${cloud_runner_1.default.buildParameters.useCompressionStrategy ? '.lz4' : ''}
|
||||||
rm /data/cache/$CI_CACHE_KEY/build/build-${cloud_runner_1.default.buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.compressionStrategy ? '.lz4' : ''}
|
rm /data/cache/$CI_CACHE_KEY/build/build-${cloud_runner_1.default.buildParameters.buildGuid}.tar${cloud_runner_1.default.buildParameters.useCompressionStrategy ? '.lz4' : ''}
|
||||||
secrets:
|
secrets:
|
||||||
- name: awsAccessKeyId
|
- name: awsAccessKeyId
|
||||||
value: ${process.env.AWS_ACCESS_KEY_ID || ``}
|
value: ${process.env.AWS_ACCESS_KEY_ID || ``}
|
||||||
|
|
@ -4609,7 +4602,7 @@ class CloudRunnerCustomSteps {
|
||||||
aws configure set region $CI_AWS_DEFAULT_REGION --profile default
|
aws configure set region $CI_AWS_DEFAULT_REGION --profile default
|
||||||
aws s3 ls ${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/ || true
|
aws s3 ls ${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/ || true
|
||||||
aws s3 ls ${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build || true
|
aws s3 ls ${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build || true
|
||||||
aws s3 cp s3://${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${cloud_runner_1.default.buildParameters.compressionStrategy ? '.lz4' : ''} /data/cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${cloud_runner_1.default.buildParameters.compressionStrategy ? '.lz4' : ''}
|
aws s3 cp s3://${cloud_runner_1.default.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${cloud_runner_1.default.buildParameters.useCompressionStrategy ? '.lz4' : ''} /data/cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${cloud_runner_1.default.buildParameters.useCompressionStrategy ? '.lz4' : ''}
|
||||||
secrets:
|
secrets:
|
||||||
- name: CI_AWS_ACCESS_KEY_ID
|
- name: CI_AWS_ACCESS_KEY_ID
|
||||||
- name: CI_AWS_SECRET_ACCESS_KEY
|
- name: CI_AWS_SECRET_ACCESS_KEY
|
||||||
|
|
@ -5228,7 +5221,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.LfsHashing = void 0;
|
exports.LfsHashing = void 0;
|
||||||
const path_1 = __importDefault(__nccwpck_require__(71017));
|
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||||
const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
||||||
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
const cloud_runner_system_1 = __nccwpck_require__(99393);
|
||||||
const node_fs_1 = __importDefault(__nccwpck_require__(87561));
|
const node_fs_1 = __importDefault(__nccwpck_require__(87561));
|
||||||
|
|
@ -5240,10 +5233,10 @@ class LfsHashing {
|
||||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`md5sum .lfs-assets-guid > .lfs-assets-guid-sum`);
|
await cloud_runner_system_1.CloudRunnerSystem.Run(`md5sum .lfs-assets-guid > .lfs-assets-guid-sum`);
|
||||||
const lfsHashes = {
|
const lfsHashes = {
|
||||||
lfsGuid: node_fs_1.default
|
lfsGuid: node_fs_1.default
|
||||||
.readFileSync(`${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.repoPathAbsolute, `.lfs-assets-guid`)}`, 'utf8')
|
.readFileSync(`${node_path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.repoPathAbsolute, `.lfs-assets-guid`)}`, 'utf8')
|
||||||
.replace(/\n/g, ``),
|
.replace(/\n/g, ``),
|
||||||
lfsGuidSum: node_fs_1.default
|
lfsGuidSum: node_fs_1.default
|
||||||
.readFileSync(`${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.repoPathAbsolute, `.lfs-assets-guid-sum`)}`, 'utf8')
|
.readFileSync(`${node_path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.repoPathAbsolute, `.lfs-assets-guid-sum`)}`, 'utf8')
|
||||||
.replace(' .lfs-assets-guid', '')
|
.replace(' .lfs-assets-guid', '')
|
||||||
.replace(/\n/g, ``),
|
.replace(/\n/g, ``),
|
||||||
};
|
};
|
||||||
|
|
@ -5392,7 +5385,8 @@ class SharedWorkspaceLocking {
|
||||||
static async IsWorkspaceBelowMax(workspace, buildParametersContext) {
|
static async IsWorkspaceBelowMax(workspace, buildParametersContext) {
|
||||||
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
||||||
if (workspace === ``) {
|
if (workspace === ``) {
|
||||||
return (workspaces.length < buildParametersContext.retainWorkspaces || buildParametersContext.retainWorkspaces === 0);
|
return (workspaces.length < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
|
buildParametersContext.maxRetainedWorkspaces === 0);
|
||||||
}
|
}
|
||||||
const ordered = [];
|
const ordered = [];
|
||||||
for (const ws of workspaces) {
|
for (const ws of workspaces) {
|
||||||
|
|
@ -5404,8 +5398,8 @@ class SharedWorkspaceLocking {
|
||||||
ordered.sort((x) => x.timestamp);
|
ordered.sort((x) => x.timestamp);
|
||||||
const matches = ordered.filter((x) => x.name.includes(workspace));
|
const matches = ordered.filter((x) => x.name.includes(workspace));
|
||||||
const isWorkspaceBelowMax = matches.length > 0 &&
|
const isWorkspaceBelowMax = matches.length > 0 &&
|
||||||
(ordered.indexOf(matches[0]) < buildParametersContext.retainWorkspaces ||
|
(ordered.indexOf(matches[0]) < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
buildParametersContext.retainWorkspaces === 0);
|
buildParametersContext.maxRetainedWorkspaces === 0);
|
||||||
return isWorkspaceBelowMax;
|
return isWorkspaceBelowMax;
|
||||||
}
|
}
|
||||||
static async GetWorkspaceTimestamp(workspace, buildParametersContext) {
|
static async GetWorkspaceTimestamp(workspace, buildParametersContext) {
|
||||||
|
|
@ -5442,7 +5436,7 @@ class SharedWorkspaceLocking {
|
||||||
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
||||||
cloud_runner_logger_1.default.log(`All workspaces ${workspaces}`);
|
cloud_runner_logger_1.default.log(`All workspaces ${workspaces}`);
|
||||||
if (!(await SharedWorkspaceLocking.IsWorkspaceBelowMax(workspace, buildParametersContext))) {
|
if (!(await SharedWorkspaceLocking.IsWorkspaceBelowMax(workspace, buildParametersContext))) {
|
||||||
cloud_runner_logger_1.default.log(`Workspace is above max ${workspaces} ${buildParametersContext.retainWorkspaces}`);
|
cloud_runner_logger_1.default.log(`Workspace is above max ${workspaces} ${buildParametersContext.maxRetainedWorkspaces}`);
|
||||||
await SharedWorkspaceLocking.CleanupWorkspace(workspace, buildParametersContext);
|
await SharedWorkspaceLocking.CleanupWorkspace(workspace, buildParametersContext);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -69,9 +69,9 @@ class BuildParameters {
|
||||||
public cloudRunnerDebug!: boolean | undefined;
|
public cloudRunnerDebug!: boolean | undefined;
|
||||||
public buildPlatform!: string | undefined;
|
public buildPlatform!: string | undefined;
|
||||||
public isCliMode!: boolean;
|
public isCliMode!: boolean;
|
||||||
public retainWorkspaces!: number;
|
public maxRetainedWorkspaces!: number;
|
||||||
public useLargePackages!: boolean;
|
public useLargePackages!: boolean;
|
||||||
public compressionStrategy!: boolean;
|
public useCompressionStrategy!: boolean;
|
||||||
public garbageMaxAge!: number;
|
public garbageMaxAge!: number;
|
||||||
public githubChecks!: boolean;
|
public githubChecks!: boolean;
|
||||||
public asyncWorkflow!: boolean;
|
public asyncWorkflow!: boolean;
|
||||||
|
|
@ -82,7 +82,7 @@ class BuildParameters {
|
||||||
public cacheUnityInstallationOnMac!: boolean;
|
public cacheUnityInstallationOnMac!: boolean;
|
||||||
public unityHubVersionOnMac!: string;
|
public unityHubVersionOnMac!: string;
|
||||||
public static useRetainedWorkspaceMode(buildParameters: BuildParameters) {
|
public static useRetainedWorkspaceMode(buildParameters: BuildParameters) {
|
||||||
return buildParameters.retainWorkspaces > 0;
|
return buildParameters.maxRetainedWorkspaces > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async create(): Promise<BuildParameters> {
|
static async create(): Promise<BuildParameters> {
|
||||||
|
|
@ -174,9 +174,9 @@ class BuildParameters {
|
||||||
pullInputList: CloudRunnerOptions.pullInputList,
|
pullInputList: CloudRunnerOptions.pullInputList,
|
||||||
kubeStorageClass: CloudRunnerOptions.kubeStorageClass,
|
kubeStorageClass: CloudRunnerOptions.kubeStorageClass,
|
||||||
cacheKey: CloudRunnerOptions.cacheKey,
|
cacheKey: CloudRunnerOptions.cacheKey,
|
||||||
retainWorkspaces: CloudRunnerOptions.retainWorkspaces,
|
maxRetainedWorkspaces: CloudRunnerOptions.maxRetainedWorkspaces,
|
||||||
useLargePackages: CloudRunnerOptions.useLargePackages,
|
useLargePackages: CloudRunnerOptions.useLargePackages,
|
||||||
compressionStrategy: CloudRunnerOptions.compressionStrategy,
|
useCompressionStrategy: CloudRunnerOptions.useCompressionStrategy,
|
||||||
garbageMaxAge: CloudRunnerOptions.garbageMaxAge,
|
garbageMaxAge: CloudRunnerOptions.garbageMaxAge,
|
||||||
githubChecks: CloudRunnerOptions.githubChecks,
|
githubChecks: CloudRunnerOptions.githubChecks,
|
||||||
asyncWorkflow: CloudRunnerOptions.asyncCloudRunner,
|
asyncWorkflow: CloudRunnerOptions.asyncCloudRunner,
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,10 @@ class CloudRunnerOptions {
|
||||||
// Git syncronization parameters
|
// Git syncronization parameters
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
||||||
static get githubRepo() {
|
static get githubRepo(): string | undefined {
|
||||||
return CloudRunnerOptions.getInput('GITHUB_REPOSITORY') || CloudRunnerOptions.getInput('GITHUB_REPO') || undefined;
|
return CloudRunnerOptions.getInput('GITHUB_REPOSITORY') || CloudRunnerOptions.getInput('GITHUB_REPO') || undefined;
|
||||||
}
|
}
|
||||||
static get branch() {
|
static get branch(): string {
|
||||||
if (CloudRunnerOptions.getInput(`GITHUB_REF`)) {
|
if (CloudRunnerOptions.getInput(`GITHUB_REF`)) {
|
||||||
return CloudRunnerOptions.getInput(`GITHUB_REF`).replace('refs/', '').replace(`head/`, '').replace(`heads/`, '');
|
return CloudRunnerOptions.getInput(`GITHUB_REF`).replace('refs/', '').replace(`head/`, '').replace(`heads/`, '');
|
||||||
} else if (CloudRunnerOptions.getInput('branch')) {
|
} else if (CloudRunnerOptions.getInput('branch')) {
|
||||||
|
|
@ -99,14 +99,6 @@ class CloudRunnerOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get gitSha() {
|
|
||||||
if (CloudRunnerOptions.getInput(`GITHUB_SHA`)) {
|
|
||||||
return CloudRunnerOptions.getInput(`GITHUB_SHA`);
|
|
||||||
} else if (CloudRunnerOptions.getInput(`GitSHA`)) {
|
|
||||||
return CloudRunnerOptions.getInput(`GitSHA`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
// Cloud Runner parameters
|
// Cloud Runner parameters
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
@ -241,32 +233,32 @@ class CloudRunnerOptions {
|
||||||
return (
|
return (
|
||||||
CloudRunnerOptions.getInput(`cloudRunnerTests`) === `true` ||
|
CloudRunnerOptions.getInput(`cloudRunnerTests`) === `true` ||
|
||||||
CloudRunnerOptions.getInput(`cloudRunnerDebug`) === `true` ||
|
CloudRunnerOptions.getInput(`cloudRunnerDebug`) === `true` ||
|
||||||
CloudRunnerOptions.getInput(`cloudRunnerDebug`) === `true` ||
|
CloudRunnerOptions.getInput(`cloudRunnerDebugTree`) === `true` ||
|
||||||
CloudRunnerOptions.getInput(`cloudRunnerDebugEnv`) === `true` ||
|
CloudRunnerOptions.getInput(`cloudRunnerDebugEnv`) === `true` ||
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
static get skipLfs(): boolean {
|
static get skipLfs(): boolean {
|
||||||
return CloudRunnerOptions.getInput(`skipLfs`) === `true` || false;
|
return CloudRunnerOptions.getInput(`skipLfs`) === `true`;
|
||||||
}
|
}
|
||||||
static get skipCache(): boolean {
|
static get skipCache(): boolean {
|
||||||
return CloudRunnerOptions.getInput(`skipCache`) === `true` || false;
|
return CloudRunnerOptions.getInput(`skipCache`) === `true`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get asyncCloudRunner(): boolean {
|
public static get asyncCloudRunner(): boolean {
|
||||||
return (CloudRunnerOptions.getInput('asyncCloudRunner') || `false`) === `true` || false;
|
return CloudRunnerOptions.getInput('asyncCloudRunner') === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get useLargePackages(): boolean {
|
public static get useLargePackages(): boolean {
|
||||||
return (CloudRunnerOptions.getInput(`useLargePackages`) || 'false') === 'true';
|
return CloudRunnerOptions.getInput(`useLargePackages`) === `true`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get useSharedBuilder(): boolean {
|
public static get useSharedBuilder(): boolean {
|
||||||
return (CloudRunnerOptions.getInput(`useSharedBuilder`) || 'false') === 'true';
|
return CloudRunnerOptions.getInput(`useSharedBuilder`) === `true`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get compressionStrategy(): boolean {
|
public static get useCompressionStrategy(): boolean {
|
||||||
return (CloudRunnerOptions.getInput(`compressionStrategy`) || 'false') === 'true';
|
return CloudRunnerOptions.getInput(`useCompressionStrategy`) === `true`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get useCleanupCron(): boolean {
|
public static get useCleanupCron(): boolean {
|
||||||
|
|
@ -277,8 +269,8 @@ class CloudRunnerOptions {
|
||||||
// Retained Workspace
|
// Retained Workspace
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
||||||
public static get retainWorkspaces(): number {
|
public static get maxRetainedWorkspaces(): number {
|
||||||
return CloudRunnerOptions.getInput(`retainWorkspaces`) || 0;
|
return CloudRunnerOptions.getInput(`maxRetainedWorkspaces`) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ### ### ###
|
// ### ### ###
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class CloudRunner {
|
||||||
core.setOutput(
|
core.setOutput(
|
||||||
Input.ToEnvVarFormat(`buildArtifact`),
|
Input.ToEnvVarFormat(`buildArtifact`),
|
||||||
`build-${CloudRunner.buildParameters.buildGuid}.tar${
|
`build-${CloudRunner.buildParameters.buildGuid}.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
}`,
|
}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -107,8 +107,8 @@ class CloudRunner {
|
||||||
{ name: `CI_LOCKED_WORKSPACE`, value: CloudRunner.lockedWorkspace },
|
{ name: `CI_LOCKED_WORKSPACE`, value: CloudRunner.lockedWorkspace },
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
CloudRunnerLogger.log(`Max retained workspaces reached ${buildParameters.retainWorkspaces}`);
|
CloudRunnerLogger.log(`Max retained workspaces reached ${buildParameters.maxRetainedWorkspaces}`);
|
||||||
buildParameters.retainWorkspaces = 0;
|
buildParameters.maxRetainedWorkspaces = 0;
|
||||||
CloudRunner.lockedWorkspace = undefined;
|
CloudRunner.lockedWorkspace = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { ProviderWorkflow } from '../provider-workflow';
|
||||||
import { CloudRunnerSystem } from '../../services/cloud-runner-system';
|
import { CloudRunnerSystem } from '../../services/cloud-runner-system';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import { CloudRunnerCustomHooks } from '../../services/cloud-runner-custom-hooks';
|
import { CloudRunnerCustomHooks } from '../../services/cloud-runner-custom-hooks';
|
||||||
|
import { StringKeyValuePair } from '../../../shared-types';
|
||||||
|
|
||||||
class LocalDockerCloudRunner implements ProviderInterface {
|
class LocalDockerCloudRunner implements ProviderInterface {
|
||||||
public buildParameters!: BuildParameters;
|
public buildParameters!: BuildParameters;
|
||||||
|
|
@ -51,14 +52,14 @@ class LocalDockerCloudRunner implements ProviderInterface {
|
||||||
if (
|
if (
|
||||||
fs.existsSync(
|
fs.existsSync(
|
||||||
`${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${
|
`${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
}`,
|
}`,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
await CloudRunnerSystem.Run(`ls ${workspace}/cloud-runner-cache/cache/build/`);
|
await CloudRunnerSystem.Run(`ls ${workspace}/cloud-runner-cache/cache/build/`);
|
||||||
await CloudRunnerSystem.Run(
|
await CloudRunnerSystem.Run(
|
||||||
`rm -r ${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${
|
`rm -r ${workspace}/cloud-runner-cache/cache/build/build-${buildParameters.buildGuid}.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
}`,
|
}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +88,7 @@ class LocalDockerCloudRunner implements ProviderInterface {
|
||||||
CloudRunnerLogger.log(commands);
|
CloudRunnerLogger.log(commands);
|
||||||
|
|
||||||
const { workspace, actionFolder } = Action;
|
const { workspace, actionFolder } = Action;
|
||||||
const content: any[] = [];
|
const content: StringKeyValuePair[] = [];
|
||||||
for (const x of secrets) {
|
for (const x of secrets) {
|
||||||
content.push({ name: x.EnvironmentVariable, value: x.ParameterValue });
|
content.push({ name: x.EnvironmentVariable, value: x.ParameterValue });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@ export class Caching {
|
||||||
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
||||||
const startPath = process.cwd();
|
const startPath = process.cwd();
|
||||||
let compressionSuffix = '';
|
let compressionSuffix = '';
|
||||||
if (CloudRunner.buildParameters.compressionStrategy === true) {
|
if (CloudRunner.buildParameters.useCompressionStrategy === true) {
|
||||||
compressionSuffix = `.lz4`;
|
compressionSuffix = `.lz4`;
|
||||||
}
|
}
|
||||||
CloudRunnerLogger.log(`Compression: ${CloudRunner.buildParameters.compressionStrategy} ${compressionSuffix}`);
|
CloudRunnerLogger.log(`Compression: ${CloudRunner.buildParameters.useCompressionStrategy} ${compressionSuffix}`);
|
||||||
try {
|
try {
|
||||||
if (!(await fileExists(cacheFolder))) {
|
if (!(await fileExists(cacheFolder))) {
|
||||||
await CloudRunnerSystem.Run(`mkdir -p ${cacheFolder}`);
|
await CloudRunnerSystem.Run(`mkdir -p ${cacheFolder}`);
|
||||||
|
|
@ -106,7 +106,7 @@ export class Caching {
|
||||||
}
|
}
|
||||||
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
||||||
let compressionSuffix = '';
|
let compressionSuffix = '';
|
||||||
if (CloudRunner.buildParameters.compressionStrategy === true) {
|
if (CloudRunner.buildParameters.useCompressionStrategy === true) {
|
||||||
compressionSuffix = `.lz4`;
|
compressionSuffix = `.lz4`;
|
||||||
}
|
}
|
||||||
const startPath = process.cwd();
|
const startPath = process.cwd();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { BuildParameters, Input } from '../..';
|
||||||
import YAML from 'yaml';
|
import YAML from 'yaml';
|
||||||
import CloudRunnerSecret from './cloud-runner-secret';
|
import CloudRunnerSecret from './cloud-runner-secret';
|
||||||
import { RemoteClientLogger } from '../remote-client/remote-client-logger';
|
import { RemoteClientLogger } from '../remote-client/remote-client-logger';
|
||||||
import path from 'path';
|
import path from 'node:path';
|
||||||
import CloudRunnerOptions from '../cloud-runner-options';
|
import CloudRunnerOptions from '../cloud-runner-options';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import CloudRunnerLogger from './cloud-runner-logger';
|
import CloudRunnerLogger from './cloud-runner-logger';
|
||||||
|
|
@ -25,7 +25,7 @@ echo "end of cloud runner job"
|
||||||
echo "---${buildParameters.logId}"`;
|
echo "---${buildParameters.logId}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getHooks(customCommandHooks: any): Hook[] {
|
public static getHooks(customCommandHooks: string): Hook[] {
|
||||||
const experimentHooks = customCommandHooks;
|
const experimentHooks = customCommandHooks;
|
||||||
let output = new Array<Hook>();
|
let output = new Array<Hook>();
|
||||||
if (experimentHooks && experimentHooks !== '') {
|
if (experimentHooks && experimentHooks !== '') {
|
||||||
|
|
@ -117,7 +117,7 @@ echo "---${buildParameters.logId}"`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class Hook {
|
export class Hook {
|
||||||
public commands: any;
|
public commands: string[] = new Array<string>();
|
||||||
public secrets: CloudRunnerSecret[] = new Array<CloudRunnerSecret>();
|
public secrets: CloudRunnerSecret[] = new Array<CloudRunnerSecret>();
|
||||||
public name!: string;
|
public name!: string;
|
||||||
public hook!: string[];
|
public hook!: string[];
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,12 @@ export class CloudRunnerCustomSteps {
|
||||||
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default
|
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default
|
||||||
aws configure set region $AWS_DEFAULT_REGION --profile default
|
aws configure set region $AWS_DEFAULT_REGION --profile default
|
||||||
aws s3 cp /data/cache/$CI_CACHE_KEY/build/build-${CloudRunner.buildParameters.buildGuid}.tar${
|
aws s3 cp /data/cache/$CI_CACHE_KEY/build/build-${CloudRunner.buildParameters.buildGuid}.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
} s3://${CloudRunner.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID.tar${
|
} s3://${CloudRunner.buildParameters.awsStackName}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
}
|
}
|
||||||
rm /data/cache/$CI_CACHE_KEY/build/build-${CloudRunner.buildParameters.buildGuid}.tar${
|
rm /data/cache/$CI_CACHE_KEY/build/build-${CloudRunner.buildParameters.buildGuid}.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
}
|
}
|
||||||
secrets:
|
secrets:
|
||||||
- name: awsAccessKeyId
|
- name: awsAccessKeyId
|
||||||
|
|
@ -71,9 +71,9 @@ export class CloudRunnerCustomSteps {
|
||||||
aws s3 cp s3://${
|
aws s3 cp s3://${
|
||||||
CloudRunner.buildParameters.awsStackName
|
CloudRunner.buildParameters.awsStackName
|
||||||
}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${
|
}/cloud-runner-cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
} /data/cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${
|
} /data/cache/$CI_CACHE_KEY/build/build-$BUILD_GUID_TARGET.tar${
|
||||||
CloudRunner.buildParameters.compressionStrategy ? '.lz4' : ''
|
CloudRunner.buildParameters.useCompressionStrategy ? '.lz4' : ''
|
||||||
}
|
}
|
||||||
secrets:
|
secrets:
|
||||||
- name: CI_AWS_ACCESS_KEY_ID
|
- name: CI_AWS_ACCESS_KEY_ID
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import path from 'path';
|
import path from 'node:path';
|
||||||
import { CloudRunnerFolders } from './cloud-runner-folders';
|
import { CloudRunnerFolders } from './cloud-runner-folders';
|
||||||
import { CloudRunnerSystem } from './cloud-runner-system';
|
import { CloudRunnerSystem } from './cloud-runner-system';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,8 @@ export class SharedWorkspaceLocking {
|
||||||
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
const workspaces = await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext);
|
||||||
if (workspace === ``) {
|
if (workspace === ``) {
|
||||||
return (
|
return (
|
||||||
workspaces.length < buildParametersContext.retainWorkspaces || buildParametersContext.retainWorkspaces === 0
|
workspaces.length < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
|
buildParametersContext.maxRetainedWorkspaces === 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const ordered: any[] = [];
|
const ordered: any[] = [];
|
||||||
|
|
@ -168,8 +169,8 @@ export class SharedWorkspaceLocking {
|
||||||
const matches = ordered.filter((x) => x.name.includes(workspace));
|
const matches = ordered.filter((x) => x.name.includes(workspace));
|
||||||
const isWorkspaceBelowMax =
|
const isWorkspaceBelowMax =
|
||||||
matches.length > 0 &&
|
matches.length > 0 &&
|
||||||
(ordered.indexOf(matches[0]) < buildParametersContext.retainWorkspaces ||
|
(ordered.indexOf(matches[0]) < buildParametersContext.maxRetainedWorkspaces ||
|
||||||
buildParametersContext.retainWorkspaces === 0);
|
buildParametersContext.maxRetainedWorkspaces === 0);
|
||||||
|
|
||||||
return isWorkspaceBelowMax;
|
return isWorkspaceBelowMax;
|
||||||
}
|
}
|
||||||
|
|
@ -230,7 +231,7 @@ export class SharedWorkspaceLocking {
|
||||||
|
|
||||||
CloudRunnerLogger.log(`All workspaces ${workspaces}`);
|
CloudRunnerLogger.log(`All workspaces ${workspaces}`);
|
||||||
if (!(await SharedWorkspaceLocking.IsWorkspaceBelowMax(workspace, buildParametersContext))) {
|
if (!(await SharedWorkspaceLocking.IsWorkspaceBelowMax(workspace, buildParametersContext))) {
|
||||||
CloudRunnerLogger.log(`Workspace is above max ${workspaces} ${buildParametersContext.retainWorkspaces}`);
|
CloudRunnerLogger.log(`Workspace is above max ${workspaces} ${buildParametersContext.maxRetainedWorkspaces}`);
|
||||||
await SharedWorkspaceLocking.CleanupWorkspace(workspace, buildParametersContext);
|
await SharedWorkspaceLocking.CleanupWorkspace(workspace, buildParametersContext);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { v4 as uuidv4 } from 'uuid';
|
||||||
import CloudRunnerOptions from '../../cloud-runner-options';
|
import CloudRunnerOptions from '../../cloud-runner-options';
|
||||||
import setups from './../cloud-runner-suite.test';
|
import setups from './../cloud-runner-suite.test';
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import path from 'path';
|
import path from 'node:path';
|
||||||
import { CloudRunnerFolders } from '../../services/cloud-runner-folders';
|
import { CloudRunnerFolders } from '../../services/cloud-runner-folders';
|
||||||
import SharedWorkspaceLocking from '../../services/shared-workspace-locking';
|
import SharedWorkspaceLocking from '../../services/shared-workspace-locking';
|
||||||
import { CreateParameters } from '../create-test-parameter';
|
import { CreateParameters } from '../create-test-parameter';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue