or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

additional-resources.mdcicd.mdclient-configuration.mdgroups.mdindex.mdissues.mdmerge-requests.mdpackage-registries.mdprojects.mdrepository-management.mdusers.md
tile.json

cicd.mddocs/

CI/CD

Comprehensive CI/CD operations including pipelines, jobs, runners, variables, schedules, triggers, and artifacts management.

Capabilities

Pipelines

Manage CI/CD pipelines including creation, cancellation, retry, and monitoring.

/**
 * Pipelines resource class for pipeline management
 */
class Pipelines<C extends boolean = false> {
  /**
   * List all pipelines for a project
   * @param projectId - Project ID or path
   * @param options - Filter and pagination options
   * @returns Array of pipelines
   */
  all<E extends boolean = false>(
    projectId: string | number,
    options?: AllPipelinesOptions & PaginationRequestOptions<'offset'> & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<PipelineSchema[], C, E, 'offset'>>;

  /**
   * Get details of a single pipeline
   * @param projectId - Project ID
   * @param pipelineId - Pipeline ID
   * @returns Pipeline details
   */
  show<E extends boolean = false>(
    projectId: string | number,
    pipelineId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<ExpandedPipelineSchema, C, E, void>>;

  /**
   * Create a new pipeline
   * @param projectId - Project ID
   * @param ref - Branch or tag name
   * @param options - Pipeline variables
   * @returns Created pipeline
   */
  create<E extends boolean = false>(
    projectId: string | number,
    ref: string,
    options?: { variables?: PipelineVariableSchema[] } & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<ExpandedPipelineSchema, C, E, void>>;

  /**
   * Retry a pipeline
   * @param projectId - Project ID
   * @param pipelineId - Pipeline ID
   * @returns Retried pipeline
   */
  retry<E extends boolean = false>(
    projectId: string | number,
    pipelineId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<ExpandedPipelineSchema, C, E, void>>;

  /**
   * Cancel a running pipeline
   * @param projectId - Project ID
   * @param pipelineId - Pipeline ID
   * @returns Cancelled pipeline
   */
  cancel<E extends boolean = false>(
    projectId: string | number,
    pipelineId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<ExpandedPipelineSchema, C, E, void>>;

  /**
   * Delete a pipeline
   * @param projectId - Project ID
   * @param pipelineId - Pipeline ID
   */
  remove<E extends boolean = false>(
    projectId: string | number,
    pipelineId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<void, C, E, void>>;

  /**
   * List variables used in a pipeline
   * @param projectId - Project ID
   * @param pipelineId - Pipeline ID
   * @returns Array of pipeline variables
   */
  allVariables<E extends boolean = false>(
    projectId: string | number,
    pipelineId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<PipelineVariableSchema[], C, E, void>>;
}

type AllPipelinesOptions = {
  /** Filter by scope */
  scope?: 'running' | 'pending' | 'finished' | 'branches' | 'tags';
  /** Filter by status */
  status?: 'pending' | 'running' | 'success' | 'failed' | 'canceled' | 'created'
    | 'waiting_for_resource' | 'preparing' | 'skipped' | 'manual' | 'scheduled';
  /** Filter by source */
  source?: string;
  /** Filter by ref (branch/tag) */
  ref?: string;
  /** Filter by commit SHA */
  sha?: string;
  /** Filter by YAML errors */
  yamlErrors?: boolean;
  /** Filter by username */
  username?: string;
  /** Updated after date */
  updatedAfter?: string;
  /** Updated before date */
  updatedBefore?: string;
  /** Order by field */
  orderBy?: 'id' | 'status' | 'updated_at' | 'user_id';
  /** Sort direction */
  sort?: 'asc' | 'desc';
};

Usage Examples:

import { Gitlab } from '@gitbeaker/rest';

const api = new Gitlab({ token: process.env.GITLAB_TOKEN });

// List all pipelines
const pipelines = await api.Pipelines.all(123, {
  status: 'running',
  ref: 'main'
});

// Get pipeline details
const pipeline = await api.Pipelines.show(123, 456);

// Create new pipeline with variables
const newPipeline = await api.Pipelines.create(123, 'main', {
  variables: [
    { key: 'ENVIRONMENT', value: 'production' },
    { key: 'DEBUG', value: 'false' }
  ]
});

// Retry failed pipeline
await api.Pipelines.retry(123, 456);

// Cancel running pipeline
await api.Pipelines.cancel(123, 456);

// List pipeline variables
const vars = await api.Pipelines.allVariables(123, 456);

Jobs

Manage CI/CD jobs including execution, cancellation, retry, and log retrieval.

/**
 * Jobs resource class for CI/CD job management
 */
class Jobs<C extends boolean = false> {
  /**
   * List jobs for a project or pipeline
   * @param projectId - Project ID
   * @param options - Filter options including optional pipelineId
   * @returns Array of jobs
   */
  all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
    projectId: string | number,
    options?: {
      pipelineId?: number;
      scope?: JobScope;
      includeRetried?: boolean;
    } & BaseRequestOptions<E> & PaginationRequestOptions<P>
  ): Promise<GitlabAPIResponse<JobSchema[], C, E, P>>;

  /**
   * Get details of a single job
   * @param projectId - Project ID
   * @param jobId - Job ID
   * @returns Job details
   */
  show<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<JobSchema, C, E, void>>;

  /**
   * Cancel a job
   * @param projectId - Project ID
   * @param jobId - Job ID
   * @returns Cancelled job
   */
  cancel<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<JobSchema, C, E, void>>;

  /**
   * Retry a job
   * @param projectId - Project ID
   * @param jobId - Job ID
   * @returns Retried job
   */
  retry<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<JobSchema, C, E, void>>;

  /**
   * Play/trigger a manual job
   * @param projectId - Project ID
   * @param jobId - Job ID
   * @param options - Optional job variables
   * @returns Started job
   */
  play<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    options?: { jobVariablesAttributes?: JobVariableAttributeOption[] } & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<JobSchema, C, E, void>>;

  /**
   * Erase a job (remove artifacts and trace)
   * @param projectId - Project ID
   * @param jobId - Job ID
   * @returns Erased job
   */
  erase<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<JobSchema, C, E, void>>;
}

type JobScope = 'created' | 'pending' | 'running' | 'failed' | 'success'
  | 'canceled' | 'skipped' | 'manual' | 'waiting_for_resource';

Usage Examples:

// List all jobs in a project
const jobs = await api.Jobs.all(123, {
  scope: 'failed'
});

// List jobs in a specific pipeline
const pipelineJobs = await api.Jobs.all(123, {
  pipelineId: 456
});

// Get job details
const job = await api.Jobs.show(123, 789);

// Retry failed job
await api.Jobs.retry(123, 789);

// Play manual job with variables
await api.Jobs.play(123, 789, {
  jobVariablesAttributes: [
    { key: 'DEPLOY_ENV', value: 'staging' }
  ]
});

// Cancel running job
await api.Jobs.cancel(123, 789);

// Erase job artifacts and logs
await api.Jobs.erase(123, 789);

Runners

Manage GitLab runners including registration, configuration, and assignment.

/**
 * Runners resource class for runner management
 */
class Runners<C extends boolean = false> {
  /**
   * List all runners (instance, group, or project level)
   * @param options - Filter options
   * @returns Array of runners
   */
  all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
    options?: OneOrNoneOf<{
      projectId: string | number;
      owned: boolean;
      groupId: string | number;
    }> & AllRunnersOptions & BaseRequestOptions<E> & PaginationRequestOptions<P>
  ): Promise<GitlabAPIResponse<RunnerSchema[], C, E, P>>;

  /**
   * Get details of a single runner
   * @param runnerId - Runner ID
   * @returns Runner details
   */
  show<E extends boolean = false>(
    runnerId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<ExpandedRunnerSchema, C, E, void>>;

  /**
   * Update a runner
   * @param runnerId - Runner ID
   * @param options - Fields to update
   * @returns Updated runner
   */
  edit<E extends boolean = false>(
    runnerId: number,
    options?: EditRunnerOptions & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<ExpandedRunnerSchema, C, E, void>>;

  /**
   * Delete a runner
   * @param runnerId - Runner ID
   */
  remove<E extends boolean = false>(
    runnerId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<void, C, E, void>>;
}

type AllRunnersOptions = {
  /** Filter by runner type */
  type?: 'instance_type' | 'group_type' | 'project_type';
  /** Filter by status */
  status?: 'online' | 'offline' | 'stale' | 'never_contacted' | 'active' | 'paused';
  /** Filter paused runners */
  paused?: boolean;
  /** Filter by tags */
  tagList?: string[];
};

Usage Examples:

// List all instance runners
const runners = await api.Runners.all({
  type: 'instance_type',
  status: 'online'
});

// List project runners
const projectRunners = await api.Runners.all({
  projectId: 123
});

// Get runner details
const runner = await api.Runners.show(456);

// Update runner
await api.Runners.edit(456, {
  description: 'Production runner',
  tagList: ['docker', 'production'],
  locked: true
});

// Remove runner
await api.Runners.remove(456);

Pipeline Schedules

Create and manage scheduled pipeline runs.

/**
 * PipelineSchedules resource class
 */
class PipelineSchedules<C extends boolean = false> {
  /**
   * List all pipeline schedules for a project
   */
  all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
    projectId: string | number,
    options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<PipelineScheduleSchema[], C, E, P>>;

  /**
   * Get a single pipeline schedule
   */
  show<E extends boolean = false>(
    projectId: string | number,
    scheduleId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<ExpandedPipelineScheduleSchema, C, E, void>>;

  /**
   * Create a new pipeline schedule
   */
  create<E extends boolean = false>(
    projectId: string | number,
    description: string,
    ref: string,
    cron: string,
    options?: CreatePipelineScheduleOptions & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<PipelineScheduleSchema, C, E, void>>;

  /**
   * Update a pipeline schedule
   */
  edit<E extends boolean = false>(
    projectId: string | number,
    scheduleId: number,
    options?: EditPipelineScheduleOptions & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<PipelineScheduleSchema, C, E, void>>;

  /**
   * Delete a pipeline schedule
   */
  remove<E extends boolean = false>(
    projectId: string | number,
    scheduleId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<void, C, E, void>>;

  /**
   * Play a pipeline schedule immediately
   */
  play<E extends boolean = false>(
    projectId: string | number,
    scheduleId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<{ message: string }, C, E, void>>;
}

Usage Examples:

// Create nightly build schedule
const schedule = await api.PipelineSchedules.create(
  123,
  'Nightly build',
  'main',
  '0 2 * * *', // 2 AM daily
  {
    cronTimezone: 'America/New_York',
    active: true
  }
});

// List schedules
const schedules = await api.PipelineSchedules.all(123);

// Update schedule
await api.PipelineSchedules.edit(123, 456, {
  description: 'Updated nightly build',
  cron: '0 3 * * *'
});

// Trigger schedule immediately
await api.PipelineSchedules.play(123, 456);

Pipeline Trigger Tokens

Manage pipeline trigger tokens for external integrations.

/**
 * PipelineTriggerTokens resource class
 */
class PipelineTriggerTokens<C extends boolean = false> {
  /**
   * List all trigger tokens
   */
  all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
    projectId: string | number,
    options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<TriggerSchema[], C, E, P>>;

  /**
   * Create a new trigger token
   */
  create<E extends boolean = false>(
    projectId: string | number,
    description: string,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<TriggerSchema, C, E, void>>;

  /**
   * Update a trigger token
   */
  edit<E extends boolean = false>(
    projectId: string | number,
    triggerId: number,
    options?: { description?: string } & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<TriggerSchema, C, E, void>>;

  /**
   * Delete a trigger token
   */
  remove<E extends boolean = false>(
    projectId: string | number,
    triggerId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<void, C, E, void>>;
}

Project Variables

Manage CI/CD variables at project level.

/**
 * ProjectVariables resource class
 */
class ProjectVariables<C extends boolean = false> {
  /**
   * List all project variables
   */
  all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
    projectId: string | number,
    options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<VariableSchema[], C, E, P>>;

  /**
   * Create a new project variable
   */
  create<E extends boolean = false>(
    projectId: string | number,
    key: string,
    value: string,
    options?: CreateVariableOptions & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<VariableSchema, C, E, void>>;

  /**
   * Update a project variable
   */
  edit<E extends boolean = false>(
    projectId: string | number,
    key: string,
    value: string,
    options?: EditVariableOptions & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<VariableSchema, C, E, void>>;

  /**
   * Delete a project variable
   */
  remove<E extends boolean = false>(
    projectId: string | number,
    key: string,
    options?: { filter?: { environmentScope?: string } } & Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<void, C, E, void>>;
}

Usage Examples:

// Create variable
await api.ProjectVariables.create(123, 'API_KEY', 'secret-value', {
  protected: true,
  masked: true,
  environmentScope: 'production'
});

// List variables
const vars = await api.ProjectVariables.all(123);

// Update variable
await api.ProjectVariables.edit(123, 'API_KEY', 'new-secret-value', {
  protected: true
});

// Delete variable
await api.ProjectVariables.remove(123, 'API_KEY');

Job Artifacts

Manage and download job artifacts.

/**
 * JobArtifacts resource class
 */
class JobArtifacts<C extends boolean = false> {
  /**
   * Download artifacts archive
   */
  download<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<Blob, void, E, void>>;

  /**
   * Download single artifact file
   */
  downloadSingle<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    artifactPath: string,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<Blob, void, E, void>>;

  /**
   * Delete artifacts
   */
  remove<E extends boolean = false>(
    projectId: string | number,
    jobId: number,
    options?: Sudo & ShowExpanded<E>
  ): Promise<GitlabAPIResponse<void, C, E, void>>;
}

Usage Examples:

// Download all artifacts
const artifacts = await api.JobArtifacts.download(123, 456);

// Download specific file
const file = await api.JobArtifacts.downloadSingle(123, 456, 'build/output.tar.gz');

// Delete artifacts
await api.JobArtifacts.remove(123, 456);

Related CI/CD Resources

Additional CI/CD resources for advanced configuration:

Variables and Configuration

  • GroupVariables - Group-level CI/CD variables
  • InstanceLevelCICDVariables - Instance-wide CI/CD variables
  • PipelineScheduleVariables - Variables for scheduled pipelines

Resource Management

  • ResourceGroups - CI/CD resource groups for controlling concurrency
  • SecureFiles - Secure file storage for CI/CD (certificates, etc.)

Security and Compliance

  • ProjectJobTokenScopes - Job token access scope configuration
  • ExternalStatusChecks - External merge request status checks

See Additional Resources for detailed documentation of these resource classes.