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