GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation allows users to create or add CI/CD variables to a specific GitLab project by making a POST request to the GitLab API endpoint `/api/v4/projects/{id}/variables`. It is useful for automating the management of project-level environment variables in GitLab CI/CD pipelines, such as setting secrets or configuration values programmatically.

Use Case Examples

  1. Automatically add or update CI/CD variables for a GitLab project during a deployment workflow.
  2. Manage project variables in GitLab for different environments (e.g., staging, production) via automation.

Properties

Name Meaning
Skip Authentication Option to skip API authentication for the request.
baseUrl 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 project ID or URL-encoded namespace/project name.

Output

JSON

  • id - The unique identifier of the created CI variable.
  • key - The key/name of the CI variable.
  • value - The value assigned to the CI 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 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 authentication credential

Troubleshooting

  • Ensure the project ID or namespace/project name is correctly URL-encoded and valid.
  • Verify that the API authentication token has sufficient permissions to create variables in the target project.
  • Check that the request body includes all required fields for the variable creation as per GitLab API specifications.
  • Common errors include authentication failures, invalid project ID, or missing required parameters in the request body.

Links

Discussion