GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation allows users to create package protection rules for a specific project in GitLab via the GitLab API. It is useful for managing access control and security settings related to package usage within a project. For example, a user can define rules that restrict who can publish or install packages in a project repository.

Use Case Examples

  1. Creating a package protection rule to restrict package publishing to certain user roles in a GitLab project.
  2. Automating the setup of package protection rules as part of a CI/CD pipeline to enforce security policies.

Properties

Name Meaning
Skip Authentication Determines whether to skip authentication for the API request.
Authentication Specifies the authentication method to use for the API request, typically a GitLab API key.
baseUrl The base URL of the GitLab instance to which the API request is sent.
Method The HTTP method used for the API request, defaulting to GET but can be set to POST, PUT, DELETE, HEAD, or PATCH.
Path Parameters Parameters included in the API request path, specifically the project ID or URL-encoded path to identify the project for which the package protection rule is created.

Output

JSON

  • id - The unique identifier of the created package protection rule.
  • name - The name of the package protection rule.
  • project_id - The ID of the project to which the rule applies.
  • created_at - Timestamp when the rule was created.
  • updated_at - Timestamp when the rule was last updated.
  • access_level - The access level required to use the package according to the protection rule.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID provided in the path parameters is correct and accessible with the authenticated user.
  • Verify that the authentication credentials (GitLab API key) are valid and have sufficient permissions to create package protection rules.
  • Check the base URL to ensure it points to the correct GitLab instance, especially if using a self-hosted GitLab server.
  • Common error messages include 401 Unauthorized (authentication failure), 404 Not Found (invalid project ID), and 400 Bad Request (invalid request body). Resolving these involves correcting credentials, project ID, or request payload respectively.

Links

Discussion