feat(gitlab): add pipelines and jobs API support, including list/get/trigger/delete/retry/cancel operations, job controls, and related types and list options
This commit is contained in:
@@ -1,3 +1,52 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Common
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface ITestConnectionResult {
|
||||
ok: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface IListOptions {
|
||||
search?: string;
|
||||
page?: number;
|
||||
perPage?: number;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Pipeline / Job list options
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IPipelineListOptions extends IListOptions {
|
||||
/** Filter by pipeline status */
|
||||
status?: string;
|
||||
/** Filter by branch or tag ref */
|
||||
ref?: string;
|
||||
/** Filter by trigger source (push, web, trigger, schedule, api, external, pipeline, chat, merge_request_event, …) */
|
||||
source?: string;
|
||||
/** Filter by scope (running, pending, finished, branches, tags) */
|
||||
scope?: string;
|
||||
/** Filter by the user who triggered the pipeline */
|
||||
username?: string;
|
||||
/** Return pipelines updated after this ISO 8601 date */
|
||||
updatedAfter?: string;
|
||||
/** Return pipelines updated before this ISO 8601 date */
|
||||
updatedBefore?: string;
|
||||
/** Order by field (id, status, ref, updated_at, user_id). Default: id */
|
||||
orderBy?: string;
|
||||
/** Sort direction (asc, desc). Default: desc */
|
||||
sort?: string;
|
||||
}
|
||||
|
||||
export interface IJobListOptions extends IListOptions {
|
||||
/** Filter by job scope(s) */
|
||||
scope?: string[];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Users
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabUser {
|
||||
id: number;
|
||||
username: string;
|
||||
@@ -8,6 +57,10 @@ export interface IGitLabUser {
|
||||
state: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Projects
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabProject {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -20,6 +73,10 @@ export interface IGitLabProject {
|
||||
last_activity_at: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Groups
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabGroup {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -29,6 +86,10 @@ export interface IGitLabGroup {
|
||||
visibility: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabVariable {
|
||||
key: string;
|
||||
value: string;
|
||||
@@ -44,32 +105,133 @@ export interface IVariableOptions {
|
||||
environment_scope?: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Protected Branches
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabProtectedBranch {
|
||||
id: number;
|
||||
name: string;
|
||||
allow_force_push: boolean;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Pipelines
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabPipeline {
|
||||
id: number;
|
||||
iid: number;
|
||||
project_id: number;
|
||||
status: string;
|
||||
ref: string;
|
||||
sha: string;
|
||||
before_sha: string;
|
||||
tag: boolean;
|
||||
web_url: string;
|
||||
duration: number;
|
||||
queued_duration: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
started_at: string;
|
||||
finished_at: string;
|
||||
source: string;
|
||||
coverage: string;
|
||||
user: IGitLabUser;
|
||||
detailed_status: {
|
||||
icon: string;
|
||||
text: string;
|
||||
label: string;
|
||||
group: string;
|
||||
tooltip: string;
|
||||
has_details: boolean;
|
||||
details_path: string;
|
||||
favicon: string;
|
||||
};
|
||||
yaml_errors: string;
|
||||
}
|
||||
|
||||
export interface IGitLabPipelineVariable {
|
||||
key: string;
|
||||
value: string;
|
||||
variable_type: string;
|
||||
}
|
||||
|
||||
export interface IGitLabTestReport {
|
||||
total_time: number;
|
||||
total_count: number;
|
||||
success_count: number;
|
||||
failed_count: number;
|
||||
skipped_count: number;
|
||||
error_count: number;
|
||||
test_suites: IGitLabTestSuite[];
|
||||
}
|
||||
|
||||
export interface IGitLabTestSuite {
|
||||
name: string;
|
||||
total_time: number;
|
||||
total_count: number;
|
||||
success_count: number;
|
||||
failed_count: number;
|
||||
skipped_count: number;
|
||||
error_count: number;
|
||||
test_cases: IGitLabTestCase[];
|
||||
}
|
||||
|
||||
export interface IGitLabTestCase {
|
||||
status: string;
|
||||
name: string;
|
||||
classname: string;
|
||||
execution_time: number;
|
||||
system_output: string;
|
||||
stack_trace: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Jobs
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabJob {
|
||||
id: number;
|
||||
name: string;
|
||||
stage: string;
|
||||
status: string;
|
||||
ref: string;
|
||||
tag: boolean;
|
||||
web_url: string;
|
||||
created_at: string;
|
||||
started_at: string;
|
||||
finished_at: string;
|
||||
duration: number;
|
||||
queued_duration: number;
|
||||
coverage: number;
|
||||
allow_failure: boolean;
|
||||
failure_reason: string;
|
||||
pipeline: {
|
||||
id: number;
|
||||
project_id: number;
|
||||
ref: string;
|
||||
sha: string;
|
||||
status: string;
|
||||
};
|
||||
user: IGitLabUser;
|
||||
runner: {
|
||||
id: number;
|
||||
description: string;
|
||||
active: boolean;
|
||||
is_shared: boolean;
|
||||
};
|
||||
artifacts: {
|
||||
filename: string;
|
||||
size: number;
|
||||
}[];
|
||||
artifacts_expire_at: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Branches & Tags
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface IGitLabBranch {
|
||||
name: string;
|
||||
commit: {
|
||||
@@ -83,14 +245,3 @@ export interface IGitLabTag {
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ITestConnectionResult {
|
||||
ok: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface IListOptions {
|
||||
search?: string;
|
||||
page?: number;
|
||||
perPage?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user