break download step into remote-client template

pull/310/head
Frostebite 2021-12-21 06:47:29 +00:00
parent bdc0c7f34e
commit f725479d7a
4 changed files with 96 additions and 50 deletions

68
dist/index.js vendored
View File

@ -1999,12 +1999,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DownloadRepository = void 0; exports.DownloadRepository = void 0;
const cloud_runner_state_1 = __webpack_require__(70912); const cloud_runner_state_1 = __webpack_require__(70912);
const { exec } = __webpack_require__(63129); const run_cli_1 = __webpack_require__(33639);
class DownloadRepository { class DownloadRepository {
static run() { static run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield new Promise((promise) => { yield run_cli_1.RunCli.RunCli(`
exec(`
tree -f -L 2tree -f -L 2 tree -f -L 2tree -f -L 2
echo "test" echo "test"
mkdir -p ${cloud_runner_state_1.CloudRunnerState.buildPathFull} mkdir -p ${cloud_runner_state_1.CloudRunnerState.buildPathFull}
@ -2013,6 +2012,8 @@ class DownloadRepository {
echo 'Initializing source repository for cloning with caching of LFS files' echo 'Initializing source repository for cloning with caching of LFS files'
repoPathFull=${cloud_runner_state_1.CloudRunnerState.repoPathFull} repoPathFull=${cloud_runner_state_1.CloudRunnerState.repoPathFull}
githubSha=$GITHUB_SHA githubSha=$GITHUB_SHA
`);
yield run_cli_1.RunCli.RunCli(`
cd ${cloud_runner_state_1.CloudRunnerState.repoPathFull} cd ${cloud_runner_state_1.CloudRunnerState.repoPathFull}
# stop annoying git detatched head info # stop annoying git detatched head info
git config --global advice.detachedHead false git config --global advice.detachedHead false
@ -2023,46 +2024,81 @@ class DownloadRepository {
git clone ${cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl} ${cloud_runner_state_1.CloudRunnerState.repoPathFull} git clone ${cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl} ${cloud_runner_state_1.CloudRunnerState.repoPathFull}
git checkout $githubSha git checkout $githubSha
echo "Checked out $githubSha" echo "Checked out $githubSha"
`);
yield run_cli_1.RunCli.RunCli(`
git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid
md5sum .lfs-assets-guid > .lfs-assets-guid-sum md5sum .lfs-assets-guid > .lfs-assets-guid-sum
`);
yield run_cli_1.RunCli.RunCli(`
export LFS_ASSETS_HASH="$(cat ${cloud_runner_state_1.CloudRunnerState.repoPathFull}/.lfs-assets-guid)" export LFS_ASSETS_HASH="$(cat ${cloud_runner_state_1.CloudRunnerState.repoPathFull}/.lfs-assets-guid)"
`);
yield run_cli_1.RunCli.RunCli(`
echo ' ' echo ' '
echo 'Contents of .lfs-assets-guid file:' echo 'Contents of .lfs-assets-guid file:'
cat .lfs-assets-guid cat .lfs-assets-guid
echo ' ' echo ' '
echo 'Contents of .lfs-assets-guid-sum file:' echo 'Contents of .lfs-assets-guid-sum file:'
cat .lfs-assets-guid-sum cat .lfs-assets-guid-sum
echo ' ' echo ' '
# echo 'Source repository initialized' echo 'Source repository initialized'
# ls ${cloud_runner_state_1.CloudRunnerState.projectPathFull} ls ${cloud_runner_state_1.CloudRunnerState.projectPathFull}
# echo ' ' echo ' '
# echo 'Starting checks of cache for the Unity project Library and git LFS files' `);
# ${cloud_runner_state_1.CloudRunnerState.getHandleCachingCommand} yield run_cli_1.RunCli.RunCli(`
`, (error, stdout, stderr) => { echo 'Starting checks of cache for the Unity project Library and git LFS files'
${cloud_runner_state_1.CloudRunnerState.getHandleCachingCommand}
`);
});
}
}
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());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RunCli = void 0;
const child_process_1 = __webpack_require__(63129);
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) { if (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(`error: ${error.message}`); console.log(`error: ${error.message}`);
promise(); promise(error.message);
return; return;
} }
if (stderr) { if (stderr) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(`stderr: ${stderr}`); console.log(`stderr: ${stderr}`);
promise(); promise(stderr);
return; return;
} }
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(`stdout: ${stdout}`); console.log(`stdout: ${stdout}`);
promise(); promise(stdout);
}); });
}); });
}); });
} }
} }
exports.DownloadRepository = DownloadRepository; exports.RunCli = RunCli;
/***/ }), /***/ }),

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,9 @@
import { CloudRunnerState } from '../../state/cloud-runner-state'; import { CloudRunnerState } from '../../state/cloud-runner-state';
import { RunCli } from '../run-cli';
const { exec } = require('child_process');
export class DownloadRepository { export class DownloadRepository {
public static async run() { public static async run() {
await new Promise<void>((promise) => { await RunCli.RunCli(`
exec(
`
tree -f -L 2tree -f -L 2 tree -f -L 2tree -f -L 2
echo "test" echo "test"
mkdir -p ${CloudRunnerState.buildPathFull} mkdir -p ${CloudRunnerState.buildPathFull}
@ -15,6 +12,8 @@ export class DownloadRepository {
echo 'Initializing source repository for cloning with caching of LFS files' echo 'Initializing source repository for cloning with caching of LFS files'
repoPathFull=${CloudRunnerState.repoPathFull} repoPathFull=${CloudRunnerState.repoPathFull}
githubSha=$GITHUB_SHA githubSha=$GITHUB_SHA
`);
await RunCli.RunCli(`
cd ${CloudRunnerState.repoPathFull} cd ${CloudRunnerState.repoPathFull}
# stop annoying git detatched head info # stop annoying git detatched head info
git config --global advice.detachedHead false git config --global advice.detachedHead false
@ -25,43 +24,29 @@ export class DownloadRepository {
git clone ${CloudRunnerState.targetBuildRepoUrl} ${CloudRunnerState.repoPathFull} git clone ${CloudRunnerState.targetBuildRepoUrl} ${CloudRunnerState.repoPathFull}
git checkout $githubSha git checkout $githubSha
echo "Checked out $githubSha" echo "Checked out $githubSha"
`);
await RunCli.RunCli(`
git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid
md5sum .lfs-assets-guid > .lfs-assets-guid-sum md5sum .lfs-assets-guid > .lfs-assets-guid-sum
`);
await RunCli.RunCli(`
export LFS_ASSETS_HASH="$(cat ${CloudRunnerState.repoPathFull}/.lfs-assets-guid)" export LFS_ASSETS_HASH="$(cat ${CloudRunnerState.repoPathFull}/.lfs-assets-guid)"
`);
await RunCli.RunCli(`
echo ' ' echo ' '
echo 'Contents of .lfs-assets-guid file:' echo 'Contents of .lfs-assets-guid file:'
cat .lfs-assets-guid cat .lfs-assets-guid
echo ' ' echo ' '
echo 'Contents of .lfs-assets-guid-sum file:' echo 'Contents of .lfs-assets-guid-sum file:'
cat .lfs-assets-guid-sum cat .lfs-assets-guid-sum
echo ' ' echo ' '
# echo 'Source repository initialized' echo 'Source repository initialized'
# ls ${CloudRunnerState.projectPathFull} ls ${CloudRunnerState.projectPathFull}
# echo ' ' echo ' '
# echo 'Starting checks of cache for the Unity project Library and git LFS files' `);
# ${CloudRunnerState.getHandleCachingCommand} await RunCli.RunCli(`
`, echo 'Starting checks of cache for the Unity project Library and git LFS files'
(error, stdout, stderr) => { ${CloudRunnerState.getHandleCachingCommand}
if (error) { `);
// eslint-disable-next-line no-console
console.log(`error: ${error.message}`);
promise();
return;
}
if (stderr) {
// eslint-disable-next-line no-console
console.log(`stderr: ${stderr}`);
promise();
return;
}
// eslint-disable-next-line no-console
console.log(`stdout: ${stdout}`);
promise();
},
);
});
} }
} }

View File

@ -0,0 +1,25 @@
import { exec } from 'child_process';
export class RunCli {
public static async RunCli(command: string) {
return await new Promise<string>((promise) => {
exec(command, (error, stdout, stderr) => {
if (error) {
// eslint-disable-next-line no-console
console.log(`error: ${error.message}`);
promise(error.message);
return;
}
if (stderr) {
// eslint-disable-next-line no-console
console.log(`stderr: ${stderr}`);
promise(stderr);
return;
}
// eslint-disable-next-line no-console
console.log(`stdout: ${stdout}`);
promise(stdout);
});
});
}
}