A light client for Gitlab API v4
2.4K
This repository wraps this Gitlab API Go library and provides a command-line tool to manage a Gitlab instance.
To run the Gitlab API client execute the following docker run command to get the client usage:
docker run --rm --interactive --tty cyd01/gitlabcli
Set a GITLAB_URL environment variable with the URL of your Gitlab instance or use https://gitlab.com for the official Gitlab instance ;-)
export GITLAB_URL="https://gitlab.com"
docker run --rm --interactive --tty --env GITLAB_URL cyd01/gitlabcli broadcast ls
ID Message StartsAt StartsAt Active BroadcastType Dismissable
------- --------------------------------------------------------------------------- ------------------- ------------------- ------ ------------- -----------
100719 GitLab open-sourced our remote work playbook. <a href="https://learn.git... 2020-04-22 15:38:00 2020-04-22 15:38:00 false notification false
100720 Hi {{name}}, <br />??GitLab.com is upgrading to 13.0, the next major rel... 2020-05-07 22:28:00 2020-05-07 22:28:00 false notification false
...
Note: broadcast messages are the only API calls that do not require authentication.
If you need to authenticate to your Gitlab instance and you have an access token, simply set the GITLAB_TOKEN environment variable with this token.
export GITLAB_TOKEN="xxxxxxxxxxxxxxxxxxx"
docker run --rm --interactive --tty --env GITLAB_URL --env GITLAB_TOKEN cyd01/gitlabcli status get
Emoji Message
-------- ------------
grinning Hello world!
If your instance does not have 2FA enabled, it is possible to authenticate with username and password. Just set GITLAB_AUTH_USER and GITLAB_AUTH_PASS environment variables
export GITLAB_AUTH_USER="root"
export GITLAB_AUTH_PASS="yyyyyyyy"
docker run --rm --interactive --tty --env GITLAB_URL --env GITLAB_AUTH_USER --env GITLAB_AUTH_PASS cyd01/gitlabcli whoami
root
By default this Gitlab API client prints results in a Docker-style well-formatted output.
There is a useful parameter option: -output-raw to print the original JSON response.
docker run --rm --interactive --tty --env GITLAB_URL --env GITLAB_TOKEN cyd01/gitlabcli status get -output-raw
{
"emoji": "grinning",
"availability": "not_set",
"message": "Hello world!",
"message_html": "Hello world!"
}
Gitlab.com service has so many users and projects, which means API requests can take a long time !
Use the -user username parameter option to restrict the request to your own user.
Content type
Image
Digest
sha256:bf86d453b…
Size
26.9 MB
Last updated
about 1 month ago
docker pull cyd01/gitlabcli