chore: fix all linting issues with updated linting configs
parent
4d8b198d3f
commit
45b043c5b9
|
|
@ -61,6 +61,7 @@
|
|||
"@typescript-eslint/no-unused-vars": "off",
|
||||
// For this project only use kebab-case
|
||||
"unicorn/filename-case": ["error", { "cases": { "kebabCase": true } }],
|
||||
"filenames/match-regex": ["error", "^[a-z-]+(\\.(d|integration|test|setup))*$"],
|
||||
// Allow Array.from(set) mitigate TS2569 which would require '--downlevelIteration'
|
||||
"unicorn/prefer-spread": "off",
|
||||
// Deno has dependencies file, this rule enforces it's named re-exports
|
||||
|
|
@ -76,6 +77,10 @@
|
|||
// Showing false positives (enable after upgrading)
|
||||
"no-shadow": "off",
|
||||
// (enable to add improvements)
|
||||
"unicorn/no-static-only-class": "off"
|
||||
"unicorn/no-static-only-class": "off",
|
||||
// Null is useful when explicit value is passed
|
||||
"unicorn/no-null": "off",
|
||||
// (enable to add improvements)
|
||||
"unicorn/prefer-export-from": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable unicorn/prefer-export-from */
|
||||
// These are the packages from Deno that replace the ones from Node.
|
||||
import * as assert from 'https://deno.land/std@0.144.0/testing/asserts.ts';
|
||||
import * as aws from 'https://deno.land/x/aws_api/client/mod.ts';
|
||||
|
|
|
|||
|
|
@ -46,4 +46,4 @@ async function runMain() {
|
|||
}
|
||||
}
|
||||
|
||||
runMain();
|
||||
await runMain();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export const notCompletelyValidSemanticVersions = [
|
|||
'99999999999999999999999.999999999999999999.99999999999999999----RC-SNAPSHOT.12.09.1--------------------------------..12',
|
||||
];
|
||||
|
||||
const addVariantsPrependingV = (array: string[]) => array.map((tag) => [tag, `v${tag}`]).flat();
|
||||
const addVariantsPrependingV = (array: string[]) => array.flatMap((tag) => [tag, `v${tag}`]);
|
||||
|
||||
/**
|
||||
* Array of versions that will be detected as version tags. Not all of these are
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe('Android Versioning', () => {
|
|||
});
|
||||
|
||||
it('returns a number', () => {
|
||||
expect(AndroidVersioning.versionToVersionCode('123.456.789')).toBe(123456789);
|
||||
expect(AndroidVersioning.versionToVersionCode('123.456.789')).toBe(123_456_789);
|
||||
});
|
||||
|
||||
it('throw when generated version code is too large', () => {
|
||||
|
|
@ -21,7 +21,7 @@ describe('Android Versioning', () => {
|
|||
|
||||
describe('determineVersionCode', () => {
|
||||
it('defaults to parsed version', () => {
|
||||
expect(AndroidVersioning.determineVersionCode('1.2.3', '')).toBe(1002003);
|
||||
expect(AndroidVersioning.determineVersionCode('1.2.3', '')).toBe(1_002_003);
|
||||
});
|
||||
|
||||
it('use specified code', () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { core, semver } from '../dependencies.ts';
|
||||
import { semver } from '../dependencies.ts';
|
||||
|
||||
export default class AndroidVersioning {
|
||||
static determineVersionCode(version, inputVersionCode) {
|
||||
|
|
@ -26,9 +26,9 @@ export default class AndroidVersioning {
|
|||
|
||||
// The greatest value Google Plays allows is 2100000000.
|
||||
// Allow for 3 patch digits, 3 minor digits and 3 major digits.
|
||||
const versionCode = parsedVersion.major * 1000000 + parsedVersion.minor * 1000 + parsedVersion.patch;
|
||||
const versionCode = parsedVersion.major * 1_000_000 + parsedVersion.minor * 1000 + parsedVersion.patch;
|
||||
|
||||
if (versionCode >= 2050000000) {
|
||||
if (versionCode >= 2_050_000_000) {
|
||||
throw new Error(
|
||||
`Generated versionCode ${versionCode} is dangerously close to the maximum allowed number 2100000000. Consider a different versioning scheme to be able to continue updating your application.`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ describe('BuildParameters', () => {
|
|||
it('returns the android version code from version by default', async () => {
|
||||
const mockValue = '';
|
||||
jest.spyOn(Input, 'androidVersionCode', 'get').mockReturnValue(mockValue);
|
||||
expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidVersionCode: 1003037 }));
|
||||
expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ androidVersionCode: 1_003_037 }));
|
||||
});
|
||||
|
||||
it('determines the android sdk manager parameters only once', async () => {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ export class CliFunctionsRepository {
|
|||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
public static PushCliFunctionSource(cliFunction: any) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ describe('Cloud Runner', () => {
|
|||
|
||||
// Assert results
|
||||
expect(file).toContain(JSON.stringify(buildParameter));
|
||||
expect(file).toContain(`${Input.ToEnvVarFormat(testSecretName)}=${testSecretValue}`);
|
||||
expect(file).toContain(`${Input.toEnvVarFormat(testSecretName)}=${testSecretValue}`);
|
||||
const environmentVariables = TaskParameterSerializer.readBuildEnvironmentVariables();
|
||||
const newLinePurgedFile = file
|
||||
.replace(/\s+/g, '')
|
||||
|
|
@ -63,7 +63,7 @@ describe('Cloud Runner', () => {
|
|||
}
|
||||
}
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
}, 1_000_000);
|
||||
it('Run one build it should not use cache, run subsequent build which should use cache', async () => {
|
||||
Cli.options = {
|
||||
versioning: 'None',
|
||||
|
|
@ -89,7 +89,7 @@ describe('Cloud Runner', () => {
|
|||
expect(results2).toEqual(expect.not.stringContaining(libraryString));
|
||||
Input.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
}, 1_000_000);
|
||||
}
|
||||
it('Local cloud runner returns commands', async () => {
|
||||
// Build parameters
|
||||
|
|
@ -118,7 +118,7 @@ describe('Cloud Runner', () => {
|
|||
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
||||
Input.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
}, 1_000_000);
|
||||
it('Test cloud runner returns commands', async () => {
|
||||
// Build parameters
|
||||
Cli.options = {
|
||||
|
|
@ -138,5 +138,5 @@ describe('Cloud Runner', () => {
|
|||
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
||||
Input.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
}, 1_000_000);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ class CloudRunner {
|
|||
if (!buildParameters.isCliMode) {
|
||||
const buildParameterPropertyNames = Object.getOwnPropertyNames(buildParameters);
|
||||
for (const element of CloudRunner.cloudRunnerEnvironmentVariables) {
|
||||
core.setOutput(Input.ToEnvVarFormat(element.name), element.value);
|
||||
core.setOutput(Input.toEnvVarFormat(element.name), element.value);
|
||||
}
|
||||
for (const element of buildParameterPropertyNames) {
|
||||
core.setOutput(Input.ToEnvVarFormat(element), buildParameters[element]);
|
||||
core.setOutput(Input.toEnvVarFormat(element), buildParameters[element]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export class AWSBaseStack {
|
|||
.digest('hex');
|
||||
const parameters: aws.CloudFormation.Parameter[] = [
|
||||
...parametersWithoutHash,
|
||||
...[{ ParameterKey: 'Version', ParameterValue: parametersHash }],
|
||||
{ ParameterKey: 'Version', ParameterValue: parametersHash },
|
||||
];
|
||||
const updateInput: aws.CloudFormation.UpdateStackInput = {
|
||||
StackName: baseStackName,
|
||||
|
|
@ -55,7 +55,7 @@ export class AWSBaseStack {
|
|||
await CF.createStack(createStackInput).promise();
|
||||
CloudRunnerLogger.log(`created stack (version: ${parametersHash})`);
|
||||
}
|
||||
const CFState = await describeStack();
|
||||
let CFState = await describeStack();
|
||||
let stack = CFState.Stacks?.[0];
|
||||
if (!stack) {
|
||||
throw new Error(`Base stack doesn't exist, even after creation, stackExists check: ${stackExists}`);
|
||||
|
|
@ -84,7 +84,9 @@ export class AWSBaseStack {
|
|||
} else {
|
||||
CloudRunnerLogger.log(`No update required`);
|
||||
}
|
||||
stack = (await describeStack()).Stacks?.[0];
|
||||
|
||||
CFState = await describeStack();
|
||||
stack = CFState.Stacks?.[0];
|
||||
if (!stack) {
|
||||
throw new Error(
|
||||
`Base stack doesn't exist, even after updating and creation, stackExists check: ${stackExists}`,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||
import { core, aws } from '../../../../dependencies.ts';
|
||||
import { aws } from '../../../../dependencies.ts';
|
||||
import CloudRunner from '../../cloud-runner.ts';
|
||||
|
||||
export class AWSError {
|
||||
|
|
@ -8,7 +8,8 @@ export class AWSError {
|
|||
log.error(JSON.stringify(error, undefined, 4));
|
||||
if (CloudRunner.buildParameters.cloudRunnerIntegrationTests) {
|
||||
CloudRunnerLogger.log('Getting events and resources for task stack');
|
||||
const events = (await CF.describeStackEvents({ StackName: taskDefStackName }).promise()).StackEvents;
|
||||
const stackEventsDescription = await CF.describeStackEvents({ StackName: taskDefStackName }).promise();
|
||||
const events = stackEventsDescription.StackEvents;
|
||||
CloudRunnerLogger.log(JSON.stringify(events, undefined, 4));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,13 +134,13 @@ export class AWSJobStack {
|
|||
throw error;
|
||||
}
|
||||
|
||||
const taskDefResources = (
|
||||
await CF.describeStackResources({
|
||||
const { StackResources: taskDefResources } = await CF.describeStackResources({
|
||||
StackName: taskDefStackName,
|
||||
}).promise()
|
||||
).StackResources;
|
||||
}).promise();
|
||||
|
||||
const baseResources = (await CF.describeStackResources({ StackName: this.baseStackName }).promise()).StackResources;
|
||||
const { StackResources: baseResources } = await CF.describeStackResources({
|
||||
StackName: this.baseStackName,
|
||||
}).promise();
|
||||
|
||||
return {
|
||||
taskDefStackName,
|
||||
|
|
|
|||
|
|
@ -53,9 +53,8 @@ class AWSTaskRunner {
|
|||
const taskArn = task.tasks?.[0].taskArn || '';
|
||||
CloudRunnerLogger.log('Cloud runner job is starting');
|
||||
await AWSTaskRunner.waitUntilTaskRunning(ECS, taskArn, cluster);
|
||||
CloudRunnerLogger.log(
|
||||
`Cloud runner job status is running ${(await AWSTaskRunner.describeTasks(ECS, cluster, taskArn))?.lastStatus}`,
|
||||
);
|
||||
const { lastStatus } = await AWSTaskRunner.describeTasks(ECS, cluster, taskArn);
|
||||
CloudRunnerLogger.log(`Cloud runner job status is running ${lastStatus}`);
|
||||
const { output, shouldCleanup } = await this.streamLogsUntilTaskStops(
|
||||
ECS,
|
||||
CF,
|
||||
|
|
@ -89,11 +88,8 @@ class AWSTaskRunner {
|
|||
} catch (error_) {
|
||||
const error = error_ as Error;
|
||||
await new Promise((resolve) => setTimeout(resolve, 3000));
|
||||
CloudRunnerLogger.log(
|
||||
`Cloud runner job has ended ${
|
||||
(await AWSTaskRunner.describeTasks(ECS, cluster, taskArn)).containers?.[0].lastStatus
|
||||
}`,
|
||||
);
|
||||
const tasksDescription = await AWSTaskRunner.describeTasks(ECS, cluster, taskArn);
|
||||
CloudRunnerLogger.log(`Cloud runner job has ended ${tasksDescription.containers?.[0].lastStatus}`);
|
||||
|
||||
core.setFailed(error);
|
||||
log.error(error);
|
||||
|
|
@ -182,7 +178,7 @@ class AWSTaskRunner {
|
|||
CloudRunnerLogger.log('## Cloud runner job stopped, streaming end of logs');
|
||||
timestamp = Date.now();
|
||||
}
|
||||
if (timestamp !== 0 && Date.now() - timestamp > 30000) {
|
||||
if (timestamp !== 0 && Date.now() - timestamp > 30_000) {
|
||||
CloudRunnerLogger.log('## Cloud runner status is not RUNNING for 30 seconds, last query for logs');
|
||||
shouldReadLogs = false;
|
||||
}
|
||||
|
|
@ -231,17 +227,15 @@ class AWSTaskRunner {
|
|||
}
|
||||
|
||||
private static async getLogIterator(kinesis: aws.Kinesis, stream) {
|
||||
return (
|
||||
(
|
||||
await kinesis
|
||||
const description = await kinesis
|
||||
.getShardIterator({
|
||||
ShardIteratorType: 'TRIM_HORIZON',
|
||||
StreamName: stream.StreamDescription.StreamName,
|
||||
ShardId: stream.StreamDescription.Shards[0].ShardId,
|
||||
})
|
||||
.promise()
|
||||
).ShardIterator || ''
|
||||
);
|
||||
.promise();
|
||||
|
||||
return description.ShardIterator || '';
|
||||
}
|
||||
}
|
||||
export default AWSTaskRunner;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,9 @@ export class AwsCliCommands {
|
|||
static async awsListStacks(perResultCallback: any = false, verbose: boolean = false) {
|
||||
Deno.env.set('AWS_REGION', Input.region);
|
||||
const CF = new aws.CloudFormation();
|
||||
let cfStacks = await CF.listStacks().promise();
|
||||
const stacks =
|
||||
(await CF.listStacks().promise()).StackSummaries?.filter(
|
||||
cfStacks.StackSummaries?.filter(
|
||||
(_x) => _x.StackStatus !== 'DELETE_COMPLETE', // &&
|
||||
// _x.TemplateDescription === TaskDefinitionFormation.description.replace('\n', ''),
|
||||
) || [];
|
||||
|
|
@ -49,8 +50,9 @@ export class AwsCliCommands {
|
|||
);
|
||||
if (perResultCallback) await perResultCallback(element);
|
||||
}
|
||||
cfStacks = await CF.listStacks().promise();
|
||||
const baseStacks =
|
||||
(await CF.listStacks().promise()).StackSummaries?.filter(
|
||||
cfStacks.StackSummaries?.filter(
|
||||
(_x) =>
|
||||
_x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription === BaseStackFormation.baseStackDecription,
|
||||
) || [];
|
||||
|
|
@ -73,17 +75,20 @@ export class AwsCliCommands {
|
|||
static async awsListTasks(perResultCallback: any = false) {
|
||||
Deno.env.set('AWS_REGION', Input.region);
|
||||
const ecs = new aws.ECS();
|
||||
const clusters = (await ecs.listClusters().promise()).clusterArns || [];
|
||||
const ecsClusters = await ecs.listClusters().promise();
|
||||
const clusters = ecsClusters.clusterArns || [];
|
||||
CloudRunnerLogger.log(`Clusters ${clusters.length}`);
|
||||
for (const element of clusters) {
|
||||
const input: aws.ECS.ListTasksRequest = {
|
||||
cluster: element,
|
||||
};
|
||||
|
||||
const list = (await ecs.listTasks(input).promise()).taskArns || [];
|
||||
const listedTasks = await ecs.listTasks(input).promise();
|
||||
const list = listedTasks.taskArns || [];
|
||||
if (list.length > 0) {
|
||||
const describeInput: aws.ECS.DescribeTasksRequest = { tasks: list, cluster: element };
|
||||
const describeList = (await ecs.describeTasks(describeInput).promise()).tasks || [];
|
||||
const tasksDescription = await ecs.describeTasks(describeInput).promise();
|
||||
const describeList = tasksDescription.tasks || [];
|
||||
if (describeList === []) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,23 +17,15 @@ class AWSBuildEnvironment implements ProviderInterface {
|
|||
this.baseStackName = buildParameters.awsBaseStackName;
|
||||
}
|
||||
async cleanup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
async setup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { BuildParameters, Output } from '../../../index.ts';
|
||||
import { k8sTypes, core, k8s, waitUntil } from '../../../../dependencies.ts';
|
||||
import { k8sTypes, k8s, waitUntil } from '../../../../dependencies.ts';
|
||||
import { ProviderInterface } from '../provider-interface.ts';
|
||||
import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
||||
import KubernetesStorage from './kubernetes-storage.ts';
|
||||
|
|
@ -39,9 +39,7 @@ class Kubernetes implements ProviderInterface {
|
|||
public async setup(
|
||||
buildGuid: string,
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {
|
||||
try {
|
||||
|
|
@ -119,9 +117,7 @@ class Kubernetes implements ProviderInterface {
|
|||
);
|
||||
break;
|
||||
} catch (error: any) {
|
||||
if (error.message.includes(`HTTP`)) {
|
||||
continue;
|
||||
} else {
|
||||
if (!error.message.includes(`HTTP`)) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
@ -158,26 +154,25 @@ class Kubernetes implements ProviderInterface {
|
|||
try {
|
||||
await waitUntil(
|
||||
async () => {
|
||||
const jobBody = (await this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace)).body;
|
||||
const podBody = (await this.kubeClient.readNamespacedPod(this.podName, this.namespace)).body;
|
||||
const { body: jobBody } = await this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace);
|
||||
const { body: podBody } = await this.kubeClient.readNamespacedPod(this.podName, this.namespace);
|
||||
|
||||
return (jobBody === null || jobBody.status?.active === 0) && podBody === null;
|
||||
},
|
||||
{
|
||||
timeout: 500000,
|
||||
intervalBetweenAttempts: 15000,
|
||||
timeout: 500_000,
|
||||
intervalBetweenAttempts: 15_000,
|
||||
},
|
||||
);
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch {}
|
||||
} catch {
|
||||
log.debug('Moved into empty catch block');
|
||||
}
|
||||
}
|
||||
|
||||
async cleanup(
|
||||
buildGuid: string,
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {
|
||||
CloudRunnerLogger.log(`deleting PVC`);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ class KubernetesJobSpecFactory {
|
|||
k8s,
|
||||
) {
|
||||
environment.push(
|
||||
...[
|
||||
{
|
||||
name: 'GITHUB_SHA',
|
||||
value: buildGuid,
|
||||
|
|
@ -74,7 +73,6 @@ class KubernetesJobSpecFactory {
|
|||
name: 'ANDROID_KEYALIAS_NAME',
|
||||
value: buildParameters.androidKeyaliasName,
|
||||
},
|
||||
],
|
||||
);
|
||||
const job = new k8s.V1Job();
|
||||
job.apiVersion = 'batch/v1';
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ class KubernetesStorage {
|
|||
|
||||
return;
|
||||
}
|
||||
const pvcList = (await kubeClient.listNamespacedPersistentVolumeClaim(namespace)).body.items.map(
|
||||
(x) => x.metadata?.name,
|
||||
);
|
||||
|
||||
const listedPvcs = await kubeClient.listNamespacedPersistentVolumeClaim(namespace);
|
||||
const pvcList = listedPvcs.body.items.map((x) => x.metadata?.name);
|
||||
CloudRunnerLogger.log(`Current PVCs in namespace ${namespace}`);
|
||||
CloudRunnerLogger.log(JSON.stringify(pvcList, undefined, 4));
|
||||
if (pvcList.includes(pvcName)) {
|
||||
|
|
@ -35,7 +35,9 @@ class KubernetesStorage {
|
|||
|
||||
public static async getPVCPhase(kubeClient: k8sTypes.CoreV1Api, name: string, namespace: string) {
|
||||
try {
|
||||
return (await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status?.phase;
|
||||
const pvc = await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace);
|
||||
|
||||
return pvc.body.status?.phase;
|
||||
} catch (error) {
|
||||
log.error('Failed to get PVC phase');
|
||||
log.error(JSON.stringify(error, undefined, 4));
|
||||
|
|
@ -52,20 +54,15 @@ class KubernetesStorage {
|
|||
return (await this.getPVCPhase(kubeClient, name, namespace)) === 'Pending';
|
||||
},
|
||||
{
|
||||
timeout: 750000,
|
||||
intervalBetweenAttempts: 15000,
|
||||
timeout: 750_000,
|
||||
intervalBetweenAttempts: 15_000,
|
||||
},
|
||||
);
|
||||
} catch (error: any) {
|
||||
log.error('Failed to watch PVC');
|
||||
log.error(error.toString());
|
||||
log.error(
|
||||
`PVC Body: ${JSON.stringify(
|
||||
(await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body,
|
||||
undefined,
|
||||
4,
|
||||
)}`,
|
||||
);
|
||||
const pvc = await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace);
|
||||
log.error(`PVC Body: ${JSON.stringify(pvc.body, undefined, 4)}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import CloudRunnerLogger from '../../services/cloud-runner-logger.ts';
|
||||
import { k8sTypes, k8s, core, Writable, waitUntil } from '../../../../dependencies.ts';
|
||||
import { k8sTypes, k8s, Writable, waitUntil } from '../../../../dependencies.ts';
|
||||
import { CloudRunnerStatics } from '../../cloud-runner-statics.ts';
|
||||
import { FollowLogStreamService } from '../../services/follow-log-stream-service.ts';
|
||||
|
||||
|
|
@ -45,10 +45,11 @@ class KubernetesTaskRunner {
|
|||
}
|
||||
if (!didStreamAnyLogs) {
|
||||
log.error('Failed to stream any logs, listing namespace events, check for an error with the container');
|
||||
const listedEvents = await kubeClient.listNamespacedEvent(namespace);
|
||||
log.error(
|
||||
JSON.stringify(
|
||||
{
|
||||
events: (await kubeClient.listNamespacedEvent(namespace)).body.items
|
||||
events: listedEvents.body.items
|
||||
.filter((x) => {
|
||||
return x.involvedObject.name === podName || x.involvedObject.name === jobName;
|
||||
})
|
||||
|
|
@ -90,13 +91,12 @@ class KubernetesTaskRunner {
|
|||
status.body.status?.conditions?.[0].message || ''
|
||||
}`,
|
||||
);
|
||||
if (success || phase !== 'Pending') return true;
|
||||
|
||||
return false;
|
||||
return success || phase !== 'Pending';
|
||||
},
|
||||
{
|
||||
timeout: 2000000,
|
||||
intervalBetweenAttempts: 15000,
|
||||
timeout: 2_000_000,
|
||||
intervalBetweenAttempts: 15_000,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,37 +7,24 @@ import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
|||
|
||||
class LocalDockerCloudRunner implements ProviderInterface {
|
||||
cleanup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
setup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
public runTask(
|
||||
commands: string,
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
image: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
mountdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
workingdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
environment: CloudRunnerEnvironmentVariable[],
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
secrets: CloudRunnerSecret[],
|
||||
): Promise<string> {
|
||||
CloudRunnerLogger.log(buildGuid);
|
||||
|
|
|
|||
|
|
@ -7,36 +7,24 @@ import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
|||
|
||||
class LocalCloudRunner implements ProviderInterface {
|
||||
cleanup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
public setup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
public async runTask(
|
||||
buildGuid: string,
|
||||
image: string,
|
||||
commands: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
mountdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
workingdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
environment: CloudRunnerEnvironmentVariable[],
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
secrets: CloudRunnerSecret[],
|
||||
): Promise<string> {
|
||||
CloudRunnerLogger.log(image);
|
||||
|
|
|
|||
|
|
@ -4,39 +4,24 @@ import CloudRunnerSecret from '../services/cloud-runner-secret.ts';
|
|||
|
||||
export interface ProviderInterface {
|
||||
cleanup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
);
|
||||
setup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
);
|
||||
runTask(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
image: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
commands: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
mountdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
workingdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
environment: CloudRunnerEnvironmentVariable[],
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
secrets: CloudRunnerSecret[],
|
||||
): Promise<string>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,36 +6,24 @@ import CloudRunnerSecret from '../../services/cloud-runner-secret.ts';
|
|||
|
||||
class TestCloudRunner implements ProviderInterface {
|
||||
cleanup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
setup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {}
|
||||
public async runTask(
|
||||
commands: string,
|
||||
buildGuid: string,
|
||||
image: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
mountdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
workingdir: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
environment: CloudRunnerEnvironmentVariable[],
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
secrets: CloudRunnerSecret[],
|
||||
): Promise<string> {
|
||||
CloudRunnerLogger.log(image);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,6 @@ describe('Cloud Runner Caching', () => {
|
|||
|
||||
Input.githubInputEnabled = true;
|
||||
delete Cli.options;
|
||||
}, 1000000);
|
||||
}, 1_000_000);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ export class Caching {
|
|||
}
|
||||
public static async PullFromCache(cacheFolder: string, destinationFolder: string, cacheArtifactName: string = ``) {
|
||||
cacheArtifactName = cacheArtifactName.replace(' ', '');
|
||||
|
||||
const startPath = process.cwd();
|
||||
RemoteClientLogger.log(`Caching for ${path.basename(destinationFolder)}`);
|
||||
try {
|
||||
|
|
@ -99,18 +100,15 @@ export class Caching {
|
|||
await fs.promises.mkdir(destinationFolder);
|
||||
}
|
||||
|
||||
const latestInBranch = await (await CloudRunnerSystem.Run(`ls -t "${cacheFolder}" | grep .tar$ | head -1`))
|
||||
.replace(/\n/g, ``)
|
||||
.replace('.tar', '');
|
||||
const latestInBranchRaw = await CloudRunnerSystem.Run(`ls -t "${cacheFolder}" | grep .tar$ | head -1`);
|
||||
const latestInBranch = latestInBranchRaw.replace(/\n/g, ``).replace('.tar', '');
|
||||
|
||||
process.chdir(cacheFolder);
|
||||
|
||||
const cacheSelection =
|
||||
cacheArtifactName !== `` && (await fileExists(`${cacheArtifactName}.tar`)) ? cacheArtifactName : latestInBranch;
|
||||
await CloudRunnerLogger.log(`cache key ${cacheArtifactName} selection ${cacheSelection}`);
|
||||
|
||||
// eslint-disable-next-line func-style
|
||||
const formatFunction = function (format: string) {
|
||||
const formatFunction = (format: string) => {
|
||||
const arguments_ = Array.prototype.slice.call(
|
||||
[path.resolve(destinationFolder, '..'), cacheFolder, cacheArtifactName],
|
||||
1,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class CloudRunnerQueryOverride {
|
|||
if (Input.readInputFromOverrideList() !== '') {
|
||||
const doesInclude =
|
||||
Input.readInputFromOverrideList().split(',').includes(query) ||
|
||||
Input.readInputFromOverrideList().split(',').includes(Input.ToEnvVarFormat(query));
|
||||
Input.readInputFromOverrideList().split(',').includes(Input.toEnvVarFormat(query));
|
||||
|
||||
return doesInclude ? true : false;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@ export class LfsHashing {
|
|||
}
|
||||
public static async hashAllFiles(folder: string) {
|
||||
const startPath = process.cwd();
|
||||
|
||||
process.chdir(folder);
|
||||
const result = await (await CloudRunnerSystem.Run(`find -type f -exec md5sum "{}" + | sort | md5sum`))
|
||||
.replace(/\n/g, '')
|
||||
.split(` `)[0];
|
||||
const checksums = await CloudRunnerSystem.Run(`find -type f -exec md5sum "{}" + | sort | md5sum`);
|
||||
const result = checksums.replace(/\n/g, '').split(` `)[0];
|
||||
|
||||
process.chdir(startPath);
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export class TaskParameterSerializer {
|
|||
(x) => x.value !== undefined && x.name !== '0' && x.value !== '' && x.name !== 'prototype' && x.name !== 'length',
|
||||
);
|
||||
array = array.map((x) => {
|
||||
x.name = Input.ToEnvVarFormat(x.name);
|
||||
x.name = Input.toEnvVarFormat(x.name);
|
||||
x.value = `${x.value}`;
|
||||
|
||||
return x;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export class CustomWorkflow {
|
|||
const stepSecrets: CloudRunnerSecret[] = step.secrets.map((x) => {
|
||||
const secret: CloudRunnerSecret = {
|
||||
ParameterKey: x.name,
|
||||
EnvironmentVariable: Input.ToEnvVarFormat(x.name),
|
||||
EnvironmentVariable: Input.toEnvVarFormat(x.name),
|
||||
ParameterValue: x.value,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import { CloudRunnerStepState } from '../cloud-runner-step-state.ts';
|
||||
|
||||
export interface WorkflowInterface {
|
||||
run(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
cloudRunnerStepState: CloudRunnerStepState,
|
||||
);
|
||||
run(cloudRunnerStepState: CloudRunnerStepState);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ImageTag {
|
|||
const { generic, webgl, mac, windows, windowsIl2cpp, wsaPlayer, linux, linuxIl2cpp, android, ios, tvos, facebook } =
|
||||
ImageTag.targetPlatformSuffixes;
|
||||
|
||||
const [major, minor] = version.split('.').map((digit) => Number(digit));
|
||||
const [major, minor] = version.split('.').map(Number);
|
||||
|
||||
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
||||
switch (platform) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ export class GitRepoReader {
|
|||
return '';
|
||||
}
|
||||
assert(fs.existsSync(`.git`));
|
||||
const value = (await CloudRunnerSystem.Run(`git remote -v`, false, true)).replace(/ /g, ``);
|
||||
const upstream = await CloudRunnerSystem.Run(`git remote -v`, false, true);
|
||||
const value = upstream.replace(/ /g, '');
|
||||
CloudRunnerLogger.log(`value ${value}`);
|
||||
assert(value.includes('github.com'));
|
||||
|
||||
|
|
@ -19,14 +20,11 @@ export class GitRepoReader {
|
|||
}
|
||||
|
||||
public static async GetBranch() {
|
||||
if (Input.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
assert(fs.existsSync(`.git`));
|
||||
if (Input.cloudRunnerCluster === 'local') return '';
|
||||
|
||||
return (await CloudRunnerSystem.Run(`git branch --show-current`, false, true))
|
||||
.split('\n')[0]
|
||||
.replace(/ /g, ``)
|
||||
.replace('/head', '');
|
||||
assert(fs.existsSync(`.git`));
|
||||
const currentBranch = await CloudRunnerSystem.Run(`git branch --show-current`, false, true);
|
||||
|
||||
return currentBranch.split('\n')[0].replace(/ /g, ``).replace('/head', '');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,23 @@
|
|||
import { CloudRunnerSystem } from '../cloud-runner/services/cloud-runner-system.ts';
|
||||
import { core } from '../../dependencies.ts';
|
||||
import Input from '../input.ts';
|
||||
|
||||
export class GithubCliReader {
|
||||
static async GetGitHubAuthToken() {
|
||||
if (Input.cloudRunnerCluster === 'local') {
|
||||
return '';
|
||||
}
|
||||
if (Input.cloudRunnerCluster === 'local') return '';
|
||||
|
||||
try {
|
||||
const authStatus = await CloudRunnerSystem.Run(`gh auth status`, true, true);
|
||||
if (authStatus.includes('You are not logged') || authStatus === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return (await CloudRunnerSystem.Run(`gh auth status -t`, false, true))
|
||||
.split(`Token: `)[1]
|
||||
.replace(/ /g, '')
|
||||
.replace(/\n/g, '');
|
||||
} catch (error: any) {
|
||||
const status = await CloudRunnerSystem.Run(`gh auth status -t`, false, true);
|
||||
|
||||
return status.split(`Token: `)[1].replace(/ /g, '').replace(/\n/g, '');
|
||||
} catch (error) {
|
||||
log.info(error || 'Failed to get github auth token from gh cli');
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Input {
|
|||
return coreInput;
|
||||
}
|
||||
}
|
||||
const alternativeQuery = Input.ToEnvVarFormat(query);
|
||||
const alternativeQuery = Input.toEnvVarFormat(query);
|
||||
|
||||
// Query input sources
|
||||
if (Cli.query(query, alternativeQuery)) {
|
||||
|
|
@ -95,15 +95,17 @@ class Input {
|
|||
}
|
||||
|
||||
static get projectPath() {
|
||||
const input = Input.getInput('projectPath');
|
||||
const rawProjectPath = input
|
||||
? input
|
||||
: fs.existsSync(path.join('test-project', 'ProjectSettings', 'ProjectVersion.txt')) &&
|
||||
!fs.existsSync(path.join('ProjectSettings', 'ProjectVersion.txt'))
|
||||
? 'test-project'
|
||||
: '.';
|
||||
let input = Input.getInput('projectPath');
|
||||
|
||||
return rawProjectPath.replace(/\/$/, '');
|
||||
// Todo - remove hardcoded test project reference
|
||||
const isTestProject =
|
||||
fs.existsSync(path.join('test-project', 'ProjectSettings', 'ProjectVersion.txt')) &&
|
||||
!fs.existsSync(path.join('ProjectSettings', 'ProjectVersion.txt'));
|
||||
if (!input && isTestProject) input = 'test-project';
|
||||
|
||||
if (!input) input = '.';
|
||||
|
||||
return input.replace(/\/$/, '');
|
||||
}
|
||||
|
||||
static get buildName() {
|
||||
|
|
@ -270,7 +272,7 @@ class Input {
|
|||
return Input.getInput(`cloudRunnerTests`) || false;
|
||||
}
|
||||
|
||||
public static ToEnvVarFormat(input: string) {
|
||||
public static toEnvVarFormat(input: string) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ class SetupMac {
|
|||
}
|
||||
|
||||
private static async installUnity(buildParameters: BuildParameters, silent = false) {
|
||||
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
||||
const unityChangeSet = await getUnityChangeSet(buildParameters.editorVersion);
|
||||
const command = `${this.unityHubPath} -- --headless install \
|
||||
--version ${buildParameters.editorVersion} \
|
||||
--changeset ${unityChangeset.changeset} \
|
||||
--changeset ${unityChangeSet.changeset} \
|
||||
--module mac-il2cpp \
|
||||
--childModules`;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ describe('System', () => {
|
|||
System.run('sh', undefined, {
|
||||
input: Buffer.from('git tag --list --merged HEAD | grep v[0-9]* | wc -l'),
|
||||
// eslint-disable-next-line github/no-then
|
||||
}).then((result) => Number(result)),
|
||||
}).then(Number),
|
||||
).resolves.not.toBeNaN();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class System {
|
|||
throwContextualError(`In-command error caught: ${inCommandError}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result.replace(/\n+$/, '');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ export default class Versioning {
|
|||
* Get the tag if there is one pointing at HEAD
|
||||
*/
|
||||
static async getTag() {
|
||||
return (await this.git(['tag', '--points-at', 'HEAD'])).trim();
|
||||
return await this.git(['tag', '--points-at', 'HEAD']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { exec as originalExec } from 'https://deno.land/x/exec@0.0.5/mod.ts';
|
||||
import { core } from './core.ts';
|
||||
|
||||
export enum OutputMode {
|
||||
None = 0, // no output, just run the command
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable github/no-then,lines-around-comment */
|
||||
// Source: https://github.com/devlato/async-wait-until/blob/master/src/index.ts
|
||||
|
||||
/**
|
||||
|
|
@ -42,9 +43,9 @@ export class TimeoutError extends Error {
|
|||
*/
|
||||
const getScheduler = (): Scheduler => ({
|
||||
schedule: (fn, interval) => {
|
||||
let scheduledTimer: number | NodeJS.Timeout | undefined = undefined;
|
||||
let scheduledTimer: number | undefined;
|
||||
|
||||
const cleanUp = (timer: number | NodeJS.Timeout | undefined) => {
|
||||
const cleanUp = (timer: number | undefined) => {
|
||||
if (timer != null) {
|
||||
clearTimeout(timer as number);
|
||||
}
|
||||
|
|
@ -78,8 +79,8 @@ const delay = (scheduler: Scheduler, interval: number): Promise<void> =>
|
|||
new Promise((resolve, reject) => {
|
||||
try {
|
||||
scheduler.schedule(resolve, interval);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -139,8 +140,8 @@ export const waitUntil = <T extends PredicateReturnValue>(
|
|||
new Promise((resolve, reject) => {
|
||||
try {
|
||||
resolve(predicate());
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -157,6 +158,7 @@ export const waitUntil = <T extends PredicateReturnValue>(
|
|||
.then((result) => {
|
||||
if (result) {
|
||||
resolve(result);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +209,6 @@ export type TruthyValue =
|
|||
| Record<string, unknown>
|
||||
| unknown[]
|
||||
| symbol
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
| ((...args: unknown[]) => unknown)
|
||||
| Exclude<number, 0>
|
||||
| Exclude<string, ''>
|
||||
|
|
@ -226,14 +227,10 @@ export type PredicateReturnValue = TruthyValue | FalsyValue;
|
|||
* @category Common Types
|
||||
*/
|
||||
export type Options = {
|
||||
/**
|
||||
* @property Maximum wait interval, *5000 ms* by default
|
||||
*/
|
||||
// Maximum wait interval, *5000 ms* by default
|
||||
timeout?: number;
|
||||
|
||||
/**
|
||||
* @property Interval to wait for between attempts, optional, *50 ms* by default
|
||||
*/
|
||||
// Interval to wait for between attempts, optional, *50 ms* by default
|
||||
intervalBetweenAttempts?: number;
|
||||
};
|
||||
|
||||
|
|
@ -247,7 +244,8 @@ export type Options = {
|
|||
* @throws Error
|
||||
* @category Common Types
|
||||
*/
|
||||
type ScheduleFn = <T>(callback: (...args: T[]) => void, interval: number) => ScheduleCanceler; // eslint-disable-line no-unused-vars
|
||||
type ScheduleFn = <T>(callback: (...args: T[]) => void, interval: number) => ScheduleCanceler;
|
||||
|
||||
/**
|
||||
* A function that cancels the previously scheduled callback's execution
|
||||
* @private
|
||||
|
|
@ -255,6 +253,7 @@ type ScheduleFn = <T>(callback: (...args: T[]) => void, interval: number) => Sch
|
|||
* @category Common Types
|
||||
*/
|
||||
type CancelScheduledFn = () => void;
|
||||
|
||||
/**
|
||||
* A stateful abstraction over Node.js & web browser timers that cancels the scheduled task
|
||||
* @private
|
||||
|
|
@ -266,6 +265,7 @@ type ScheduleCanceler = {
|
|||
*/
|
||||
cancel: CancelScheduledFn;
|
||||
};
|
||||
|
||||
/**
|
||||
* A stateful abstraction over Node.js & web browser timers that schedules a task
|
||||
* @private
|
||||
|
|
|
|||
Loading…
Reference in New Issue