GitLab API

GitlabTool

Actions1000

Overview

This node operation allows creating a new CI/CD variable for a specific GitLab group by sending a POST request to the GitLab API endpoint `/api/v4/groups/{id}/variables`. It is useful for automating the management of group-level CI/CD variables in GitLab, such as setting environment variables for pipelines.

Use Case Examples

  1. Automate adding a new CI/CD variable to a GitLab group to manage pipeline secrets.
  2. Integrate with a CI/CD workflow to dynamically update group variables based on deployment environments.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public or unauthenticated API calls.
Authentication Selects 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 to be included in the request path, specifically the group ID for this operation.

Output

JSON

  • id - The ID of the created CI variable.
  • key - The key/name of the CI variable.
  • value - The value assigned to the CI variable.
  • variable_type - The 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 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 group ID path parameter is correctly provided and URL-encoded if necessary.
  • Verify that the authentication credentials are valid and have sufficient permissions to create group variables.
  • Check the request body schema to ensure all required fields for the variable creation are included and correctly formatted.
  • Common error messages include 401 Unauthorized (authentication failure), 404 Not Found (invalid group ID), and 400 Bad Request (invalid variable data). Resolving these involves correcting credentials, verifying group existence, and validating input data respectively.

Links

Discussion