GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node interacts with the GitLab API to create a new variable in a specified group using the POST method on the endpoint `/api/v4/groups/{id}/variables`. It is useful for automating the management of group-level CI/CD variables in GitLab, allowing users to programmatically add variables to groups for use in pipelines and other automation tasks.

Use Case Examples

  1. Automate adding CI/CD variables to GitLab groups during deployment processes.
  2. Manage group variables dynamically based on environment or project needs.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, default is false meaning authentication is used.
Authentication Type of authentication used, here it is GitLab API authentication.
baseUrl Base URL for the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the request, default is GET but for this operation it is POST.
Parameter Schema Defines the parameters for the API call, including the group ID in the path and the request body schema for the variable to be created.
Request Body Schema Schema for the request body containing the variable details to be created.
Request Path API endpoint path for creating a group variable, with a placeholder for the group ID.
Path Parameters Collection of path parameters, specifically the group ID required to identify the target group for the variable.

Output

JSON

  • id - The unique identifier of the created variable.
  • key - The key/name of the variable.
  • value - The value assigned to the variable.
  • variable_type - Type of the variable (e.g., env_var).
  • protected - Indicates if the variable is protected.
  • masked - Indicates if the variable is masked.
  • environment_scope - The environment scope the variable applies to.

Dependencies

  • GitLab API authentication credential

Troubleshooting

  • Ensure the group ID provided in the path parameters is correct and accessible by the authenticated user.
  • Verify that the request body contains all required fields as per the variable schema.
  • Check that the authentication credentials are valid and have sufficient permissions to create group variables.
  • Common error messages include 401 Unauthorized (authentication issues), 404 Not Found (invalid group ID), and 400 Bad Request (invalid request body). Resolving these involves correcting credentials, verifying group ID, and ensuring request body validity respectively.

Links

Discussion