go-gitlab-client
go-gitlab-client is a client written in golang to consume gitlab API.
It also provides an handy CLI to easily interact with gitlab API.
lib
Install lib
To install go-gitlab-client, use go get
:
go get github.com/plouc/go-gitlab-client/gitlab
Import the go-gitlab-client
package into your code:
package whatever
import (
"github.com/plouc/go-gitlab-client/gitlab"
)
Update
To update go-gitlab-client
, use go get -u
:
go get -u github.com/plouc/go-gitlab-client/gitlab
Documentation
Visit the docs at http://godoc.org/github.com/plouc/go-gitlab-client/gitlab
Supported APIs
Projects
gitlab api doc
- List all projects
- List user projects
- Get single project
- Remove project
- Star a project
- Unstar a project
Repositories
gitlab api doc
- list project repository tags
- list repository commits
- list project hooks
- add/get/edit/rm project hook
Users
gitlab api doc
- List users
- Single user
- Current user
SSH Keys
gitlab api doc
- List SSH keys
- List SSH keys for user
- Single SSH key
- Add SSH key
- Add SSH key for user
- Delete SSH key for current user
- Delete SSH key for given user
Groups
gitlab api doc
- List groups
- List a groups's subgroups
- List a group's projects
- Details of a group
- New group
- Transfer project to group
- Update group
- Remove group
- Search for group
- Group members
Deploy Keys
gitlab api doc
- list project deploy keys
- add/get/rm project deploy key
Jobs
gitlab api doc
- List project jobs
- List pipeline jobs
- Get a single job
- Get job artifacts
- Download the artifacts archive
- Download a single artifact file
- Get a trace file
- Cancel a job
- Retry a job
- Erase a job
- Keep artifacts
- Play a job
Runners
gitlab api doc
- List owned runners
- List all runners
- Get runner's details
- Update runner's details
- Remove a runner
- List runner's jobs
- List project's runners
- Enable a runner in project
- Disable a runner from project
- Register a new Runner
- Delete a registered Runner
- Verify authentication for a registered Runner
Branches
gitlab api doc
- List repository branches
- Get single repository branch
- Protect repository branch
- Unprotect repository branch
- Create repository branch
- Delete repository branch
- Delete merged branches
Project hooks
gitlab api doc
- List project hooks
- Get project hook
- Add project hook
- Edit project hook
- Delete project hook
- List project variables
- Show project variable details
- Create project variable
- Update project variable
- Remove project variable
Group-level variables
gitlab api doc
- List group variables
- Show group variable details
- Create group variable
- Update group variable
- Remove group variable
Pipelines
gitlab api doc
- List project pipelines
- Get a single pipeline
- Create a new pipeline
- Retry jobs in a pipeline
- Cancel a pipeline's jobs
Project badges
gitlab api doc
- List all badges of a project
- Get a badge of a project
- Add a badge to a project
- Edit a badge of a project
- Remove a badge from a project
- Preview a badge from a project
Namespaces
gitlab api doc
- List namespaces
- Search for namespace
- Get namespace by ID
Merge requests
gitlab api doc
- List merge requests
- List project merge requests
- List group merge requests
- Get single MR
- Get single MR participants
- Get single MR commits
- Get single MR changes
- List MR pipelines
- Create MR
- Update MR
- Delete a merge request
- Accept MR
- Cancel Merge When Pipeline Succeeds
- Comments on merge requests
- List issues that will close on merge
- Subscribe to a merge request
- Unsubscribe from a merge request
- Create a todo
- Get MR diff versions
- Get a single MR diff version
- Set a time estimate for a merge request
- Reset the time estimate for a merge request
- Add spent time for a merge request
- Reset spent time for a merge request
- Get time tracking stats
- Approvals
Environments
gitlab api doc
- List environments
- Create a new environment
- Edit an existing environment
- Delete an environment
- Stop an environment
CLI
go-gitlab-client provides a CLI to easily interact with GitLab API, glc.
install CLI
glc is a single binary with no external dependencies, released for several platforms.
Go to the releases page,
download the package for your OS, and copy the binary to somewhere on your PATH.
Please make sure to rename the binary to glc
and make it executable.
You can also install completion for bash or zsh, please run glc help completion
for more info.
CLI features
- normalized operations:
ls
, get
, add
, update
- resource aliases for easy retrieval
text
, yaml
& json
output
- saving output to file
- interactive pagination mode
- interactive resource creation
CLI documentation
The CLI documentation is available here.