GitLab DevSecOps Platform
gitlab devsecops platform is a unified application for the entire software development lifecycle, integrating development, security, and operations gitlab is a comprehensive devsecops platform that enables teams to collaborate on code, manage projects, and automate ci/cd pipelines the gitlab devsecops platform connector allows swimlane turbine users to seamlessly integrate gitlab's robust version control and project management capabilities into their security automation workflows this integration empowers users to automate repository management, streamline code review processes, and enhance collaboration across development and security teams, ultimately improving the efficiency and effectiveness of devsecops practices prerequisites before you can use the gitlab devsecops platform connector for turbine, you'll need access to the gitlab api this requires the following an api key authentication using the following parameters url the base url of your gitlab instance private token a personal access token with appropriate permissions to interact with the gitlab api capabilities this connector provides the following capabilities get repo archive list repository tree create new file in repository get file list repository commits create a commit list branches create branch delete branch list merge requests get merge request create merge request delete merge request asset setup the gitlab asset requires an private token for authentication notes for more information on api documentation, check here https //docs gitlab com/ee/api/api resources html configurations gitlab private token authentication authenticates using a private token configuration parameters parameter description type required url a url to the target host string required private token private token not required if repo is publicly accessible string required verify ssl verify ssl certificate boolean optional http proxy a proxy to route requests through string optional actions create a commit create a commit in a gitlab project with file actions like create, delete, move, update, or chmod requires path parameters and json body including branch and commit message endpoint url api/v4/projects/{{id}}/repository/commits method post input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user branch string optional name of the branch to commit into to create a new branch, also provide either start branch or start sha commit message string optional commit message actions array optional an array of action hashes to commit as a batch actions action string required the action to perform create, delete, move, update, or chmod actions file path string required full path to the file for example lib/class rb actions content string optional file content, required for all except delete, chmod, and move actions encoding string optional text or base64 text is default actions execute filemode boolean optional enables or disables the execute flag on the file only considered for chmod action actions last commit id string optional last known file commit id only considered in update, move, and delete actions actions previous path string optional original full path to the file being moved only considered for move action allow empty boolean optional when true, creates an empty commit default is false author email string optional specify the commit author's email address author name string optional specify the commit author's name force boolean optional if true, overwrites branch with a new commit based on start branch or start sha default is false start branch string optional name of the branch to use as the parent for the new commit mutually exclusive with start sha start project string optional the project id or url encoded path of the project to use as the source for start branch or start sha start sha string optional sha of the commit to use as the parent for the new commit mutually exclusive with start branch stats boolean optional include commit stats default is true input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc"},"branch" "string","commit message" "string","actions" \[{"action" "string","file path" "string","content" "string","encoding" "string","execute filemode"\ true,"last commit id" "string","previous path" "string"}],"allow empty"\ true,"author email" "string","author name" "example name","force"\ true,"start branch" "string","start project" "string","start sha" "string","stats"\ true} output parameter type description status code number http status code of the response reason string response reason phrase id string sha of the created commit short id string short sha of the created commit title string title of the commit message author name string name of the commit author author email string email address of the commit author authored date string date when the commit was authored committer name string name of the commit committer committer email string email address of the commit committer committed date string date when the commit was committed created at string date when the commit was created message string full commit message parent ids array array of parent commit shas stats object statistics about the commit stats additions number output field stats additions stats deletions number output field stats deletions stats total number output field stats total status string status of the commit web url string web url of the commit output example {"id" "12345678 1234 1234 1234 123456789abc","short id" "string","title" "string","author name" "example name","author email" "string","authored date" "string","committer name" "example name","committer email" "string","committed date" "string","created at" "string","message" "string","parent ids" \["string"],"stats" {"additions" 123,"deletions" 123,"total" 123},"status" "active","web url" "string"} create branch create a new branch in a gitlab project repository using a specified branch name or commit sha requires project id, branch name, and reference endpoint url api/v4/projects/{{id}}/repository/branches method post input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user parameters branch string required name of the branch cannot contain spaces or special characters except hyphens and underscores parameters ref string required branch name or commit sha to create the branch from input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc"},"parameters" {"branch" "string","ref" "string"}} output parameter type description status code number http status code of the response reason string response reason phrase name string name of the branch merged boolean if true, the branch merged into the default branch protected boolean if true, the branch is protected from force pushes and deletion default boolean if true, the branch is the default branch for the project developers can push boolean if true, users with the developer role can push to this branch developers can merge boolean if true, users with the developer role can merge to this branch can push boolean if true, the authenticated user can push to this branch web url string url to view the branch in the gitlab ui commit object details about the latest commit on the branch commit id string full sha of the commit commit short id string abbreviated sha of the commit commit title string title of the commit message commit message string full commit message commit author name string name of the commit author commit author email string email address of the commit author commit authored date string date when the commit was authored commit committer name string name of the commit committer commit committer email string email address of the commit committer commit committed date string date when the commit was committed commit created at string date when the commit was created commit parent ids array array of parent commit shas commit web url string url to view the commit in the gitlab ui output example {"name" "example name","merged"\ true,"protected"\ true,"default"\ true,"developers can push"\ true,"developers can merge"\ true,"can push"\ true,"web url" "string","commit" {"id" "12345678 1234 1234 1234 123456789abc","short id" "string","title" "string","message" "string","author name" "example name","author email" "string","authored date" "string","committer name" "example name","committer email" "string","committed date" "string","created at" "string","parent ids" \["string"],"web url" "string"}} create merge request create a new merge request in gitlab from a source branch to a target branch requires project id, source branch, target branch, and title endpoint url api/v4/projects/{{id}}/merge requests method post input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user source branch string optional the source branch target branch string optional the target branch title string optional title of the merge request description string optional description of the merge request limited to 1,048,576 characters assignee id number optional assignee user id assignee ids array optional the ids of the users to assign the merge request to set to 0 or provide an empty value to unassign all assignees reviewer ids array optional the ids of the users added as reviewers if set to 0 or left empty, no reviewers are added labels string optional labels for the merge request, as a comma separated list milestone id number optional the global id of a milestone mutually exclusive with milestone milestone string optional the title of a project or ancestor group milestone mutually exclusive with milestone id remove source branch boolean optional flag indicating if a merge request should remove the source branch when merging allow collaboration boolean optional allow commits from members who can merge to the target branch squash boolean optional if true, squash all commits into a single commit on merge target project id number optional numeric id of the target project merge after string optional date after which the merge request can be merged input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc"},"source branch" "string","target branch" "string","title" "string","description" "string","assignee id" 123,"assignee ids" \[123],"reviewer ids" \[123],"labels" "string","milestone id" 123,"milestone" "string","remove source branch"\ true,"allow collaboration"\ true,"squash"\ true,"target project id" 123,"merge after" "string"} output parameter type description status code number http status code of the response reason string response reason phrase id number id of the merge request iid number internal id of the merge request project id number id of the project title string title of the merge request description string description of the merge request state string state of the merge request (opened, closed, merged, locked) created at string date when the merge request was created updated at string date when the merge request was last updated target branch string target branch of the merge request source branch string source branch of the merge request author object information about the merge request author assignee object information about the merge request assignee source project id number id of the source project target project id number id of the target project labels array labels associated with the merge request draft boolean if true, the merge request is a draft work in progress boolean if true, the merge request is set as work in progress merge status string merge status of the merge request sha string sha of the merge request merge commit sha string sha of the merge commit web url string web url of the merge request output example {"id" 123,"iid" 123,"project id" 123,"title" "string","description" "string","state" "string","created at" "string","updated at" "string","target branch" "string","source branch" "string","author" {},"assignee" {},"source project id" 123,"target project id" 123,"labels" \["string"]} create new file in repository create a new file in a specified gitlab repository using the provided branch, commit message, and content endpoint url api/v4/projects/{{id}}/repository/files/{{file path}} method post input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user path parameters file path string required url encoded full path to new file branch string optional name of the new branch to create the commit is added to this branch commit message string optional the commit message content string optional the files content author email string optional the commit authors email address author name string optional the commit authors name encoding string optional change encoding to base64 execute filemode boolean optional enables or disables the execute flag on the file start branch string optional name of the base branch to create the new branch from input example {"json body" {"branch" "main","commit message" "create a new file","content" "some content","author email" "author\@example com","author name" "firstname lastname","encoding" "text","execute filemode"\ false,"start branch" "new"},"path parameters" {"id" "13083","file path" "lib%2fclass%2erb"}} output parameter type description status code number http status code of the response reason string response reason phrase output example {"status code" 200,"reason" "ok","response headers" {},"json body" {}} delete branch delete a specified branch from a gitlab project repository using the branch name and project id the default branch and protected branches cannot be deleted endpoint url api/v4/projects/{{id}}/repository/branches/{{branch}} method delete input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user path parameters branch string required url encoded name of the branch cannot delete the default branch or protected branches input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc","branch" "string"}} output parameter type description status code number http status code of the response reason string response reason phrase response text string raw response body text, if any output example {"response text" "string"} delete merge request delete a merge request in a gitlab project using its internal id only administrators and project owners have the permission to perform this action endpoint url api/v4/projects/{{id}}/merge requests/{{merge request iid}} method delete input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user path parameters merge request iid string required the internal id of the merge request input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc","merge request iid" "string"}} output parameter type description status code number http status code of the response reason string response reason phrase response text string raw response body text, if any output example {"response text" "string"} get file retrieve file details from a gitlab repository, including name, size, and base64 encoded contents requires path parameters 'id' and 'file path', and parameter 'ref' endpoint url api/v4/projects/{{id}}/repository/files/{{file path}} method get input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user path parameters file path string required url encoded full path to the file, such as lib%2fclass%2erb parameters ref string required name of branch, tag, or commit use head to automatically use the default branch input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc","file path" "string"},"parameters" {"ref" "string"}} output parameter type description status code number http status code of the response reason string response reason phrase file name string name of the file file path string full path to the file size number size of the file in bytes encoding string encoding used for the file content content string base64 encoded file content content sha256 string sha256 hash of the file content ref string name of the branch, tag, or commit used blob id string blob sha commit id string commit sha for the file last commit id string sha of the last commit that modified this file execute filemode boolean if true, the execute flag is set on the file output example {"file name" "example name","file path" "string","size" 123,"encoding" "string","content" "string","content sha256" "string","ref" "string","blob id" "string","commit id" "string","last commit id" "string","execute filemode"\ true} get merge request retrieve information about a single merge request in a gitlab project using its internal id (iid) requires path parameters id and merge request iid endpoint url api/v4/projects/{{id}}/merge requests/{{merge request iid}} method get input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user path parameters merge request iid string required the internal id of the merge request parameters include diverged commits count boolean optional if true, response includes the commits behind the target branch parameters include rebase in progress boolean optional if true, response includes whether a rebase operation is in progress parameters render html boolean optional if true, response includes rendered html for title and description input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc","merge request iid" "string"},"parameters" {"include diverged commits count"\ true,"include rebase in progress"\ true,"render html"\ true}} output parameter type description status code number http status code of the response reason string response reason phrase id number id of the merge request iid number internal id of the merge request project id number id of the project title string title of the merge request description string description of the merge request state string state of the merge request (opened, closed, merged, locked) created at string date when the merge request was created updated at string date when the merge request was last updated target branch string target branch of the merge request source branch string source branch of the merge request upvotes number number of upvotes downvotes number number of downvotes author object information about the merge request author assignee object information about the merge request assignee assignees array users assigned to the merge request reviewers array users set as reviewers of the merge request source project id number id of the source project target project id number id of the target project labels array labels associated with the merge request draft boolean if true, the merge request is a draft work in progress boolean if true, the merge request is set as work in progress merge status string merge status of the merge request detailed merge status string detailed merge status of the merge request output example {"id" 123,"iid" 123,"project id" 123,"title" "string","description" "string","state" "string","created at" "string","updated at" "string","target branch" "string","source branch" "string","upvotes" 123,"downvotes" 123,"author" {},"assignee" {},"assignees" \[]} get repository archive retrieve an archive of a repository from gitlab devsecops platform using the project id and specified format endpoint url /api/v4/projects/{{id}}/repository/archive {{format}} method get input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user path parameters format string required name of the repository to download parameters path string optional the subpath of the repository to download if an empty string, defaults to the whole repository parameters sha string optional the commit sha to download a tag, branch reference, or sha can be used if not specified, defaults to the tip of the default branch input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc","format" "string"},"parameters" {"path" "string","sha" "string"}} output parameter type description file object output field file file file string output field file file file file name string name of the resource output example {"file" {"file" "string","file name" "example name"}} list branches lists all repository branches from a gitlab project, sorted alphabetically, with optional search or regex filtering requires the project id as a path parameter endpoint url api/v4/projects/{{id}}/repository/branches method get input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user parameters search string optional return list of branches containing the search string use ^term to find branches that begin with term, and term$ to find branches that end with term parameters regex string optional return list of branches with names matching a re2 regular expression cannot be used together with search input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc"},"parameters" {"search" "string","regex" "string"}} output parameter type description status code number http status code of the response reason string response reason phrase output example \[] list merge requests list all merge requests for a gitlab project using optional filters like state, labels, milestone, author, assignee, and branch requires the project id as a path parameter endpoint url api/v4/projects/{{id}}/merge requests method get input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user parameters state string optional returns all merge requests or just those that are opened, closed, locked, or merged defaults to all parameters order by string optional returns merge requests ordered by the given field default is created at parameters sort string optional returns merge requests sorted in asc or desc order default is desc parameters milestone string optional returns merge requests for a specific milestone parameters view string optional if simple, returns the iid, url, title, description, and basic state of merge request parameters labels string optional returns merge requests matching a comma separated list of labels parameters with labels details boolean optional if true, response returns more details for each label parameters with merge status recheck boolean optional if true, requests an asynchronous recalculation of the merge status field parameters created after string optional returns merge requests created on or after the given date and time (iso 8601) parameters created before string optional returns merge requests created on or before the given date and time (iso 8601) parameters updated after string optional returns merge requests updated on or after the given date and time (iso 8601) parameters updated before string optional returns merge requests updated on or before the given date and time (iso 8601) parameters scope string optional returns merge requests for the given scope defaults to all parameters author id number optional returns merge requests created by the given user id mutually exclusive with author username parameters author username string optional returns merge requests created by the given username mutually exclusive with author id parameters assignee id string optional returns merge requests assigned to the given user id none returns unassigned merge requests any returns merge requests with an assignee parameters reviewer id string optional returns merge requests which have the user as a reviewer with the given user id parameters reviewer username string optional returns merge requests which have the user as a reviewer with the given username parameters source branch string optional returns merge requests with the given source branch parameters target branch string optional returns merge requests with the given target branch parameters search string optional search merge requests against their title and description parameters in string optional modify the scope of the search attribute title, description, or a string joining them with comma default is title,description parameters draft boolean optional filter merge requests by their draft status parameters my reaction emoji string optional returns merge requests reacted to by the authenticated user by the given emoji input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc"},"parameters" {"state" "string","order by" "string","sort" "string","milestone" "string","view" "string","labels" "string","with labels details"\ true,"with merge status recheck"\ true,"created after" "string","created before" "string","updated after" "string","updated before" "string","scope" "string","author id" 123,"author username" "example name","assignee id" "string","reviewer id" "string","reviewer username" "example name","source branch" "string","target branch" "string","search" "string","in" "string","draft"\ true,"my reaction emoji" "string"}} output parameter type description status code number http status code of the response reason string response reason phrase output example \[] list repository commits retrieve a list of repository commits in a gitlab project using optional filters like author, ref name, path, and date range requires the project id as a path parameter endpoint url api/v4/projects/{{id}}/repository/commits method get input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user parameters ref name string optional the name of a repository branch, tag or revision range, or if not given the default branch parameters all boolean optional retrieve every commit from the repository if true, the ref name parameter is ignored parameters author string optional search commits by commit author parameters first parent boolean optional if true, follows only the first parent commit upon seeing a merge commit parameters follow boolean optional if true, follows file renames when filtering commits by path used only when path specifies a single file defaults to true parameters order string optional list commits in order defaults to default, showing commits in reverse chronological order parameters path string optional the file path parameters since string optional only commits after or on this date are returned in iso 8601 format yyyy mm ddthh\ mm \ ssz parameters until string optional only commits before or on this date are returned in iso 8601 format yyyy mm ddthh\ mm \ ssz parameters trailers boolean optional if true, parses and includes git trailers for every commit parameters with stats boolean optional if true, retrieve stats about each commit input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc"},"parameters" {"ref name" "example name","all"\ true,"author" "string","first parent"\ true,"follow"\ true,"order" "string","path" "string","since" "string","until" "string","trailers"\ true,"with stats"\ true}} output parameter type description status code number http status code of the response reason string response reason phrase output example \[] list repository tree lists all repository files and directories in a gitlab project, with optional path, ref, and recursive filters requires the project id as a path parameter endpoint url api/v4/projects/{{id}}/repository/tree method get input argument name type required description path parameters id string required the id or url encoded path of the project owned by the authenticated user parameters path string optional path inside the repository used to get content of subdirectories parameters ref string optional name of a repository branch or tag if not specified, uses the default branch parameters recursive boolean optional if true, get a recursive tree default is false parameters per page number optional number of results to show per page defaults to 20 parameters pagination string optional if keyset, use the keyset based pagination method parameters page token string optional tree record id at which to fetch the next page used only with keyset pagination input example {"path parameters" {"id" "12345678 1234 1234 1234 123456789abc"},"parameters" {"path" "string","ref" "string","recursive"\ true,"per page" 123,"pagination" "string","page token" "string"}} output parameter type description status code number http status code of the response reason string response reason phrase output example \[] response headers header description example content type the media type of the resource application/json date the date and time at which the message was originated thu, 01 jan 2024 00 00 00 gmt