Skip to content

Latest commit

 

History

History
327 lines (245 loc) · 7.76 KB

README.tpl.md

File metadata and controls

327 lines (245 loc) · 7.76 KB

go-gitlab-client

Build Status

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

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-level variables

gitlab api doc

  • 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

Commits

gitlab api doc

  • List repository commits
  • Create a commit with multiple files and actions
  • Get a single commit
  • Get references a commit is pushed to
  • Cherry pick a commit
  • Get the diff of a commit
  • Get the comments of a commit
  • Post comment to commit
  • List the statuses of a commit
  • Post the build status to a commit
  • List Merge Requests associated with a commit

Deploy Keys

gitlab api doc

  • list project deploy keys
  • add/get/rm project deploy key

Environments

gitlab api doc

  • List environments
  • Create a new environment
  • Edit an existing environment
  • Delete an environment
  • Stop an environment

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

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

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

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

Project hooks

gitlab api doc

  • List project hooks
  • Get project hook
  • Add project hook
  • Edit project hook
  • Delete project hook

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

Notes

gitlab api doc

  • Issues
    • List project issue notes
    • Get single issue note
    • Create new issue note
    • Modify existing issue note
    • Delete an issue note
  • Snippets
    • List all snippet notes
    • Get single snippet note
    • Create new snippet note
    • Modify existing snippet note
    • Delete a snippet note
  • Merge Requests
    • List all merge request notes
    • Get single merge request note
    • Create new merge request note
    • Modify existing merge request note
    • Delete a merge request note
  • Epics
    • List all epic notes
    • Get single epic note
    • Create new epic note
    • Modify existing epic note
    • Delete an epic note

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 commands