GitLab API

GitlabTool

Actions1000

Overview

This node operation cancels a specific job within a GitLab project by sending a POST request to the GitLab API endpoint `/api/v4/projects/{id}/jobs/{job_id}/cancel`. It is useful for automating the cancellation of running or pending jobs in CI/CD pipelines within GitLab projects. For example, it can be used to stop a job that is no longer needed or to manage job workflows programmatically.

Use Case Examples

  1. Cancel a running CI job in a GitLab project by specifying the project ID and job ID.
  2. Automate job management in GitLab pipelines by cancelling jobs based on certain conditions.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public or unauthenticated API calls.
Authentication Specifies the authentication method to use, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the request, default is GET but POST is used for this operation.
Path Parameters Parameters required in the URL path to identify the project and job to cancel.

Output

JSON

  • status - The status of the job after the cancellation request
  • id - The ID of the job that was cancelled
  • project_id - The ID of the project containing the job
  • canceled_at - Timestamp when the job was cancelled

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the job_id and project id are correct and exist in the GitLab instance.
  • Authentication errors may occur if the API key is missing or invalid; verify credentials.
  • The job may not be cancellable if it is already completed or in a state that does not allow cancellation.

Links

Discussion