GitLab API

GitlabTool

Actions905

Overview

This node operation allows users to create a new registry protection repository rule for a specific project in GitLab. It is useful for automating the management of container registry access rules within GitLab projects, ensuring that repository protection rules are programmatically enforced. For example, a DevOps engineer can use this node to add protection rules to a project's container registry to control who can push or pull images.

Use Case Examples

  1. Creating a new registry protection rule for a project to restrict access to certain users or groups.
  2. Automating the setup of container registry rules as part of a CI/CD pipeline.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method used for the API request, typically an API key credential for GitLab.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method to use for the request, default is POST for this operation.
Path Parameters Parameters included in the request path, specifically the project ID or URL-encoded path to identify the project for which the registry protection rule is created.

Output

JSON

  • id - The unique identifier of the created registry protection repository rule.
  • project_id - The ID of the project to which the rule applies.
  • name - The name of the registry protection rule.
  • created_at - Timestamp when the rule was created.
  • updated_at - Timestamp when the rule was last updated.
  • access_level - The access level required to interact with the protected repository.

Dependencies

  • GitLab API authentication credential

Troubleshooting

  • Ensure the project ID provided in the path parameters is correct and accessible with the authenticated user.
  • Verify that the authentication credentials (API key) are valid and have sufficient permissions to create registry protection rules.
  • Check the request body schema to ensure all required fields for the registry protection rule are included and correctly formatted.
  • Common error messages include 401 Unauthorized (invalid or missing authentication), 404 Not Found (project ID does not exist), and 400 Bad Request (invalid request body). Resolving these involves correcting credentials, verifying project existence, and validating request data respectively.

Links

Discussion