GitLab API

GitlabTool

Actions1000

Overview

This node operation retrieves jobs from a specific pipeline within a GitLab project using the GitLab API. It is useful for scenarios where you need to monitor or analyze the status and details of jobs in a CI/CD pipeline, such as checking job outcomes, filtering jobs by status, or paginating through job results.

Use Case Examples

  1. Fetch all jobs for a given pipeline in a project to monitor CI/CD progress.
  2. Filter jobs by status (e.g., running or failed) to identify issues in the pipeline.
  3. Paginate through jobs to handle large pipelines with many jobs.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public projects or testing.
Authentication Type of authentication used, defaulting to GitLab API key authentication.
baseUrl Base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the request, defaulting to GET.
Query Parameters Optional query parameters to filter and paginate the jobs list.
Path Parameters Required path parameters identifying the project and pipeline.

Output

JSON

  • id - Job ID
  • status - Current status of the job
  • stage - Pipeline stage the job belongs to
  • name - Name of the job
  • ref - Git reference (branch or tag) associated with the job
  • tag - Indicates if the job is tagged
  • coverage - Code coverage percentage reported by the job
  • created_at - Timestamp when the job was created
  • started_at - Timestamp when the job started
  • finished_at - Timestamp when the job finished
  • duration - Duration of the job execution
  • queued_duration - Time the job spent in the queue
  • user
    • id - ID of the user who triggered the job
    • name - Name of the user who triggered the job
    • username - Username of the user who triggered the job
    • state - State of the user who triggered the job
    • avatar_url - Avatar URL of the user who triggered the job
    • web_url - Web URL of the user who triggered the job
  • pipeline
    • id - ID of the pipeline the job belongs to
    • ref - Git reference of the pipeline
    • sha - SHA hash of the commit associated with the pipeline
    • status - Status of the pipeline
    • web_url - Web URL of the pipeline
  • web_url - Web URL of the job

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and pipeline ID are correct and accessible with the provided authentication.
  • Check that the base URL is correct for your GitLab instance, especially if using a self-hosted GitLab.
  • Verify that the authentication token has sufficient permissions to read pipeline jobs.
  • Common error messages include 404 Not Found if the project or pipeline does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion