Table of Contents
gitlab
package)gitlab
command)See also
For a complete list of objects and actions available, seeCLI reference (gitlab command).
ci-lint has been Removed in Gitlab 16, use project-ci-lint instead
Lint a CI YAML configuration from a string:
Note
To see output, you will need to use the-v
/--verbose
flag.
To exit with non-zero on YAML lint failures instead, use thevalidate
subcommand shown below.
$gitlab--verboseci-lintcreate--content\"--- test: script: - echo hello "
Lint a CI YAML configuration from a file (seeReading values from files):
$gitlab--verboseci-lintcreate--content@.gitlab-ci.yml
Validate a CI YAML configuration from a file (lints and exits with non-zero on failure):
$gitlabci-lintvalidate--content@.gitlab-ci.yml
Lint a project’s CI YAML configuration:
$gitlab--verboseproject-ci-lintcreate--project-idgroup/my-project--content@.gitlab-ci.yml
Validate a project’s CI YAML configuration (lints and exits with non-zero on failure):
$gitlabproject-ci-lintvalidate--project-idgroup/my-project--content@.gitlab-ci.yml
Lint a project’s current CI YAML configuration:
$gitlab--verboseproject-ci-lintget--project-idgroup/my-project
Lint a project’s current CI YAML configuration on a specific branch:
$gitlab--verboseproject-ci-lintget--project-idgroup/my-project--refmy-branch
List the projects (paginated):
$gitlabprojectlist
List all the projects:
$gitlabprojectlist--get-all
List all projects of a group:
$gitlabgroup-projectlist--get-all--group-id1
List all projects of a group and its subgroups:
$gitlabgroup-projectlist--get-all--include-subgroupstrue--group-id1
Limit to 5 items per request, display the 1st page only
$gitlabprojectlist--page1--per-page5
Get a specific project (id 2):
$gitlabprojectget--id2
Get a specific user by id:
$gitlabuserget--id3
Create a user impersonation token (admin-only):
gitlab user-impersonation-token create --user-id 2 --name test-token --scopes api,read_user
Create a deploy token for a project:
$gitlab-vproject-deploy-tokencreate--project-id2\--namebar--usernameroot--expires-at"2021-09-09"--scopes"api,read_repository"
List deploy tokens for a group:
$gitlab-vgroup-deploy-tokenlist--group-id3
List the current user’s personal access tokens (or all users’ tokens, if admin):
$gitlab-vpersonal-access-tokenlist
Revoke a personal access token by id:
$gitlabpersonal-access-tokendelete--id1
Revoke the personal access token currently used:
$gitlabpersonal-access-tokendelete--idself
Create a personal access token for a user (admin only):
$gitlab-vuser-personal-access-tokencreate--user-id2\--namepersonal-access-token--expires-at"2023-01-01"--scopes"api,read_repository"
Create a project access token:
$gitlab-vproject-access-tokencreate--project-id2\--nameproject-token--expires-at"2023-01-01"--scopes"api,read_repository"
List project access tokens:
$gitlab-vproject-access-tokenlist--project-id3
Revoke a project access token:
$gitlabproject-access-tokendelete--project-id3--id1
Create a group access token:
$gitlab-vgroup-access-tokencreate--group-id2\--namegroup-token--expires-at"2022-01-01"--scopes"api,read_repository"
List group access tokens:
$gitlab-vgroup-access-tokenlist--group-id3
Revoke a group access token:
$gitlabgroup-access-tokendelete--group-id3--id1
List packages for a project:
$gitlab-vproject-packagelist--project-id3
List packages for a group:
$gitlab-vgroup-packagelist--group-id3
Get a specific project package by id:
$gitlab-vproject-packageget--id1--project-id3
Delete a specific project package by id:
$gitlab-vproject-packagedelete--id1--project-id3
Upload a generic package to a project:
$gitlabgeneric-packageupload--project-id1--package-namehello-world\--package-versionv1.0.0--file-namehello.tar.gz--path/path/to/hello.tar.gz
Download a project’s generic package:
$gitlabgeneric-packagedownload--project-id1--package-namehello-world\--package-versionv1.0.0--file-namehello.tar.gz>/path/to/hello.tar.gz
Get a list of issues for this project:
$gitlabproject-issuelist--project-id2
Delete a snippet (id 3):
$gitlabproject-snippetdelete--id3--project-id2
Update a snippet:
$gitlabproject-snippetupdate--id4--project-id2\--code"My New Code"
Create a snippet:
$gitlabproject-snippetcreate--project-id2Impossible to create object (Missing attribute(s): title, file-name, code)$# oops, let's add the attributes:$gitlabproject-snippetcreate--project-id2--title"the title"\--file-name"the name"--code"the code"
Get a specific project commit by its SHA id:
$gitlabproject-commitget--project-id2--ida43290c
Get the signature (e.g. GPG or x509) of a signed commit:
$gitlabproject-commitsignature--project-id2--ida43290c
Define the status of a commit (as would be done from a CI tool for example):
$gitlabproject-commit-statuscreate--project-id2\--commit-ida43290c--statesuccess--nameci/jenkins\--target-urlhttp://server/build/123\--description"Jenkins build succeeded"
Get the merge base for two or more branches, tags or commits:
gitlab project repository-merge-base --id 1 --refs bd1324e2f,main,v1.0.0
Download the artifacts zip archive of a job:
$gitlabproject-jobartifacts--id10--project-id1>artifacts.zip
List owned runners:
$gitlabrunnerlist
List owned runners with a filter:
$gitlabrunnerlist--scopeactive
List all runners in the GitLab instance (specific and shared):
$gitlabrunner-alllist
Get a runner’s details:
$gitlab-vrunnerget--id123
Use sudo to act as another user (admin only):
$gitlabprojectcreate--nameuser_project1--sudousername
List values are comma-separated:
$gitlabissuelist--labelsfoo,bar