GitLab API

GitlabTool

Actions905

Overview

This node interacts with the GitLab API to trigger pipelines for a specific merge request within a project. It is useful for automating CI/CD workflows by programmatically starting pipelines on merge requests, which helps in continuous integration and testing processes. For example, it can be used to trigger a pipeline when a merge request is created or updated to ensure code quality and integration.

Use Case Examples

  1. Trigger a pipeline for a merge request in a GitLab project to automate testing and deployment workflows.
  2. Start a CI pipeline on a specific merge request to validate changes before merging.

Properties

Name Meaning
Skip Authentication Option to skip API authentication, useful for public or unauthenticated requests.
Authentication Select the authentication method, typically an API key credential for GitLab.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the API request, default is GET but POST is used for triggering pipelines.
Path Parameters Parameters required in the API path to identify the project and merge request, including 'id' (project ID or URL-encoded path) and 'merge_request_iid' (internal ID of the merge request).

Output

JSON

  • id - The unique identifier of the triggered pipeline.
  • status - The current status of the pipeline (e.g., running, success, failed).
  • ref - The branch or tag name the pipeline is running against.
  • sha - The commit SHA the pipeline is associated with.
  • web_url - URL to view the pipeline in the GitLab web interface.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and merge request IID are correct and accessible with the provided credentials.
  • Verify that the GitLab API base URL is correct, especially if using a self-hosted GitLab instance.
  • Check that the API key has sufficient permissions to trigger pipelines on the specified project and merge request.
  • Common error messages include authentication failures (401 Unauthorized), resource not found (404 Not Found), and validation errors (400 Bad Request). Resolving these typically involves verifying credentials, project and merge request identifiers, and request payload.

Links

Discussion