fixes
parent
e075f22e5c
commit
a5eb0488aa
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -44,7 +44,7 @@
|
|||
"reflect-metadata": "^0.1.13",
|
||||
"semver": "^7.3.5",
|
||||
"unity-changeset": "^2.0.0",
|
||||
"uuid": "^8.3.2",
|
||||
"uuid": "^9.0.0",
|
||||
"yaml": "^1.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -7,7 +7,7 @@ class CloudRunnerOptions {
|
|||
// ### ### ###
|
||||
// Input Handling
|
||||
// ### ### ###
|
||||
public static getInput(query) {
|
||||
public static getInput(query: any) {
|
||||
if (GitHub.githubInputEnabled) {
|
||||
const coreInput = core.getInput(query);
|
||||
if (coreInput && coreInput !== '') {
|
||||
|
|
|
@ -92,7 +92,7 @@ class AWSTaskRunner {
|
|||
return { output, shouldCleanup };
|
||||
}
|
||||
|
||||
if (taskData.stoppedReason === 'Essential container in task exited' && exitCode === 1) {
|
||||
if (taskData?.stoppedReason === 'Essential container in task exited' && exitCode === 1) {
|
||||
throw new Error('Container exited with code 1');
|
||||
}
|
||||
|
||||
|
|
|
@ -137,13 +137,13 @@ class Kubernetes implements ProviderInterface {
|
|||
let existsAlready = false;
|
||||
let status;
|
||||
try {
|
||||
status = await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace);
|
||||
CloudRunnerLogger.log(JSON.stringify(status.body.status?.containerStatuses, undefined, 4));
|
||||
status = (await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace)).body.status;
|
||||
CloudRunnerLogger.log(JSON.stringify(status?.containerStatuses, undefined, 4));
|
||||
existsAlready = true;
|
||||
} catch {
|
||||
// empty
|
||||
}
|
||||
if (!existsAlready || status.state?.terminated !== undefined) {
|
||||
if (!existsAlready) {
|
||||
CloudRunnerLogger.log('Job does not exist');
|
||||
await this.createJob(commands, image, mountdir, workingdir, environment, secrets);
|
||||
CloudRunnerLogger.log('Watching pod until running');
|
||||
|
@ -160,10 +160,10 @@ class Kubernetes implements ProviderInterface {
|
|||
this.namespace,
|
||||
running,
|
||||
);
|
||||
status = await KubernetesPods.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||
let podStatus = await KubernetesPods.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||
|
||||
if (!running) {
|
||||
if (!FollowLogStreamService.DidReceiveEndOfTransmission && status === `Succeeded`) {
|
||||
if (!FollowLogStreamService.DidReceiveEndOfTransmission && podStatus === `Succeeded`) {
|
||||
output += await KubernetesTaskRunner.runTask(
|
||||
this.kubeConfig,
|
||||
this.kubeClient,
|
||||
|
@ -204,8 +204,8 @@ class Kubernetes implements ProviderInterface {
|
|||
break;
|
||||
}
|
||||
}
|
||||
status = await KubernetesPods.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||
CloudRunnerLogger.log(`Pod status ${status}, retrying log stream...`);
|
||||
podStatus = await KubernetesPods.GetPodStatus(this.podName, this.namespace, this.kubeClient);
|
||||
CloudRunnerLogger.log(`Pod status ${podStatus}, retrying log stream...`);
|
||||
} catch (error: any) {
|
||||
let errorParsed;
|
||||
try {
|
||||
|
@ -258,7 +258,7 @@ class Kubernetes implements ProviderInterface {
|
|||
this.setPodNameAndContainerName(find);
|
||||
}
|
||||
|
||||
private async doesJobExist(name) {
|
||||
private async doesJobExist(name: string) {
|
||||
const jobs = await this.kubeClientBatch.listNamespacedJob(this.namespace);
|
||||
|
||||
return jobs.body.items.some((x) => x.metadata?.name === name);
|
||||
|
|
|
@ -25,7 +25,7 @@ echo "end of cloud runner job"
|
|||
echo "---${buildParameters.logId}"`;
|
||||
}
|
||||
|
||||
public static getHooks(customJobHooks): Hook[] {
|
||||
public static getHooks(customJobHooks: any): Hook[] {
|
||||
const experimentHooks = customJobHooks;
|
||||
let output = new Array<Hook>();
|
||||
if (experimentHooks && experimentHooks !== '') {
|
||||
|
@ -69,13 +69,13 @@ echo "---${buildParameters.logId}"`;
|
|||
return results;
|
||||
}
|
||||
|
||||
private static ConvertYamlSecrets(object) {
|
||||
private static ConvertYamlSecrets(object: Hook) {
|
||||
if (object.secrets === undefined) {
|
||||
object.secrets = [];
|
||||
|
||||
return;
|
||||
}
|
||||
object.secrets = object.secrets.map((x) => {
|
||||
object.secrets = object.secrets.map((x: any) => {
|
||||
return {
|
||||
ParameterKey: x.name,
|
||||
EnvironmentVariable: Input.ToEnvVarFormat(x.name),
|
||||
|
@ -109,15 +109,15 @@ echo "---${buildParameters.logId}"`;
|
|||
return object;
|
||||
}
|
||||
|
||||
public static getSecrets(hooks) {
|
||||
const secrets = hooks.map((x) => x.secrets).filter((x) => x !== undefined && x.length > 0);
|
||||
public static getSecrets(hooks: any) {
|
||||
const secrets = hooks.map((x: any) => x.secrets).filter((x: any) => x !== undefined && x.length > 0);
|
||||
|
||||
// eslint-disable-next-line unicorn/no-array-reduce
|
||||
return secrets.length > 0 ? secrets.reduce((x, y) => [...x, ...y]) : [];
|
||||
return secrets.length > 0 ? secrets.reduce((x: any, y: any) => [...x, ...y]) : [];
|
||||
}
|
||||
}
|
||||
export class Hook {
|
||||
public commands;
|
||||
public commands: any;
|
||||
public secrets: CloudRunnerSecret[] = new Array<CloudRunnerSecret>();
|
||||
public name!: string;
|
||||
public hook!: string[];
|
||||
|
|
|
@ -7,7 +7,7 @@ import GitHub from '../../github';
|
|||
export class FollowLogStreamService {
|
||||
static errors = ``;
|
||||
public static DidReceiveEndOfTransmission = false;
|
||||
public static handleIteration(message, shouldReadLogs, shouldCleanup, output) {
|
||||
public static handleIteration(message: string, shouldReadLogs: boolean, shouldCleanup: boolean, output: string) {
|
||||
if (message.includes(`---${CloudRunner.buildParameters.logId}`)) {
|
||||
CloudRunnerLogger.log('End of log transmission received');
|
||||
FollowLogStreamService.DidReceiveEndOfTransmission = true;
|
||||
|
|
|
@ -34,6 +34,9 @@ export class LfsHashing {
|
|||
|
||||
@CliFunction(`hash`, `hash all folder contents`)
|
||||
static async hash() {
|
||||
if (!Cli.options) {
|
||||
return;
|
||||
}
|
||||
const folder = Cli.options['cachePushFrom'];
|
||||
LfsHashing.hashAllFiles(folder);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { CloudRunnerStatics } from '../cloud-runner-statics';
|
|||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
async function CreateParameters(overrides: any) {
|
||||
if (overrides) {
|
||||
Cli.options = overrides;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import setups from './cloud-runner-suite.test';
|
|||
import { CloudRunnerCustomSteps } from '../services/cloud-runner-custom-steps';
|
||||
import { CloudRunnerCustomHooks } from '../services/cloud-runner-custom-hooks';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
async function CreateParameters(overrides: any) {
|
||||
if (overrides) {
|
||||
Cli.options = overrides;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import UnityVersioning from '../../unity-versioning';
|
|||
import BuildParameters from '../../build-parameters';
|
||||
import CloudRunner from '../cloud-runner';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
async function CreateParameters(overrides: any) {
|
||||
if (overrides) {
|
||||
Cli.options = overrides;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ describe('Cloud Runner Locking', () => {
|
|||
it('Responds', () => {});
|
||||
if (CloudRunnerOptions.cloudRunnerDebug) {
|
||||
it(`Create Workspace`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -36,7 +35,6 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(await SharedWorkspaceLocking.CreateWorkspace(newWorkspaceName, buildParameters)).toBeTruthy();
|
||||
}, 150000);
|
||||
it(`Create Workspace And Lock Workspace`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -53,7 +51,6 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(await SharedWorkspaceLocking.LockWorkspace(newWorkspaceName, runId, buildParameters)).toBeTruthy();
|
||||
}, 150000);
|
||||
it(`Get Or Create From No Workspace`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -72,7 +69,6 @@ describe('Cloud Runner Locking', () => {
|
|||
).toBeTruthy();
|
||||
}, 150000);
|
||||
it(`Get Or Create From Unlocked`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -93,7 +89,6 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(CloudRunner.lockedWorkspace).toMatch(newWorkspaceName);
|
||||
}, 150000);
|
||||
it(`Get Or Create From Locked`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -120,7 +115,6 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(CloudRunner.lockedWorkspace).not.toMatch(newWorkspaceName);
|
||||
}, 150000);
|
||||
it(`Get Or Create After Double Lock And One Unlock`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -150,7 +144,6 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(CloudRunner.lockedWorkspace).not.toContain(newWorkspaceName);
|
||||
}, 150000);
|
||||
it(`Get Or Create After Double Lock And Unlock`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -181,7 +174,6 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(CloudRunner.lockedWorkspace).toContain(newWorkspaceName);
|
||||
}, 150000);
|
||||
it(`0 free workspaces after locking`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
@ -243,7 +235,6 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(await SharedWorkspaceLocking.GetFreeWorkspaces(buildParameters)).toHaveLength(0);
|
||||
}, 150000);
|
||||
it(`Get Or Create From Unlocked Was Locked`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import BuildParameters from '../../build-parameters';
|
||||
import { Cli } from '../../cli/cli';
|
||||
|
||||
export async function CreateParameters(overrides) {
|
||||
export async function CreateParameters(overrides: any) {
|
||||
if (overrides) Cli.options = overrides;
|
||||
|
||||
return BuildParameters.create();
|
||||
|
|
|
@ -9,7 +9,7 @@ import setups from '../cloud-runner-suite.test';
|
|||
import * as fs from 'fs';
|
||||
import { CloudRunnerSystem } from '../../services/cloud-runner-system';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
async function CreateParameters(overrides: any) {
|
||||
if (overrides) {
|
||||
Cli.options = overrides;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import CloudRunnerOptions from '../../cloud-runner-options';
|
|||
import setups from '../cloud-runner-suite.test';
|
||||
import SharedWorkspaceLocking from '../../services/shared-workspace-locking';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
async function CreateParameters(overrides: any) {
|
||||
if (overrides) {
|
||||
Cli.options = overrides;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ describe('Cloud Runner Locking', () => {
|
|||
it('Responds', () => {});
|
||||
if (CloudRunnerOptions.cloudRunnerDebug) {
|
||||
it(`Simple Locking End2End Flow`, async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
const overrides: any = {
|
||||
versioning: 'None',
|
||||
projectPath: 'test-project',
|
||||
|
|
|
@ -81,7 +81,12 @@ class GitHub {
|
|||
return result.data.id.toString();
|
||||
}
|
||||
|
||||
public static async updateGitHubCheck(longDescription, summary, result = `neutral`, status = `in_progress`) {
|
||||
public static async updateGitHubCheck(
|
||||
longDescription: string,
|
||||
summary: string,
|
||||
result = `neutral`,
|
||||
status = `in_progress`,
|
||||
) {
|
||||
if (!CloudRunnerOptions.githubChecks) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5946,6 +5946,11 @@ uuid@^8.3.0, uuid@^8.3.2:
|
|||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
uuid@^9.0.0:
|
||||
version "9.0.0"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
|
||||
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
|
||||
|
||||
v8-compile-cache@^2.0.3:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz"
|
||||
|
|
Loading…
Reference in New Issue