In this repository we will create a simple script to get some information in GitLab API
Pre-Requisites | About | Description | Testing | How to contribute
Pull requests are welcome. If you'd like to support the work and buy me a ☕, I greatly appreciate it!
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.
To this project you yeed:
- Python 3.8.
- Docker and Docker Compose.
- GitLab Server.
- Set the gitlab environment variables.
- Install python packages in requirements.txt.
- Run this script with docker-compose, Dockerfile or into your local machine with Python command.
- Profit.
Press CTRL + C to stop it in Docker Compose or Dockerfile.
In this project we build a simples CLI application that help you to get some information in your GitLab API.
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>
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 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.
$ pip install pipenv
You can build the Pipfile to specifying:
- Versions of a Package.
- Versions of Python.
- Basic configurations.
Clone/create project repository:
$ cd myproject
Install from Pipfile, if there is one:
$ pipenv install
Install from Pipfile dev:
$ pipenv install --dev
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.
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 |
Steps to build the Docker Image.
docker image build -t <IMAGE_NAME> -f <PATH_DOCKERFILE> <PATH_CONTEXT_DOCKERFILE>
docker image build -t <IMAGE_NAME> . (This context)
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.
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
python ./main.py --help - Helper
👤 Hey!! If you like this project or if you find some bugs feel free to contact me in my channels:
- Linktree: https://linktr.ee/lpmatos
To check the change history, please access the CHANGELOG.md file.
This repository is a study project, therefore, it will not always be maintained 👻.