new lines between methods

pull/310/head
Frostebite 2021-12-29 15:33:07 +00:00
parent 4125ce11b0
commit a67902498b
6 changed files with 29 additions and 39 deletions

21
dist/index.js vendored
View File

@ -414,7 +414,6 @@ class CLI {
core.info(`\n`); core.info(`\n`);
core.info(`INPUT:`); core.info(`INPUT:`);
for (const element of properties) { for (const element of properties) {
// TODO pull description from action.yml
program.option(`--${element} <${element}>`, action_yaml_1.ActionYamlReader.Instance.GetActionYamlValue(element)); program.option(`--${element} <${element}>`, action_yaml_1.ActionYamlReader.Instance.GetActionYamlValue(element));
if (__1.Input[element] !== undefined && __1.Input[element] !== '') { if (__1.Input[element] !== undefined && __1.Input[element] !== '') {
core.info(`${element} ${__1.Input[element]}`); core.info(`${element} ${__1.Input[element]}`);
@ -2289,7 +2288,6 @@ class KubernetesStorage {
} }
catch (error) { catch (error) {
core.error('Failed to watch PVC'); core.error('Failed to watch PVC');
core.error(error);
core.error(JSON.stringify(error, undefined, 4)); core.error(JSON.stringify(error, undefined, 4));
core.error(`PVC Body: ${JSON.stringify((yield kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body, undefined, 4)}`); core.error(`PVC Body: ${JSON.stringify((yield kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body, undefined, 4)}`);
throw error; throw error;
@ -2320,13 +2318,7 @@ class KubernetesStorage {
static handleResult(result, kubeClient, namespace, pvcName) { static handleResult(result, kubeClient, namespace, pvcName) {
var _a; var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const name = (_a = result.body.metadata) === null || _a === void 0 ? void 0 : _a.name; const name = ((_a = result.body.metadata) === null || _a === void 0 ? void 0 : _a.name) || '';
if (!name)
throw new Error('failed to create PVC');
// don't always log the PVC...
// CloudRunnerLogger.log(
// JSON.stringify(await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace), undefined, 4),
// );
cloud_runner_logger_1.default.log(`PVC ${name} created`); cloud_runner_logger_1.default.log(`PVC ${name} created`);
yield this.watchUntilPVCNotPending(kubeClient, name, namespace); yield this.watchUntilPVCNotPending(kubeClient, name, namespace);
cloud_runner_logger_1.default.log(`PVC ${name} is ready and not pending`); cloud_runner_logger_1.default.log(`PVC ${name} is ready and not pending`);
@ -2362,7 +2354,8 @@ const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
class KubernetesUtilities { class KubernetesUtilities {
static findPodFromJob(kubeClient, jobName, namespace) { static findPodFromJob(kubeClient, jobName, namespace) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const pod = (yield kubeClient.listNamespacedPod(namespace)).body.items.find((x) => { var _a, _b; return ((_b = (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b['job-name']) === jobName; }); const newLocal = yield kubeClient.listNamespacedPod(namespace);
const pod = (newLocal).body.items.find((x) => { var _a, _b; return ((_b = (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b['job-name']) === jobName; });
if (pod === undefined) { if (pod === undefined) {
throw new Error("pod with job-name label doesn't exist"); throw new Error("pod with job-name label doesn't exist");
} }
@ -2579,12 +2572,6 @@ class CloudRunnerState {
} }
} }
exports.CloudRunnerState = CloudRunnerState; exports.CloudRunnerState = CloudRunnerState;
CloudRunnerState.defaultGitShaEnvironmentVariable = [
{
name: 'GITHUB_SHA',
value: process.env.GITHUB_SHA || '',
},
];
CloudRunnerState.repositoryFolder = 'repo'; CloudRunnerState.repositoryFolder = 'repo';
@ -3482,7 +3469,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GithubCliReader = void 0; exports.GithubCliReader = void 0;
class GithubCliReader { class GithubCliReader {
static GetGitHubAuthToken() { static GetGitHubAuthToken() {
// TODO Get from git auth status -t // `gh auth status -t`
return ''; return '';
} }
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,6 @@ export class CLI {
core.info(`\n`); core.info(`\n`);
core.info(`INPUT:`); core.info(`INPUT:`);
for (const element of properties) { for (const element of properties) {
// TODO pull description from action.yml
program.option(`--${element} <${element}>`, ActionYamlReader.Instance.GetActionYamlValue(element)); program.option(`--${element} <${element}>`, ActionYamlReader.Instance.GetActionYamlValue(element));
if (Input[element] !== undefined && Input[element] !== '') { if (Input[element] !== undefined && Input[element] !== '') {
core.info(`${element} ${Input[element]}`); core.info(`${element} ${Input[element]}`);

View File

@ -56,7 +56,6 @@ class KubernetesStorage {
); );
} catch (error) { } catch (error) {
core.error('Failed to watch PVC'); core.error('Failed to watch PVC');
core.error(error);
core.error(JSON.stringify(error, undefined, 4)); core.error(JSON.stringify(error, undefined, 4));
core.error( core.error(
`PVC Body: ${JSON.stringify( `PVC Body: ${JSON.stringify(
@ -100,12 +99,7 @@ class KubernetesStorage {
namespace: string, namespace: string,
pvcName: string, pvcName: string,
) { ) {
const name = result.body.metadata?.name; const name = result.body.metadata?.name || '';
if (!name) throw new Error('failed to create PVC');
// don't always log the PVC...
// CloudRunnerLogger.log(
// JSON.stringify(await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace), undefined, 4),
// );
CloudRunnerLogger.log(`PVC ${name} created`); CloudRunnerLogger.log(`PVC ${name} created`);
await this.watchUntilPVCNotPending(kubeClient, name, namespace); await this.watchUntilPVCNotPending(kubeClient, name, namespace);
CloudRunnerLogger.log(`PVC ${name} is ready and not pending`); CloudRunnerLogger.log(`PVC ${name} is ready and not pending`);

View File

@ -7,6 +7,12 @@ import CloudRunnerSecret from '../services/cloud-runner-secret';
import { TaskParameterSerializer } from './task-parameter-serializer'; import { TaskParameterSerializer } from './task-parameter-serializer';
export class CloudRunnerState { export class CloudRunnerState {
public static CloudRunnerProviderPlatform: CloudRunnerProviderInterface;
public static buildParams: BuildParameters;
public static defaultSecrets: CloudRunnerSecret[];
public static buildGuid: string;
public static readonly repositoryFolder = 'repo';
static setup(buildParameters: BuildParameters) { static setup(buildParameters: BuildParameters) {
CloudRunnerState.buildParams = buildParameters; CloudRunnerState.buildParams = buildParameters;
if (CloudRunnerState.buildGuid === undefined) { if (CloudRunnerState.buildGuid === undefined) {
@ -17,49 +23,59 @@ export class CloudRunnerState {
} }
TaskParameterSerializer.setupDefaultSecrets(); TaskParameterSerializer.setupDefaultSecrets();
} }
public static CloudRunnerProviderPlatform: CloudRunnerProviderInterface;
public static buildParams: BuildParameters;
public static defaultSecrets: CloudRunnerSecret[];
public static buildGuid: string;
public static get branchName(): string { public static get branchName(): string {
return CloudRunnerState.buildParams.branch; return CloudRunnerState.buildParams.branch;
} }
public static get buildPathFull(): string { public static get buildPathFull(): string {
return path.join(`/`, CloudRunnerState.buildVolumeFolder, CloudRunnerState.buildGuid); return path.join(`/`, CloudRunnerState.buildVolumeFolder, CloudRunnerState.buildGuid);
} }
public static get builderPathFull(): string { public static get builderPathFull(): string {
return path.join(CloudRunnerState.buildPathFull, `builder`); return path.join(CloudRunnerState.buildPathFull, `builder`);
} }
public static get steamPathFull(): string { public static get steamPathFull(): string {
return path.join(CloudRunnerState.buildPathFull, `steam`); return path.join(CloudRunnerState.buildPathFull, `steam`);
} }
public static get repoPathFull(): string { public static get repoPathFull(): string {
return path.join(CloudRunnerState.buildPathFull, CloudRunnerState.repositoryFolder); return path.join(CloudRunnerState.buildPathFull, CloudRunnerState.repositoryFolder);
} }
public static get projectPathFull(): string { public static get projectPathFull(): string {
return path.join(CloudRunnerState.repoPathFull, CloudRunnerState.buildParams.projectPath); return path.join(CloudRunnerState.repoPathFull, CloudRunnerState.buildParams.projectPath);
} }
public static get libraryFolderFull(): string { public static get libraryFolderFull(): string {
return path.join(CloudRunnerState.projectPathFull, `Library`); return path.join(CloudRunnerState.projectPathFull, `Library`);
} }
public static get cacheFolderFull(): string { public static get cacheFolderFull(): string {
return path.join(CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.branchName); return path.join(CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.branchName);
} }
public static get lfsDirectory(): string { public static get lfsDirectory(): string {
return path.join(CloudRunnerState.repoPathFull, `.git`, `lfs`); return path.join(CloudRunnerState.repoPathFull, `.git`, `lfs`);
} }
public static get purgeRemoteCaching(): boolean { public static get purgeRemoteCaching(): boolean {
return process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined; return process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined;
} }
public static get lfsCacheFolder() { public static get lfsCacheFolder() {
return path.join(CloudRunnerState.cacheFolderFull, `lfs`); return path.join(CloudRunnerState.cacheFolderFull, `lfs`);
} }
public static get libraryCacheFolder() { public static get libraryCacheFolder() {
return path.join(CloudRunnerState.cacheFolderFull, `lib`); return path.join(CloudRunnerState.cacheFolderFull, `lib`);
} }
public static get unityBuilderRepoUrl(): string { public static get unityBuilderRepoUrl(): string {
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/game-ci/unity-builder.git`; return `https://${CloudRunnerState.buildParams.githubToken}@github.com/game-ci/unity-builder.git`;
} }
public static get targetBuildRepoUrl(): string { public static get targetBuildRepoUrl(): string {
return `https://${CloudRunnerState.buildParams.githubToken}@github.com/${CloudRunnerState.githubRepo}.git`; return `https://${CloudRunnerState.buildParams.githubToken}@github.com/${CloudRunnerState.githubRepo}.git`;
} }
@ -67,20 +83,14 @@ export class CloudRunnerState {
public static get githubRepo(): string { public static get githubRepo(): string {
return `${CloudRunnerState.buildParams.githubRepo}`; return `${CloudRunnerState.buildParams.githubRepo}`;
} }
public static readonly defaultGitShaEnvironmentVariable = [
{
name: 'GITHUB_SHA',
value: process.env.GITHUB_SHA || '',
},
];
public static readonly repositoryFolder = 'repo';
public static get buildVolumeFolder() { public static get buildVolumeFolder() {
return path.join('/', 'data'); return path.join('/', 'data');
} }
public static get cacheFolder() { public static get cacheFolder() {
return 'cache'; return 'cache';
} }
public static cloudRunnerBranch: string;
public static readBuildEnvironmentVariables(): CloudRunnerEnvironmentVariable[] { public static readBuildEnvironmentVariables(): CloudRunnerEnvironmentVariable[] {
return TaskParameterSerializer.readBuildEnvironmentVariables(); return TaskParameterSerializer.readBuildEnvironmentVariables();

View File

@ -1,6 +1,6 @@
export class GithubCliReader { export class GithubCliReader {
static GetGitHubAuthToken() { static GetGitHubAuthToken() {
// TODO Get from git auth status -t // `gh auth status -t`
return ''; return '';
} }
} }