GitLab API

GitlabTool

Actions905

Overview

This node operation triggers a pipeline for a specific project in GitLab by making a POST request to the GitLab API endpoint `/api/v4/projects/{id}/pipeline`. It is useful for automating CI/CD workflows by programmatically starting pipelines for projects based on their ID or URL-encoded path. For example, it can be used to trigger a build or deployment pipeline after code changes are pushed.

Use Case Examples

  1. Trigger a pipeline for project ID 11 to start a CI/CD process automatically.
  2. Automate pipeline execution for multiple projects by iterating over project IDs and invoking this operation.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method used for the API request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance to which the API request is sent, defaulting to https://gitlab.com.
Method The HTTP method used for the API request, fixed to POST for this operation.
Path Parameters The path parameters for the API request, specifically the project ID or URL-encoded path required to identify the project for which the pipeline is triggered.

Output

JSON

  • id - The ID of the triggered pipeline.
  • status - The status of the triggered pipeline.
  • ref - The branch or tag ref for which the pipeline was triggered.
  • sha - The commit SHA associated with the pipeline.
  • web_url - The URL to view the pipeline in GitLab.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or URL-encoded path is correct and accessible with the provided authentication.
  • Verify that the GitLab API key credential is valid and has sufficient permissions to trigger pipelines.
  • Check the base URL to ensure it points to the correct GitLab instance if using a self-hosted GitLab server.
  • Common error messages include 401 Unauthorized (invalid or missing API key), 404 Not Found (invalid project ID), and 400 Bad Request (invalid request body). Resolving these involves correcting credentials, project ID, or request parameters.

Links

Discussion