CLI to get pipeline stats from gitlab API v4 using gitlab project ID
Project description
Get to the gitlab API and generates a report based on the pipeline builds. Creates a report for the pipelines of the last two weeks. (On the assumption that there are less than 100 push per 2 weeks)
Installation
Install via pip using:
pip install gitlab_stats
Local install with pip3:
pip3 install -e .
In order to make it work:
Create a GITLAB_TOKEN env variable with your access token.
Get the project ID
For the script to work, you will need to get the project ID of your gitlab project. It is a unique ID that is used by the gitlab REST API to store your project information.
Get it in [your project] > Settings > General > General project settings
How to use
When installed you should be able to run it like that:
gitlab_stats <id> -u <your gitlab url> -p <your proxy>
Here is the help when gitlab_stats -h:
usage: gitlab_stats [-h] [-r] [-u URL] [-p PROXY] id
gitlab_stats: Generate a report from gitlab's pipeline metrics
positional arguments:
id Put the id of the gitlab project
optional arguments:
-h, --help show this help message and exit
-r, --report Generate a csv report
-u URL, --url URL Put the url of your gitlab instance if different from
https://gitlab.com
-p PROXY, --proxy PROXY Add the url of your proxy like
'http://my.proxy.url:8083'
Important Note:
You will need an access token set up as an enviroment varable to reach your gitlab.
To get an access token based on your personal credentials go to your gitlab server [Account] -> [Settings] -> [Access Tokens]
Then give it a name and click Create personal access token.
Save this token somewhere safe then in bash:
export GITLAB_TOKEN=<token>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gitlab-stats-1.1.5.tar.gz
.
File metadata
- Download URL: gitlab-stats-1.1.5.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1ae4700a02f2fad9417cac9b92b1d7032c663aebea9492f77d980e5dd3e1d7f |
|
MD5 | 28076b999195efbb8b7f8ec207ffeb46 |
|
BLAKE2b-256 | fcd828976f56ed005cc6ffee2aa898a59beb57f0b94bfa6edb961d4368426ee7 |
File details
Details for the file gitlab_stats-1.1.5-py3-none-any.whl
.
File metadata
- Download URL: gitlab_stats-1.1.5-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9862a885a4f724e3f27662b001262cfd13119ed6683672792ad82cdf322b3d6a |
|
MD5 | 6113cc4a9e560eb45e65e83818e6ba98 |
|
BLAKE2b-256 | c5f9debc4a2f51daa41967c657634458a31751550a35baf307f5c7b13206cbf4 |