GitLab API

GitlabTool

Actions1000

Overview

This node operation cancels a specific pipeline within a GitLab project by making a POST request to the GitLab API endpoint `/api/v4/projects/{id}/pipelines/{pipeline_id}/cancel`. It is useful for automating the cancellation of running or pending pipelines in CI/CD workflows, for example, to stop unnecessary builds or deployments.

Use Case Examples

  1. Cancel a running pipeline in a project to save resources.
  2. Automate pipeline management by cancelling pipelines based on certain conditions.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request.
Authentication Type of authentication used, default is GitLab API key.
baseUrl Base URL of the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the request, default is GET but POST is used for this operation.
Path Parameters Parameters for the API path including project ID and pipeline ID.

Output

JSON

  • id - The ID of the pipeline that was cancelled.
  • status - The status of the pipeline after cancellation.
  • ref - The branch or tag name associated with the pipeline.
  • sha - The commit SHA the pipeline is associated with.
  • web_url - The URL to view the pipeline in GitLab.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and pipeline ID are correct and exist in the GitLab instance.
  • Verify that the API key has sufficient permissions to cancel pipelines.
  • Check the base URL if using a self-hosted GitLab instance to ensure it is correct.
  • Common error: 404 Not Found - The project or pipeline ID does not exist or is inaccessible.
  • Common error: 401 Unauthorized - Authentication failed or API key is missing/invalid.

Links

Discussion