GitLab API

GitlabTool

Actions1000

Overview

This node operation triggers a pipeline for a specific merge request in a GitLab project using the GitLab API. It is useful for automating CI/CD workflows by programmatically starting pipelines associated with merge requests. For example, it can be used to initiate testing or deployment pipelines whenever a merge request is created or updated.

Use Case Examples

  1. Trigger a pipeline for a merge request in a GitLab project to automate testing.
  2. Start a deployment pipeline for a merge request after code review approval.

Properties

Name Meaning
Skip Authentication Option to skip API authentication for the request.
Authentication Type of authentication used for the API request, defaulting to GitLab API key.
baseUrl Base URL of the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the API request, default is GET but can be POST, PUT, DELETE, HEAD, or PATCH.
Path Parameters Parameters for the API path including the project ID and merge request IID.

Output

JSON

  • id - The ID of the triggered pipeline.
  • status - The status of the pipeline (e.g., running, pending, success).
  • ref - The branch or tag name the pipeline is running for.
  • sha - The commit SHA the pipeline is associated with.
  • web_url - URL to view the pipeline in GitLab.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and merge request IID are correctly provided and URL-encoded if necessary.
  • Verify that the API key has sufficient permissions to trigger pipelines on the project.
  • Check the base URL is correct for your GitLab instance, especially if using a self-hosted GitLab.
  • Common error messages include authentication failures (401 Unauthorized) and resource not found (404) if the project or merge request does not exist.

Links

Discussion