मुख्य सामग्री पर जाएं

GitLab Toolkit

The GitLab toolkit lets EKB agents and workflows work with GitLab projects through a Personal Access Token (PAT). You can inspect projects, manage merge requests and issues, view branches and repository files, review commit history, and monitor CI/CD pipelines and jobs.

Prerequisites​

  • An active GitLab account on GitLab.com or a self-hosted GitLab instance.
  • Permission to create a GitLab Personal Access Token.
  • A Personal Access Token with the api scope.
  • Access to at least one GitLab project.
  • An EKB project where you can configure an agent or workflow.
  • GitLab permissions appropriate for the actions you intend to run.
warning

Never place the Personal Access Token in workflow inputs, prompts, screenshots, tickets, logs, or documentation. The toolkit does not grant additional GitLab permissions; all actions run with the access level of the account that owns the configured token.

Setup​

  1. Open GitLab

    Sign in to GitLab.com or your organization's self-hosted GitLab instance.

  2. Create a Personal Access Token

    Go to User Settings → Access Tokens, create a token with the api scope, and copy it securely.

  3. Identify a GitLab project

    Open the project you want to use. You can use its numeric project ID or URL-encoded project path. You can also use List Projects or Search Projects to find accessible projects.

  4. Add GitLab in EKB

    Open the required EKB agent or workflow, add the GitLab toolkit, and select a GitLab action.

  5. Create a GitLab connection

    Enter the GitLab Instance URL for self-hosted GitLab, then securely provide the Personal Access Token. Leave the Instance URL empty when using GitLab.com.

  6. Configure an action

    Start with List Projects to confirm access. Use the returned project ID in later actions such as Get Project, List Merge Requests, or List Issues.

  7. Run and verify

    Run the agent or workflow step and confirm that GitLab project data is returned successfully.

Available tools​

Project Management​

ToolDescription
List ProjectsLists projects accessible to the connected GitLab account.
Get ProjectReturns details for a GitLab project.
Search ProjectsSearches accessible GitLab projects by name or keyword.

Merge Request Management​

ToolDescription
List Merge RequestsLists merge requests in a project.
Get Merge RequestReturns details for a merge request.
Create Merge RequestCreates a merge request between two existing branches.
Get Merge Request DiffsReturns changed files and patch text for a merge request.
Get Merge Request CommitsReturns the commits included in a merge request.
Add Merge Request NoteAdds a general note to a merge request.

Issue Management​

ToolDescription
List IssuesLists issues in a project.
Get IssueReturns details for an issue.
Create IssueCreates an issue in a project.
Update IssueUpdates one or more fields on an existing issue.
Add Issue NoteAdds a general note to an issue.

Branch and File Management​

ToolDescription
List BranchesLists repository branches in a project.
Get File ContentReturns decoded text content for a repository file.
Get Commit HistoryLists project commits, optionally filtered by branch, tag, or file path.

CI/CD Pipelines​

ToolDescription
List PipelinesLists CI/CD pipelines in a project, newest first.
Get PipelineReturns details for a pipeline.
List Pipeline JobsLists jobs in a pipeline.

Use cases​

  • Find an accessible GitLab project and use its project ID in subsequent actions.
  • Review an open merge request by retrieving its details, diffs, and commits, then posting review feedback.
  • Create and update issues automatically from monitoring or deployment workflows.
  • Inspect repository branches, files, and commit history to understand recent changes.
  • Investigate failed CI/CD pipelines by identifying the pipeline, its status, and affected jobs.

Troubleshooting​

SymptomLikely causeFix
401 UnauthorizedThe Personal Access Token is invalid, expired, revoked, or incorrectly entered.Create a new GitLab Personal Access Token with the api scope, update the GitLab connection in EKB, and run List Projects to verify access.
403 ForbiddenThe token owner does not have permission for the requested action.Confirm that the GitLab account has access to the project and the required permissions for the action.
404 Project Not FoundThe project ID or project path is incorrect, or the token owner cannot access a private project.Run List Projects or Search Projects and use an accessible numeric project ID or full project path.
Merge request cannot be createdThe source or target branch does not exist, the branches are invalid, or the account lacks permission.Run List Branches to confirm the branch names and verify merge request permissions.
Merge request has conflictsThe source branch conflicts with the target branch.Run Get Merge Request and check has_conflicts. Resolve the conflict in GitLab and rerun the action if needed.
Issue cannot be created or updatedThe account lacks issue permissions, the project is incorrect, or no update values were supplied.Confirm project access. For Update Issue, provide at least one of title, description, state_event, or labels.
No projects returnedThe account has no accessible projects, or the project filter is too restrictive.Check the GitLab account and remove search, owned, or membership filters before running List Projects again.
No merge requests, issues, branches, or pipelines returnedThe project has no matching resources, the filter is too restrictive, or the project ID is incorrect.Confirm the project ID with Get Project and remove optional filters such as state, status, labels, assignee, or search.
File cannot be foundThe file path or reference is incorrect.Use the repository-relative file path and confirm the branch, tag, or commit SHA in ref.
Pipeline or pipeline job cannot be foundThe pipeline ID is incorrect or belongs to another project.Run List Pipelines for the same project and use the returned pipeline ID with List Pipeline Jobs.
Self-hosted GitLab connection failsThe GitLab Instance URL is incorrect, EKB cannot reach the instance, or its certificate is not trusted.Use the full HTTPS URL and confirm that EKB can reach the instance and its TLS certificate is valid.
Workflow step appears successful but GitLab action failedThe toolkit returns failures through the error value in the response.Check {{ step.output.error }} in the workflow and route the error to notification, retry, or manual review.
Rate limit or temporary GitLab API errorGitLab has throttled requests or the service is temporarily unavailable.Reduce request frequency, use pagination, wait before retrying, and avoid automatically repeating write actions that could create duplicates.