|
|
|
|
@ -46,8 +46,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
const core = __importStar(__webpack_require__(42186));
|
|
|
|
|
const model_1 = __webpack_require__(41359);
|
|
|
|
|
const commander_ts_1 = __webpack_require__(40451);
|
|
|
|
|
const remote_client_1 = __webpack_require__(48135);
|
|
|
|
|
const cli_1 = __webpack_require__(55651);
|
|
|
|
|
function runMain() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
try {
|
|
|
|
|
@ -77,44 +76,15 @@ function runMain() {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function runCli() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
options.versioning = 'None';
|
|
|
|
|
model_1.Input.cliOptions = options;
|
|
|
|
|
const buildParameter = yield model_1.BuildParameters.create();
|
|
|
|
|
const baseImage = new model_1.ImageTag(buildParameter);
|
|
|
|
|
yield model_1.CloudRunner.run(buildParameter, baseImage.toString());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
model_1.Input.githubEnabled = false;
|
|
|
|
|
const program = new commander_ts_1.Command();
|
|
|
|
|
program.version('0.0.1');
|
|
|
|
|
const properties = Object.getOwnPropertyNames(model_1.Input);
|
|
|
|
|
core.info(`\r\n`);
|
|
|
|
|
core.info(`INPUT:`);
|
|
|
|
|
for (const element of properties) {
|
|
|
|
|
program.option(`--${element} <${element}>`, 'default description');
|
|
|
|
|
if (model_1.Input[element] !== undefined && model_1.Input[element] !== '') {
|
|
|
|
|
core.info(`${element} ${model_1.Input[element]}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
core.info(`\r\n`);
|
|
|
|
|
program.option('-m, --mode <mode>', 'cli or default');
|
|
|
|
|
program.parse(process.argv);
|
|
|
|
|
const options = program.opts();
|
|
|
|
|
const options = cli_1.CLI.SetupCli();
|
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
|
console.log(`Entrypoint: ${options.mode}`);
|
|
|
|
|
switch (options.mode) {
|
|
|
|
|
case 'cli':
|
|
|
|
|
runCli();
|
|
|
|
|
break;
|
|
|
|
|
case 'remote-cli':
|
|
|
|
|
remote_client_1.RemoteClientCli.RunRemoteClient(options);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (cli_1.CLI.isCliMode(options)) {
|
|
|
|
|
cli_1.CLI.RunCli(options);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
model_1.Input.githubEnabled = true;
|
|
|
|
|
runMain();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -375,6 +345,317 @@ class Cache {
|
|
|
|
|
exports.default = Cache;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 55651:
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.CLI = void 0;
|
|
|
|
|
const commander_ts_1 = __webpack_require__(40451);
|
|
|
|
|
const __1 = __webpack_require__(41359);
|
|
|
|
|
const core = __importStar(__webpack_require__(42186));
|
|
|
|
|
const remote_client_1 = __webpack_require__(95575);
|
|
|
|
|
class CLI {
|
|
|
|
|
static RunCli(options) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (options.mode === 'remote-cli') {
|
|
|
|
|
yield remote_client_1.RemoteClient.Run(options);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
options.versioning = 'None';
|
|
|
|
|
__1.Input.cliOptions = options;
|
|
|
|
|
const buildParameter = yield __1.BuildParameters.create();
|
|
|
|
|
const baseImage = new __1.ImageTag(buildParameter);
|
|
|
|
|
yield __1.CloudRunner.run(buildParameter, baseImage.toString());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
static isCliMode(options) {
|
|
|
|
|
switch (options.mode) {
|
|
|
|
|
case 'cli':
|
|
|
|
|
case 'remote-cli':
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static SetupCli() {
|
|
|
|
|
__1.Input.githubEnabled = false;
|
|
|
|
|
const program = new commander_ts_1.Command();
|
|
|
|
|
program.version('0.0.1');
|
|
|
|
|
const properties = Object.getOwnPropertyNames(__1.Input);
|
|
|
|
|
core.info(`\r\n`);
|
|
|
|
|
core.info(`INPUT:`);
|
|
|
|
|
for (const element of properties) {
|
|
|
|
|
program.option(`--${element} <${element}>`, 'default description');
|
|
|
|
|
if (__1.Input[element] !== undefined && __1.Input[element] !== '') {
|
|
|
|
|
core.info(`${element} ${__1.Input[element]}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
core.info(`\r\n`);
|
|
|
|
|
program.option('-m, --mode <mode>', 'cli or default');
|
|
|
|
|
program.parse(process.argv);
|
|
|
|
|
return program.opts();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.CLI = CLI;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 95575:
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.RemoteClient = void 0;
|
|
|
|
|
const cloud_runner_state_1 = __webpack_require__(70912);
|
|
|
|
|
const setup_repo_1 = __webpack_require__(42959);
|
|
|
|
|
class RemoteClient {
|
|
|
|
|
static Run(options) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const buildParameter = JSON.parse(process.env.buildParameters || '{}');
|
|
|
|
|
cloud_runner_state_1.CloudRunnerState.setup(buildParameter);
|
|
|
|
|
switch (options.remoteClientState) {
|
|
|
|
|
default:
|
|
|
|
|
yield setup_repo_1.DownloadRepository.run();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.RemoteClient = RemoteClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 91269:
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.RemoteClientSystem = void 0;
|
|
|
|
|
const child_process_1 = __webpack_require__(63129);
|
|
|
|
|
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
|
|
|
|
class RemoteClientSystem {
|
|
|
|
|
static Run(command) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
return yield new Promise((promise) => {
|
|
|
|
|
child_process_1.exec(command, (error, stdout, stderr) => {
|
|
|
|
|
if (error) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`[ERROR] ${error.message}`);
|
|
|
|
|
throw new Error(error.toString());
|
|
|
|
|
}
|
|
|
|
|
if (stderr) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`[STD-ERROR] ${stderr}`);
|
|
|
|
|
throw new Error(stderr.toString());
|
|
|
|
|
}
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`${stdout}`);
|
|
|
|
|
promise(stdout);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.RemoteClientSystem = RemoteClientSystem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 42959:
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.DownloadRepository = void 0;
|
|
|
|
|
const fs_1 = __importDefault(__webpack_require__(35747));
|
|
|
|
|
const path_1 = __importDefault(__webpack_require__(85622));
|
|
|
|
|
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
|
|
|
|
const cloud_runner_state_1 = __webpack_require__(70912);
|
|
|
|
|
const remote_client_system_1 = __webpack_require__(91269);
|
|
|
|
|
class DownloadRepository {
|
|
|
|
|
static run() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.buildPathFull);
|
|
|
|
|
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
|
|
|
|
|
process.chdir(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
|
|
|
|
// stop annoying git detatched head info
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`git config --global advice.detachedHead false`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Cloning the repository being built:`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`git lfs install --skip-smudge`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`
|
|
|
|
|
git clone --progress --verbose ${cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl} ${cloud_runner_state_1.CloudRunnerState.repoPathFull}
|
|
|
|
|
`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`
|
|
|
|
|
git checkout ${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}
|
|
|
|
|
`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`
|
|
|
|
|
git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid
|
|
|
|
|
`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`
|
|
|
|
|
md5sum .lfs-assets-guid > .lfs-assets-guid-sum
|
|
|
|
|
`);
|
|
|
|
|
const LFS_ASSETS_HASH = fs_1.default.readFileSync(`${path_1.default.join(cloud_runner_state_1.CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`, 'utf8');
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`
|
|
|
|
|
echo ' '
|
|
|
|
|
echo 'Contents of .lfs-assets-guid file:'
|
|
|
|
|
cat .lfs-assets-guid
|
|
|
|
|
echo ' '
|
|
|
|
|
echo 'Contents of .lfs-assets-guid-sum file:'
|
|
|
|
|
cat .lfs-assets-guid-sum
|
|
|
|
|
echo ' '
|
|
|
|
|
echo 'Source repository initialized'
|
|
|
|
|
ls ${cloud_runner_state_1.CloudRunnerState.projectPathFull}
|
|
|
|
|
echo ' '
|
|
|
|
|
`);
|
|
|
|
|
const lfsCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lfs`);
|
|
|
|
|
const libraryCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lib`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`tree ${cloud_runner_state_1.CloudRunnerState.builderPathFull}`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Starting checks of cache for the Unity project Library and git LFS files`);
|
|
|
|
|
if (!fs_1.default.existsSync(lfsCacheFolder)) {
|
|
|
|
|
fs_1.default.mkdirSync(lfsCacheFolder);
|
|
|
|
|
}
|
|
|
|
|
if (!fs_1.default.existsSync(libraryCacheFolder)) {
|
|
|
|
|
fs_1.default.mkdirSync(libraryCacheFolder);
|
|
|
|
|
}
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Library Caching`);
|
|
|
|
|
//if the unity git project has included the library delete it and echo a warning
|
|
|
|
|
if (fs_1.default.existsSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull)) {
|
|
|
|
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull, { recursive: true });
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`!Warning!: The Unity library was included in the git repository (this isn't usually a good practice)`);
|
|
|
|
|
}
|
|
|
|
|
//Restore library cache
|
|
|
|
|
const latestLibraryCacheFile = yield remote_client_system_1.RemoteClientSystem.Run(`ls -t "${libraryCacheFolder}" | grep .zip$ | head -1`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`ls -lh "${libraryCacheFolder}"`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Checking if Library cache ${libraryCacheFolder}/${latestLibraryCacheFile} exists`);
|
|
|
|
|
if (fs_1.default.existsSync(latestLibraryCacheFile)) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Library cache exists`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`
|
|
|
|
|
unzip -q "${path_1.default.join(libraryCacheFolder, latestLibraryCacheFile)}" -d "$projectPathFull"
|
|
|
|
|
tree "${cloud_runner_state_1.CloudRunnerState.libraryFolderFull}"
|
|
|
|
|
`);
|
|
|
|
|
}
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(` `);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`LFS Caching`);
|
|
|
|
|
process.chdir(lfsCacheFolder);
|
|
|
|
|
let latestLFSCacheFile;
|
|
|
|
|
if (fs_1.default.existsSync(`${LFS_ASSETS_HASH}.zip`)) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Match found: using large file hash match ${LFS_ASSETS_HASH}.zip`);
|
|
|
|
|
latestLFSCacheFile = `${LFS_ASSETS_HASH}.zip`;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
latestLFSCacheFile = yield remote_client_system_1.RemoteClientSystem.Run(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`);
|
|
|
|
|
}
|
|
|
|
|
if (fs_1.default.existsSync(latestLFSCacheFile)) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`LFS cache exists`);
|
|
|
|
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.lfsDirectory, { recursive: true });
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`LFS cache exists from build $latestLFSCacheFile from $branch`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`unzip -q "${lfsCacheFolder}/${latestLFSCacheFile}" -d "${path_1.default.join(cloud_runner_state_1.CloudRunnerState.repoPathFull, `.git`)}"`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`ls -lh "${cloud_runner_state_1.CloudRunnerState.lfsDirectory}"`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`git LFS folder, (should not contain $latestLFSCacheFile)`);
|
|
|
|
|
}
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`
|
|
|
|
|
echo ' '
|
|
|
|
|
echo "LFS cache for $branch"
|
|
|
|
|
du -sch "${lfsCacheFolder}/"
|
|
|
|
|
echo '**'
|
|
|
|
|
echo "Library cache for $branch"
|
|
|
|
|
du -sch "${libraryCacheFolder}/"
|
|
|
|
|
echo '**'
|
|
|
|
|
echo "Branch: $branch"
|
|
|
|
|
du -sch "${cloud_runner_state_1.CloudRunnerState.cacheFolderFull}/"
|
|
|
|
|
echo '**'
|
|
|
|
|
echo 'Full cache'
|
|
|
|
|
du -sch "${cloud_runner_state_1.CloudRunnerState.cacheFolderFull}/"
|
|
|
|
|
echo ' '
|
|
|
|
|
`);
|
|
|
|
|
process.chdir(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`git lfs pull`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`pulled latest LFS files`);
|
|
|
|
|
process.chdir(`${cloud_runner_state_1.CloudRunnerState.lfsDirectory}/..`);
|
|
|
|
|
yield remote_client_system_1.RemoteClientSystem.Run(`zip -r "${LFS_ASSETS_HASH}.zip" "./lfs"`);
|
|
|
|
|
fs_1.default.copyFileSync(`${LFS_ASSETS_HASH}.zip`, lfsCacheFolder);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`copied ${LFS_ASSETS_HASH} to ${lfsCacheFolder}`);
|
|
|
|
|
if (process.env.purgeRemoteCaching !== undefined) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`purging ${cloud_runner_state_1.CloudRunnerState.purgeRemoteCaching}`);
|
|
|
|
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.cacheFolder, { recursive: true });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.DownloadRepository = DownloadRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 28730:
|
|
|
|
|
@ -1984,230 +2265,6 @@ class KubernetesUtilities {
|
|
|
|
|
exports.default = KubernetesUtilities;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 48135:
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.RemoteClientCli = void 0;
|
|
|
|
|
const cloud_runner_state_1 = __webpack_require__(70912);
|
|
|
|
|
const setup_repo_1 = __webpack_require__(35323);
|
|
|
|
|
class RemoteClientCli {
|
|
|
|
|
static RunRemoteClient(options) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const buildParameter = JSON.parse(process.env.buildParameters || '{}');
|
|
|
|
|
cloud_runner_state_1.CloudRunnerState.setup(buildParameter);
|
|
|
|
|
switch (options.remoteClientState) {
|
|
|
|
|
default:
|
|
|
|
|
yield setup_repo_1.DownloadRepository.run();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.RemoteClientCli = RemoteClientCli;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 35323:
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.DownloadRepository = void 0;
|
|
|
|
|
const cloud_runner_state_1 = __webpack_require__(70912);
|
|
|
|
|
const run_cli_1 = __webpack_require__(33639);
|
|
|
|
|
const fs_1 = __importDefault(__webpack_require__(35747));
|
|
|
|
|
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
|
|
|
|
const path_1 = __importDefault(__webpack_require__(85622));
|
|
|
|
|
class DownloadRepository {
|
|
|
|
|
static run() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.buildPathFull);
|
|
|
|
|
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
|
|
|
|
|
process.chdir(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
|
|
|
|
// stop annoying git detatched head info
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`git config --global advice.detachedHead false`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Cloning the repository being built:`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`git lfs install --skip-smudge`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`
|
|
|
|
|
git clone --progress --verbose ${cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl} ${cloud_runner_state_1.CloudRunnerState.repoPathFull}
|
|
|
|
|
`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`
|
|
|
|
|
git checkout ${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}
|
|
|
|
|
`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`
|
|
|
|
|
git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid
|
|
|
|
|
`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`
|
|
|
|
|
md5sum .lfs-assets-guid > .lfs-assets-guid-sum
|
|
|
|
|
`);
|
|
|
|
|
const LFS_ASSETS_HASH = fs_1.default.readFileSync(`${path_1.default.join(cloud_runner_state_1.CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`, 'utf8');
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`
|
|
|
|
|
echo ' '
|
|
|
|
|
echo 'Contents of .lfs-assets-guid file:'
|
|
|
|
|
cat .lfs-assets-guid
|
|
|
|
|
echo ' '
|
|
|
|
|
echo 'Contents of .lfs-assets-guid-sum file:'
|
|
|
|
|
cat .lfs-assets-guid-sum
|
|
|
|
|
echo ' '
|
|
|
|
|
echo 'Source repository initialized'
|
|
|
|
|
ls ${cloud_runner_state_1.CloudRunnerState.projectPathFull}
|
|
|
|
|
echo ' '
|
|
|
|
|
`);
|
|
|
|
|
const lfsCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lfs`);
|
|
|
|
|
const libraryCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lib`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`tree ${cloud_runner_state_1.CloudRunnerState.builderPathFull}`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Starting checks of cache for the Unity project Library and git LFS files`);
|
|
|
|
|
if (!fs_1.default.existsSync(lfsCacheFolder)) {
|
|
|
|
|
fs_1.default.mkdirSync(lfsCacheFolder);
|
|
|
|
|
}
|
|
|
|
|
if (!fs_1.default.existsSync(libraryCacheFolder)) {
|
|
|
|
|
fs_1.default.mkdirSync(libraryCacheFolder);
|
|
|
|
|
}
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Library Caching`);
|
|
|
|
|
//if the unity git project has included the library delete it and echo a warning
|
|
|
|
|
if (fs_1.default.existsSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull)) {
|
|
|
|
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.libraryFolderFull, { recursive: true });
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`!Warning!: The Unity library was included in the git repository (this isn't usually a good practice)`);
|
|
|
|
|
}
|
|
|
|
|
//Restore library cache
|
|
|
|
|
const latestLibraryCacheFile = yield run_cli_1.RunCli.RunCli(`ls -t "${libraryCacheFolder}" | grep .zip$ | head -1`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`ls -lh "${libraryCacheFolder}"`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Checking if Library cache ${libraryCacheFolder}/${latestLibraryCacheFile} exists`);
|
|
|
|
|
if (fs_1.default.existsSync(latestLibraryCacheFile)) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Library cache exists`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`
|
|
|
|
|
unzip -q "${path_1.default.join(libraryCacheFolder, latestLibraryCacheFile)}" -d "$projectPathFull"
|
|
|
|
|
tree "${cloud_runner_state_1.CloudRunnerState.libraryFolderFull}"
|
|
|
|
|
`);
|
|
|
|
|
}
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(` `);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`LFS Caching`);
|
|
|
|
|
process.chdir(lfsCacheFolder);
|
|
|
|
|
let latestLFSCacheFile;
|
|
|
|
|
if (fs_1.default.existsSync(`${LFS_ASSETS_HASH}.zip`)) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`Match found: using large file hash match ${LFS_ASSETS_HASH}.zip`);
|
|
|
|
|
latestLFSCacheFile = `${LFS_ASSETS_HASH}.zip`;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
latestLFSCacheFile = yield run_cli_1.RunCli.RunCli(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`);
|
|
|
|
|
}
|
|
|
|
|
if (fs_1.default.existsSync(latestLFSCacheFile)) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`LFS cache exists`);
|
|
|
|
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.lfsDirectory, { recursive: true });
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`LFS cache exists from build $latestLFSCacheFile from $branch`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`unzip -q "${lfsCacheFolder}/${latestLFSCacheFile}" -d "${path_1.default.join(cloud_runner_state_1.CloudRunnerState.repoPathFull, `.git`)}"`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`ls -lh "${cloud_runner_state_1.CloudRunnerState.lfsDirectory}"`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`git LFS folder, (should not contain $latestLFSCacheFile)`);
|
|
|
|
|
}
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`
|
|
|
|
|
echo ' '
|
|
|
|
|
echo "LFS cache for $branch"
|
|
|
|
|
du -sch "${lfsCacheFolder}/"
|
|
|
|
|
echo '**'
|
|
|
|
|
echo "Library cache for $branch"
|
|
|
|
|
du -sch "${libraryCacheFolder}/"
|
|
|
|
|
echo '**'
|
|
|
|
|
echo "Branch: $branch"
|
|
|
|
|
du -sch "${cloud_runner_state_1.CloudRunnerState.cacheFolderFull}/"
|
|
|
|
|
echo '**'
|
|
|
|
|
echo 'Full cache'
|
|
|
|
|
du -sch "${cloud_runner_state_1.CloudRunnerState.cacheFolderFull}/"
|
|
|
|
|
echo ' '
|
|
|
|
|
`);
|
|
|
|
|
process.chdir(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`git lfs pull`);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`pulled latest LFS files`);
|
|
|
|
|
process.chdir(`${cloud_runner_state_1.CloudRunnerState.lfsDirectory}/..`);
|
|
|
|
|
yield run_cli_1.RunCli.RunCli(`zip -r "${LFS_ASSETS_HASH}.zip" "./lfs"`);
|
|
|
|
|
fs_1.default.copyFileSync(`${LFS_ASSETS_HASH}.zip`, lfsCacheFolder);
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`copied ${LFS_ASSETS_HASH} to ${lfsCacheFolder}`);
|
|
|
|
|
if (process.env.purgeRemoteCaching !== undefined) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`purging ${cloud_runner_state_1.CloudRunnerState.purgeRemoteCaching}`);
|
|
|
|
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.cacheFolder, { recursive: true });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.DownloadRepository = DownloadRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 33639:
|
|
|
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.RunCli = void 0;
|
|
|
|
|
const child_process_1 = __webpack_require__(63129);
|
|
|
|
|
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
|
|
|
|
class RunCli {
|
|
|
|
|
static RunCli(command) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
return yield new Promise((promise) => {
|
|
|
|
|
child_process_1.exec(command, (error, stdout, stderr) => {
|
|
|
|
|
if (error) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`[ERROR] ${error.message}`);
|
|
|
|
|
throw new Error(error.toString());
|
|
|
|
|
}
|
|
|
|
|
if (stderr) {
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`[STD-ERROR] ${stderr}`);
|
|
|
|
|
throw new Error(stderr.toString());
|
|
|
|
|
}
|
|
|
|
|
cloud_runner_logger_1.default.logRemoteCli(`${stdout}`);
|
|
|
|
|
promise(stdout);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.RunCli = RunCli;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 91311:
|
|
|
|
|
@ -3261,6 +3318,7 @@ class Input {
|
|
|
|
|
}
|
|
|
|
|
static get githubRepo() {
|
|
|
|
|
return Input.getInput('GITHUB_REPOSITORY') || 'game-ci/unity-builder';
|
|
|
|
|
// TODO system get repo remote?
|
|
|
|
|
}
|
|
|
|
|
static get branch() {
|
|
|
|
|
if (Input.getInput(`REMOTE_BUILDER_CACHE`)) {
|
|
|
|
|
@ -3281,6 +3339,7 @@ class Input {
|
|
|
|
|
else {
|
|
|
|
|
return 'remote-builder/unified-providers';
|
|
|
|
|
}
|
|
|
|
|
// TODO git get branch?
|
|
|
|
|
}
|
|
|
|
|
static get gitSha() {
|
|
|
|
|
if (Input.getInput(`GITHUB_SHA`)) {
|
|
|
|
|
@ -3289,6 +3348,7 @@ class Input {
|
|
|
|
|
if (Input.getInput(`GitSHA`)) {
|
|
|
|
|
return Input.getInput(`GitSHA`);
|
|
|
|
|
}
|
|
|
|
|
// TODO git get sha?
|
|
|
|
|
}
|
|
|
|
|
static get runNumber() {
|
|
|
|
|
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
|
|
|
|
@ -3358,6 +3418,7 @@ class Input {
|
|
|
|
|
}
|
|
|
|
|
static get gitPrivateToken() {
|
|
|
|
|
return core.getInput('gitPrivateToken') || '';
|
|
|
|
|
// TODO get from git auth status -t
|
|
|
|
|
}
|
|
|
|
|
static get chownFilesTo() {
|
|
|
|
|
return Input.getInput('chownFilesTo') || '';
|
|
|
|
|
|