GitLab API

GitlabTool

Actions1000

Overview

This node operation retrieves a specific CI/CD variable from a GitLab project using the GitLab API. It is useful for automation workflows that need to access project-specific environment variables, such as deployment scripts or CI/CD pipeline configurations. For example, it can fetch a variable by its key from a project identified by its ID or namespace/project name.

Use Case Examples

  1. Fetch a CI/CD variable named 'DATABASE_URL' from a project with ID '12345' to use its value in a deployment workflow.
  2. Retrieve environment-specific variables by filtering with the environment scope to customize pipeline behavior.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public or unauthenticated API access.
Authentication Type of authentication used, defaulting to GitLab API key authentication.
baseUrl Base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the API request, default is GET.
Query Parameters Optional query parameters for the request, including environment scope filter.
Path Parameters Required path parameters identifying the project and variable key.

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_type - The type of the variable (e.g., env_var, file)
  • protected - Indicates if the variable is protected
  • masked - Indicates if the variable is masked
  • raw - Indicates if the variable is raw or processed

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or namespace/project name is correctly URL-encoded and valid.
  • Verify that the variable key exists in the specified project and that the authenticated user has permission to access it.
  • Check that the base URL is correct for the GitLab instance being accessed.
  • If skipping authentication, ensure the API endpoint allows unauthenticated access, otherwise authentication errors will occur.
  • Common error messages include 404 Not Found if the project or variable key does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion