/gitlab-analytics

✔️ In this repository we will create a script to get information in GitLab API

Primary LanguagePythonMIT LicenseMIT

gitlab

Welcome to GitLab Analytics Repository

In this repository we will create a simple script to get some information in GitLab API

Open Source GitHub Contributors GitHub Language Count GitHub Top Language GitHub Stars GitHub Last Commit Repository Size Repository Issues MIT License

Menu

Pre-Requisites   |    About   |    Description   |    Testing   |    How to contribute

By me a coffe

Pull requests are welcome. If you'd like to support the work and buy me a ☕, I greatly appreciate it!

Buy Me A Coffee

Getting Started

To use this repository you need a git clone:

git clone --depth 1 https://github.com/lpmatos/gitlab-analytics.git -b master

This will give access of the project on your local machine.

Pre Requisites

To this project you yeed:

  • Python 3.8.
  • Docker and Docker Compose.
  • GitLab Server.

Built with

How to use it?

  1. Set the gitlab environment variables.
  2. Install python packages in requirements.txt.
  3. Run this script with docker-compose, Dockerfile or into your local machine with Python command.
  4. Profit.

Press CTRL + C to stop it in Docker Compose or Dockerfile.

Description

In this project we build a simples CLI application that help you to get some information in your GitLab API.

Running pip

The pip is a command line program. When you install pip, a pip command is added to your system, which can be run from the command prompt as follows:

$ pip <pip arguments>

If you cannot run the pip command directly (possibly because the location where it was installed isn't on your operating systems PATH) then you can run pip via the Python interpreter:

$ python -m pip <pip arguments>

On Windows, the py launcher can be used:

$ py -m pip <pip arguments>

Installing Packages

Pip

The pip supports installing from PyPI, version control, local projects, and directly from distribution files.

The most common scenario is to install from PyPI using Requirement specifiers.

$ pip install SomePackage            # latest version
$ pip install SomePackage==1.0.4     # specific version
$ pip install somePackage>=1.0.4     # minimum version

Pipenv

Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. Windows is a firsts-class citizen, in our world.

It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever-important Pipfile.lock, which is used to produce deterministic builds.

Installation
$ pip install pipenv
Create a TOML Spec Pipfile

You can build the Pipfile to specifying:

  • Versions of a Package.
  • Versions of Python.
  • Basic configurations.
Pipenv Workflow

Clone/create project repository:

$ cd myproject

Install from Pipfile, if there is one:

$ pipenv install

Install from Pipfile dev:

$ pipenv install --dev

Requirement File

Requirement File are files containing a list of items to be installed using pip install like so:

$ pip install -r requirements.txt

Logically, a Requirement File is just a list of pip install arguments placed in a file. Note that you should not rely on the items in the file being installed by pip in any particular order.

Environment variables

Name Description
GITLAB_URL Just your GitLab Server Host
GITLAB_TOKEN Just your GitLab Token
LOG_PATH Just the Log Path
LOG_FILE Just the Log File
LOG_LEVEL Just the Log Level
LOGGER_NAME Just the Logger name

🐋 Development with Docker

Steps to build the Docker Image.

Build

docker image build -t <IMAGE_NAME> -f <PATH_DOCKERFILE> <PATH_CONTEXT_DOCKERFILE>
docker image build -t <IMAGE_NAME> . (This context)

Run

Steps to run the Docker Container.

  • Linux running:
docker container run -d -p <LOCAL_PORT:CONTAINER_PORT> <IMAGE_NAME> <COMMAND>
docker container run -it --rm --name <CONTAINER_NAME> -p <LOCAL_PORT:CONTAINER_PORT> <IMAGE_NAME> <COMMAND>
  • Windows running:
winpty docker.exe container run -it --rm <IMAGE_NAME> <COMMAND>

For more information, access the Docker documentation or this.

🐋 Development with Docker Compose

Build and run a docker-compose.

docker-compose up --build

Down all services deployed by docker-compose.

docker-compose down

Down all services and delete all images.

docker-compose down --rmi all

Usage

python ./main.py --help - Helper

Params

Alt text

➤ Author

👤 Hey!! If you like this project or if you find some bugs feel free to contact me in my channels:

➤ Versioning

To check the change history, please access the CHANGELOG.md file.

➤ Project status

This repository is a study project, therefore, it will not always be maintained 👻.

➤ Donations

BTC Address Litecoin Address

➤ Show your support

Give me a ⭐️ if this project helped you!

gif-header

Made with 💜 by me 👋 inspired on readme-md-generator