Fix: check for retained workspace

pull/461/head
Frostebite 2022-10-05 20:52:32 +01:00
parent 954066b224
commit 7d404398cc
4 changed files with 15 additions and 11 deletions

12
dist/index.js vendored
View File

@ -3698,6 +3698,7 @@ const docker_1 = __importDefault(__nccwpck_require__(16934));
const model_1 = __nccwpck_require__(41359); const model_1 = __nccwpck_require__(41359);
const fs_1 = __nccwpck_require__(57147); const fs_1 = __nccwpck_require__(57147);
// import * as core from '@actions/core'; // import * as core from '@actions/core';
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
class LocalDockerCloudRunner { class LocalDockerCloudRunner {
inspect() { inspect() {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
@ -3755,6 +3756,7 @@ class LocalDockerCloudRunner {
} }
} }
let myOutput = ''; let myOutput = '';
const sharedFolder = !cloud_runner_options_1.default.retainWorkspaces ? `/data/cache/` : `/data/`;
// core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4)); // core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4));
const entrypointFilePath = `start.sh`; const entrypointFilePath = `start.sh`;
fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, `#!/bin/bash fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, `#!/bin/bash
@ -3763,12 +3765,12 @@ class LocalDockerCloudRunner {
apt-get update > /dev/null && apt-get install -y tree> /dev/null apt-get update > /dev/null && apt-get install -y tree> /dev/null
mkdir -p /github/workspace/cloud-runner-cache mkdir -p /github/workspace/cloud-runner-cache
mkdir -p /data/cache mkdir -p /data/cache
cp -a /github/workspace/cloud-runner-cache/. /data/ cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
tree -L 3 /data/ tree -L 3 ${sharedFolder}
${commands} ${commands}
cp -a /data/. /github/workspace/cloud-runner-cache/ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
tree -L 2 /github/workspace/cloud-runner-cache tree -L 2 /github/workspace/cloud-runner-cache
tree -L 3 /data/ tree -L 3 ${sharedFolder}
`, { `, {
flag: 'w', flag: 'w',
}); });
@ -5144,7 +5146,7 @@ class BuildAutomationWorkflow {
chmod +x ${builderPath}`; chmod +x ${builderPath}`;
return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
echo "game ci cloud runner clone" echo "game ci cloud runner clone"
if [ -d ${cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute)} ]; then echo "Retained Workspace Already Exists!"; else ${commands.replace(`\n`, ` && `)}; fi if [ -d ${cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(cloud_runner_folders_1.CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute)} ]; then echo "Retained Workspace Already Exists!"; else ${commands.replace(`\n`, ` && `)}; fi
echo "game ci cloud runner bootstrap" echo "game ci cloud runner bootstrap"
node ${builderPath} -m remote-cli`; node ${builderPath} -m remote-cli`;
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,7 @@ import { Action } from '../../../../model';
import { writeFileSync } from 'fs'; import { writeFileSync } from 'fs';
// import * as core from '@actions/core'; // import * as core from '@actions/core';
import CloudRunnerOptions from '../../cloud-runner-options';
class LocalDockerCloudRunner implements ProviderInterface { class LocalDockerCloudRunner implements ProviderInterface {
public buildParameters: BuildParameters | undefined; public buildParameters: BuildParameters | undefined;
@ -84,6 +85,7 @@ class LocalDockerCloudRunner implements ProviderInterface {
} }
} }
let myOutput = ''; let myOutput = '';
const sharedFolder = !CloudRunnerOptions.retainWorkspaces ? `/data/cache/` : `/data/`;
// core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4)); // core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4));
const entrypointFilePath = `start.sh`; const entrypointFilePath = `start.sh`;
@ -95,12 +97,12 @@ class LocalDockerCloudRunner implements ProviderInterface {
apt-get update > /dev/null && apt-get install -y tree> /dev/null apt-get update > /dev/null && apt-get install -y tree> /dev/null
mkdir -p /github/workspace/cloud-runner-cache mkdir -p /github/workspace/cloud-runner-cache
mkdir -p /data/cache mkdir -p /data/cache
cp -a /github/workspace/cloud-runner-cache/. /data/ cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
tree -L 3 /data/ tree -L 3 ${sharedFolder}
${commands} ${commands}
cp -a /data/. /github/workspace/cloud-runner-cache/ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
tree -L 2 /github/workspace/cloud-runner-cache tree -L 2 /github/workspace/cloud-runner-cache
tree -L 3 /data/ tree -L 3 ${sharedFolder}
`, `,
{ {
flag: 'w', flag: 'w',

View File

@ -131,7 +131,7 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
echo "game ci cloud runner clone" echo "game ci cloud runner clone"
if [ -d ${CloudRunnerFolders.ToLinuxFolder( if [ -d ${CloudRunnerFolders.ToLinuxFolder(
CloudRunnerFolders.builderPathAbsolute, CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute,
)} ]; then echo "Retained Workspace Already Exists!"; else ${commands.replace(`\n`, ` && `)}; fi )} ]; then echo "Retained Workspace Already Exists!"; else ${commands.replace(`\n`, ` && `)}; fi
echo "game ci cloud runner bootstrap" echo "game ci cloud runner bootstrap"
node ${builderPath} -m remote-cli`; node ${builderPath} -m remote-cli`;