GitLab API

GitlabTool

Actions1000

Overview

This node operation retrieves CI/CD variables for a specific GitLab group using the GitLab API. It is useful for DevOps engineers and developers who need to programmatically access or manage group-level CI/CD variables in GitLab for automation, auditing, or integration purposes. For example, it can be used to fetch environment variables that control pipeline behavior in a GitLab group.

Use Case Examples

  1. Fetch CI/CD variables for a GitLab group to audit or update pipeline configurations.
  2. Integrate with a CI/CD system to dynamically retrieve group variables before running jobs.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public or unauthenticated access scenarios.
Authentication Specifies the authentication method to use, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance to connect to, default is https://gitlab.com.
Method HTTP method to use for the API request, default is GET.
Query Parameters Optional query parameters to control pagination of results, including 'page' for the current page number and 'per_page' for the number of items per page.
Path Parameters Path parameters required for the API endpoint, specifically the 'id' of the group or URL-encoded path of the group owned by the authenticated user.

Output

JSON

  • id - The unique identifier of the CI variable.
  • key - The key/name of the CI variable.
  • value - The value of the CI variable.
  • 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.
  • environment_scope - The environment scope where the variable is applied.
  • created_at - Timestamp when the variable was created.
  • updated_at - Timestamp when the variable was last updated.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the 'id' path parameter is correctly set to the group ID or URL-encoded path; otherwise, the API will return an error.
  • Check that the GitLab API key credential is valid and has sufficient permissions to access group variables.
  • If pagination parameters ('page' and 'per_page') are used, verify they are within valid ranges to avoid empty or partial results.
  • Common error messages include 401 Unauthorized (invalid or missing API key), 404 Not Found (invalid group ID), and 403 Forbidden (insufficient permissions). Resolving these involves verifying credentials, group ID, and user permissions.

Links

Discussion