1. Overview
Gitlab is a complete DevOps platform, delivered as a single application, that fundamentally changes how development, security, and operations teams collaborate. It provides a comprehensive suite of integrated tools for code hosting, version control, continuous integration/continuous deployment (CI/CD), project management, and more.
With GoInsight's Gitlab node, you can seamlessly integrate code repository and project management operations into your automated workflows. This enables you to build powerful automation processes around your code, issues, and release cycles, including:
- Issue Management: Automatically create, edit, get, and lock issues in projects.
- Release Management: Automate software releases, including creating, updating, deleting, and getting releases.
- Comment Interaction: Automatically create comments on specified issues for notifications or record-keeping.
- Repository Information Query: Get detailed information for a single repository or all repositories of a user, as well as list files within a repository.
2. Prerequisites
Before using this node, you need a valid Gitlab account. Access methods may differ depending on whether you are using gitlab.com or a self-hosted instance. You will also need to generate a Personal Access Token with the appropriate permissions (usually the api scope) to use as a credential.
3. Credentials
For a detailed guide on how to obtain and configure credentials, please refer to our official documentation: Credential Configuration Guide.
4. Supported Operations
Summary
This node primarily operates on core resources within Gitlab, such as Issues, Releases, Repositories, and Files.
Resource | Operation | Description |
---|---|---|
Issue | Create an Issue | Creates a new issue in a GitLab repository. |
Issue | Edit an Issue | Edits an existing issue in a GitLab repository. |
Issue | Get an Issue | Retrieves the details of an issue from a GitLab repository. |
Issue | Get Issues of a Repository | Retrieves a list of issues from a GitLab repository. |
Issue | Lock an Issue | Locks or unlocks the discussion on an issue in a GitLab repository. |
Issue Comment | Create a Comment On an Issue | Creates a comment on an issue in a GitLab repository. |
Release | Create a Release | Creates a new release in a GitLab repository. |
Release | Delete a Release | Deletes a release from a GitLab repository. |
Release | Get a Release | Retrieves a release from a GitLab repository. |
Release | Get Many Releases | Retrieves multiple releases from a GitLab repository. |
Release | Update a Release | Updates an existing release in a GitLab repository. |
Repository | Get a Repository | Retrieves details of a specific repository from GitLab. |
Repository | Get a User Repositories | Securely retrieves a list of personal repositories for the authorized user. |
File | List Files | Lists files in a GitLab repository. |
Operation Details
Create an Issue
Creates a new issue in a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- Title: The title of the issue.
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
- Description: The description content of the issue.
- Labels: Labels to add to the issue, separated by commas (e.g., 'bug,urgent').
Output:
- IssueId (number): The global ID of the created issue.
- IssueIid (number): The internal ID (iid) of the created issue.
- IssueTitle (string): The title of the created issue.
- IssueWebUrl (string): The web URL of the created issue.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Edit an Issue
Edits an existing issue in a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- IssueIid: The internal ID (iid) of the issue to edit.
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
- Title: The new title for the issue.
- Description: The new description content for the issue.
- State: The new state of the issue ('open' or 'close').
- Labels: The new set of labels for the issue, separated by commas.
Output:
- IssueId (number): The global ID of the updated issue.
- IssueIid (number): The internal ID (iid) of the updated issue.
- IssueTitle (string): The updated title of the issue.
- IssueDescription (string): The updated description of the issue.
- IssueState (string): The updated state of the issue.
- IssueWebUrl (string): The web URL of the updated issue.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Get an Issue
Retrieves the details of an issue from a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- IssueIid: The internal ID (iid) of the issue.
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
Output:
- IssueId (number): The global ID of the issue.
- IssueIid (number): The internal ID (iid) of the issue.
- IssueTitle (string): The title of the issue.
- IssueDescription (string): The description of the issue.
- IssueState (string): The state of the issue (e.g., 'opened').
- IssueWebUrl (string): The web URL of the issue.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Get Issues of a Repository
Retrieves a list of issues from a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
Output:
- Issues (object-array): A list of issues in the repository.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Lock an Issue
Locks or unlocks the discussion on an issue in a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- IssueIid: The internal ID (iid) of the issue to lock.
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
- Lock: Whether to lock (true) or unlock (false) the issue discussion.
Output:
- IssueId (number): The global ID of the issue.
- IssueIid (number): The internal ID (iid) of the issue.
- IssueTitle (string): The title of the issue.
- IssueLocked (bool): Whether the issue discussion has been locked.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Create a Comment On an Issue
Creates a comment on an issue in a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- IssueIid: The internal ID (iid) of the issue.
- CommentBody: The body/content of the comment.
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
Output:
- CommentId (number): The ID of the created comment.
- CommentBody (string): The body content of the created comment.
- CommentCreatedAt (string): The creation timestamp of the comment.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Create a Release
Creates a new release in a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- TagName: The tag name of the release (e.g., 'v1.0.0').
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
- ReleaseName: The name of the release.
- Description: The description of the release.
- Ref: The commit SHA or branch to tag (defaults to tag_name).
- AssetsLinks: Asset links and names, separated by commas (e.g., 'file.zip|https://example.com/file.zip').
Output:
- ReleaseTagName (string): The tag name of the created release.
- ReleaseName (string): The name of the created release.
- ReleaseUrl (string): The URL of the created release (or a message if no assets).
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Delete a Release
Deletes a release from a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- TagName: The tag name of the release to delete (e.g., 'v1.0.0').
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
Output:
- Success (bool): Whether the release was successfully deleted.
- DeletedTagName (string): The tag name of the deleted release.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Get a Release
Retrieves a release from a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- TagName: The tag name of the release to get (e.g., 'v1.0.0').
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
Output:
- ReleaseTagName (string): The tag name of the release.
- ReleaseName (string): The name of the release.
- ReleaseDescription (string): The description of the release.
- ReleaseCreatedAt (string): The creation timestamp of the release.
- Assets (object-array): A list of assets in the release.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Get Many Releases
Retrieves multiple releases from a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
- PerPage: The number of releases per page (max 100).
- Page: The page number to retrieve.
Output:
- Releases (object-array): A list of releases in the repository.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Update a Release
Updates an existing release in a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
- TagName: The tag name of the release to update (e.g., 'v1.0.0').
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
- ReleaseName: The new name for the release.
- Description: The new description for the release.
- AssetsLinks: Asset links and names to add/update, separated by commas (e.g., 'file.zip|https://example.com/file.zip').
Output:
- ReleaseTagName (string): The tag name of the updated release.
- ReleaseName (string): The name of the updated release.
- ReleaseDescription (string): The description of the updated release.
- Assets (object-array): The updated list of assets in the release.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Get a Repository
Retrieves details of a specific repository from GitLab.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
Output:
- RepositoryId (number): The ID of the repository.
- RepositoryName (string): The name of the repository.
- RepositoryWebUrl (string): The web URL of the repository.
- RepositoryDescription (string): The description of the repository.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
Get a User Repositories
Securely retrieves a list of personal repositories for the authorized user.
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
Output:
- Repositories (object-array): An array of objects representing the authorized user's personal repositories.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
List Files
Lists files in a GitLab repository.
Input Parameters:
- RepositoryId: The ID or path of the repository (e.g., 'group/project' or a numeric ID).
Options:
- GitlabUrl: The base URL of the GitLab instance (e.g., https://gitlab.com).
- Branch: The branch to list files from (e.g., 'main').
- Path: The path to list files from (e.g., 'docs/', leave empty for root).
Output:
- Files (object-array): A list of files in the repository path.
- StatusCode (number): The HTTP status code of the API request.
- ErrorMessage (string): Any error message that occurred during execution.
5. Example Usage
This section will guide you through creating a simple workflow to automatically create a new Issue in your GitLab project. This workflow can be triggered, for instance, when your monitoring system detects a bug.
Workflow Overview
A basic workflow consists of three nodes: Start -> Create an Issue -> Answer.
Step-by-Step Guide
- Add Tool Node:
- On the workflow canvas, click the "+" sign to add a new node.
- In the pop-up panel, select the "Tools" tab.
- Find and select Gitlab from the tool list.
- In the list of supported operations for Gitlab, click to select Create an Issue, which will add the corresponding node to the canvas.
- Configure the Node:
- Click on the newly added Create an Issue node, and its configuration panel will expand on the right.
- Credential Configuration: At the top of the panel, find the credential field. Click the dropdown menu and select your pre-configured Gitlab credential.
- Parameter Entry:
- RepositoryId: Fill in the ID of the repository where you want to create the Issue. This can be a numeric ID or in the format of username/project-name or organization-name/project-name, e.g., my-org/my-awesome-project.
- Title: Enter a clear title for the Issue you want to create, e.g., [BUG] User login page is slow to respond.
- (Optional) Description: In this field, you can describe the content of the Issue in detail, with Markdown support. For example, you can provide steps to reproduce, expected behavior, and actual behavior.
- (Optional) Labels: If you want to add labels to the Issue for categorization, you can enter them here, separated by commas, e.g., bug,performance,high-priority.
- Run and Validate:
- Once all required parameters are correctly filled in, the error prompt in the top right corner of the workflow canvas will disappear.
- Click the "Run" button in the top right corner of the canvas to execute the workflow.
- After successful execution, you can click the log icon in the top right corner to view the detailed input and output of the node. The output will contain the IssueId and IssueWebUrl of the newly created Issue. You can click the link to go directly to GitLab and verify that the operation was successful.
Final Workflow Display
After completing the steps above, your entire workflow is configured. Every time this workflow is triggered, a new Issue will be automatically created in your specified GitLab repository, greatly improving the efficiency of issue tracking.
6. FAQs
Q: Why do I keep getting 401 Unauthorized or 403 Forbidden errors?
A: This is usually related to your credentials (Personal Access Token). Please check the following:
- Token Validity: Ensure your Personal Access Token has not expired.
- Permission Scope: Check if you granted sufficient permissions when creating the token. For most operations, at least the api scope is required.
- Token Correctness: Confirm that the token you entered in the GoInsight credential configuration is complete and correct.
Q: How do I find my RepositoryId?
A: You have two ways to specify a repository:
- Path: The easiest way is to use the path from the URL, in the format group-name/project-name or user-name/project-name.
- Numeric ID: You can find a unique numeric ID on the project's settings page.
Q: What is the difference between IssueId and IssueIid?
A: This is an important concept in GitLab:
- IssueId: This is a globally unique ID across your entire GitLab instance.
- IssueIid: This is the Internal ID, which is unique within a single project and is incremental. It is usually displayed in the UI as #1, #2, etc. Most API operations (like editing, commenting) use the IssueIid to locate an issue within a specific project.
7. Official Documentation
For a more in-depth understanding of all available API endpoints and parameters, please consult the Gitlab Official API Documentation.
Leave a Reply.