Skip to main content

Introduction

GitLab-Registry-Usage-REST is a package that periodically collects image information (name, tags, sizes) of a GitLab registry server and offers the data via a secured RESTful HAL api. For the initial authentication a LDAP server is needed. Subsequent queries are secured by JSON Web Tokens (JWT).

Installation

The latest version can be obtained from PyPI:

pip install gitlab-registry-usage-rest
gitlab-registry-usage-rest --help

or from DockerHub:

docker run sciapp/gitlab-registry-usage-rest:latest --help

Usage

Gitlab-Registry-Usage-REST needs a configuration file in order to run. The default path is /etc/gitlab_registry_usage_rest.conf but can be altered with the -c command line switch. To get started, you can run

gitlab-registry-usage-rest --print-default-config

and edit this default configuration to fit your environment.

If you would like to use the docker image, you can bind mount a local configuration file with the -v switch:

docker run -v "$(pwd)/gitlab_registry_usage_rest.conf:/etc/gitlab_registry_usage_rest.conf" sciapp/gitlab-registry-usage-rest:latest

Note: Docker expects an absolute path for the local configuration file.

The server offers these api endpoints:

  • /auth_token: Accepts a request with basic auth (and valid LDAP credentials) and returns an auth token for further api usage. All other endpoints only accept requests with a valid Bearer authorization header:

    Authorization: Bearer <token>
  • /images: Lists attributes of the images collection. Currently, only the timestamp of the last data refresh is contained:

    {
        "timestamp": 1521796487.7021387
    }
  • /images/<image_name>: Queries attributes of a specific image:

    {
        "name": "scientific-it-systems/administration/gitlab-registry-usage-rest",
        "size": 39899199,
        "disk_size": 39898911
    }
  • /images/<image_name>/tags: Endpoint for the collection of image tags, currently without any content.

  • /images/<image_name>/tags/<tag_name>: Lists attributes of an image tag:

    {
        "name": "latest",
        "size": 39899199,
        "disk_size": 39898911
    }

Additionally, all api endpoints (except /auth_token) offer an _embedded and a _links attribute if requested with the query string:

?embed=true&links=true

Instead of a boolean value, the embed key can also take an integer number to only request a specific level of embedded resources.

Links can be used to easily navigate between related resources. Embedded resources are convenient to query a complete hierarchy of resources with one GET request. Accordingly, the request

/images?embed=true

returns all resources at once.

Release files for gitlab-registry-usage-rest 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitlab-registry-usage-rest 0.1.11
File Size Uploaded
gitlab-registry-usage-rest-0.1.11.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitlab-registry-usage-rest 0.1.11
File Interpreter ABI Platform
gitlab_registry_usage_rest-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / gitlab-registry-usage-rest-0.1.11.tar.gz

Download URL gitlab-registry-usage-rest-0.1.11.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
70a8055c7050ca8d2f9e78bf4a100d134db2d3eb2635fd0b7d7e016e0555edcd
BLAKE2b-256 checksum
How to use checksums
55942bf644d93f274a05fe975998352d9f8e3fc606e7cd9e9da9a7353bd5f584
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gitlab_registry_usage_rest-0.1.11-py3-none-any.whl

Download URL gitlab_registry_usage_rest-0.1.11-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
074b78efc192062308f256d143cf6b55c72017263d7848c86a3eaf5f68bb4b6f
BLAKE2b-256 checksum
How to use checksums
ec000bd11c844007b5f87ebed631dcacf9b811457f39bef8a45d7f7e43d4a9cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.12

2 release files

This release

0.1.11 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page