stubbing inspection api

pull/437/head
Frostebite 2022-10-18 23:39:20 +01:00
parent a8130252fe
commit 0b538311f0
7 changed files with 92 additions and 6 deletions

View File

@ -111,6 +111,60 @@ export class Cli {
return await CloudRunner.run(buildParameter, baseImage.toString());
}
@CliFunction(`gc`, `runs garbage collection`)
public static async GarbageCollect(): Promise<string> {
const buildParameter = await BuildParameters.create();
await CloudRunner.setup(buildParameter);
return await CloudRunner.Provider.garbageCollect(``, false, 0, false, false);
}
@CliFunction(`list-resources`, `runs garbage collection`)
public static async ListResources(): Promise<string[]> {
const buildParameter = await BuildParameters.create();
await CloudRunner.setup(buildParameter);
return await CloudRunner.Provider.listResources();
}
@CliFunction(`list-worfklow`, `runs garbage collection`)
public static async ListWorfklow(): Promise<string[]> {
const buildParameter = await BuildParameters.create();
await CloudRunner.setup(buildParameter);
return await CloudRunner.Provider.listWorkflow();
}
@CliFunction(`watch`, `runs garbage collection`)
public static async Watch(): Promise<string> {
const buildParameter = await BuildParameters.create();
await CloudRunner.setup(buildParameter);
return await CloudRunner.Provider.watchWorkflow();
}
@CliFunction(`inspect-resource`, `runs garbage collection`)
public static async InspectResource(): Promise<string> {
const buildParameter = await BuildParameters.create();
await CloudRunner.setup(buildParameter);
return await CloudRunner.Provider.inspectResources();
}
@CliFunction(`inspect-workflow`, `runs garbage collection`)
public static async InspectWorkflow(): Promise<string> {
const buildParameter = await BuildParameters.create();
await CloudRunner.setup(buildParameter);
return await CloudRunner.Provider.inspectWorkflow();
}
@CliFunction(`remote-cli-post-build`, `runs a cloud runner build`)
public static async PostCLIBuild(): Promise<string> {
core.info(`Running POST build tasks`);

View File

@ -20,6 +20,12 @@ class AWSBuildEnvironment implements ProviderInterface {
constructor(buildParameters: BuildParameters) {
this.baseStackName = buildParameters.awsBaseStackName;
}
listWorkflow(): Promise<string[]> {
throw new Error('Method not implemented.');
}
inspectWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
async inspectResources(): Promise<string> {
return await TaskService.awsDescribeJob('');
}
@ -60,7 +66,7 @@ class AWSBuildEnvironment implements ProviderInterface {
await AwsCliCommands.awsListTasks();
await AwsCliCommands.awsListLogGroups();
return '';
return [];
}
async cleanupWorkflow(

View File

@ -11,13 +11,19 @@ import CloudRunner from '../../cloud-runner';
class LocalDockerCloudRunner implements ProviderInterface {
public buildParameters: BuildParameters | undefined;
listWorkflow(): Promise<string[]> {
throw new Error('Method not implemented.');
}
inspectWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
inspectResources(): Promise<string> {
throw new Error('Method not implemented.');
}
watchWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
listResources(): Promise<string> {
listResources(): Promise<string[]> {
throw new Error('Method not implemented.');
}
garbageCollect(

View File

@ -39,13 +39,19 @@ class Kubernetes implements ProviderInterface {
this.namespace = 'default';
this.buildParameters = buildParameters;
}
listWorkflow(): Promise<string[]> {
throw new Error('Method not implemented.');
}
inspectWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
inspectResources(): Promise<string> {
throw new Error('Method not implemented.');
}
watchWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
listResources(): Promise<string> {
listResources(): Promise<string[]> {
throw new Error('Method not implemented.');
}
garbageCollect(

View File

@ -6,13 +6,19 @@ import { ProviderInterface } from '../provider-interface';
import CloudRunnerSecret from '../../services/cloud-runner-secret';
class LocalCloudRunner implements ProviderInterface {
listWorkflow(): Promise<string[]> {
throw new Error('Method not implemented.');
}
inspectWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
inspectResources(): Promise<string> {
throw new Error('Method not implemented.');
}
watchWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
listResources(): Promise<string> {
listResources(): Promise<string[]> {
throw new Error('Method not implemented.');
}
garbageCollect(

View File

@ -39,7 +39,6 @@ export interface ProviderInterface {
// eslint-disable-next-line no-unused-vars
secrets: CloudRunnerSecret[],
): Promise<string>;
listResources(): Promise<string>;
garbageCollect(
// eslint-disable-next-line no-unused-vars
filter: string,
@ -52,6 +51,9 @@ export interface ProviderInterface {
// eslint-disable-next-line no-unused-vars
baseDependencies: boolean,
): Promise<string>;
listResources(): Promise<string[]>;
inspectResources(): Promise<string>;
listWorkflow(): Promise<string[]>;
inspectWorkflow(): Promise<string>;
watchWorkflow(): Promise<string>;
}

View File

@ -5,13 +5,19 @@ import { ProviderInterface } from '../provider-interface';
import CloudRunnerSecret from '../../services/cloud-runner-secret';
class TestCloudRunner implements ProviderInterface {
listWorkflow(): Promise<string[]> {
throw new Error('Method not implemented.');
}
inspectWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
inspectResources(): Promise<string> {
throw new Error('Method not implemented.');
}
watchWorkflow(): Promise<string> {
throw new Error('Method not implemented.');
}
listResources(): Promise<string> {
listResources(): Promise<string[]> {
throw new Error('Method not implemented.');
}
garbageCollect(