GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves a specific variable from a GitLab project using the GitLab API v4. It is useful for automating workflows that require access to project-level variables, such as CI/CD pipeline configurations or environment-specific settings. For example, it can fetch a variable by its key from a project identified by its ID or namespace/project name, optionally filtered by environment scope.

Use Case Examples

  1. Fetch a CI/CD variable named 'API_TOKEN' from a project with ID '12345' to use in a deployment workflow.
  2. Retrieve environment-specific configuration variables for a project to dynamically adjust pipeline behavior.

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, defaulting to https://gitlab.com.
Method The HTTP method used for the API request, defaulting to GET.
Query Parameters Optional query parameters for the API request, including environment scope filter.
Path Parameters Path parameters specifying the project ID or namespace/project name and the variable key to retrieve.

Output

JSON

  • id - The ID of the project or namespace/project name used in the request path.
  • key - The key of the variable requested.
  • value - The value of the variable retrieved from the project.
  • environment_scope - The environment scope of the variable, if specified.
  • variable_details - Additional details about the variable as returned by the GitLab API.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or namespace/project name and variable key are correctly specified; incorrect values will result in errors or no data.
  • Verify that the API key credential has sufficient permissions to access the project and its variables.
  • If filtering by environment scope, confirm the environment scope value matches exactly as defined in the project variables.
  • Common error messages include 404 Not Found if the project or variable key does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion