Skip to content

repository-service-tuf/repository-service-tuf-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Repository Service for TUF Worker

Note

This service is in Experimental stage.

OpenSSF Scorecard Test Docker Image build Tests and Lint Coverage

Repository Service for TUF Worker is part of Repository Service for TUF.

Usage

Repository Service for TUF Repository Worker Docker Image documentation

Development

Requirements

  • Python >=3.10
  • pip
  • Pipenv
  • Docker

Getting source code

Fork the repository on GitHub and clone it to your local machine:

git clone git@github.com:YOUR-USERNAME/repository-service-tuf-worker.git

Add a remote and regularly sync to make sure you stay up-to-date with our repository:

git remote add upstream https://github.com/repository-service-tuf/repository-service-tuf-worker
git checkout main
git fetch upstream
git merge upstream/main

Installing project requirements

This repository has the requirements.txt and the requirements-dev.txt files to help build your virtual environment.

We also recommend using Pipenv to manage your virtual environment.

$ pip install pipenv
$ pipenv shell

Install development requirements

$ pipenv install -d

Note

MacOS running on Macbooks M1

For developers, after above command, run

$ pip uninstall cryptography cffi -y
$ pip cache purge
$ LDFLAGS=-L$(brew --prefix libffi)/lib CFLAGS=-I$(brew --prefix libffi)/include pip install cffi cryptography

Running checks with pre-commit:

The pre-commit tool is installed as part of the development requirements.

To automatically run checks before you commit your changes you should run:

$ make precommit

This will install the git hook scripts for the first time and run the pre-commit tool. Now pre-commit will run automatically on git commit.

Running the development Worker locally

Note

All code changes will reload the Worker container automatically.

$ make run-dev

A specific docker compose can be used giving the parameter DC=<name> For example: docker-compose-redis.yml use DC=redis

$ make run-dev DC=redis

See Makefile for more options

Tests

Unit tests

We use Tox to manage running the tests.

Running tests

$ tox

You can run specific test from tox.ini using -e

$ tox -e test

Functional tests

  1. Make sure you have a development environment running (make run-dev)
  2. Run the FT tests make ft-das-local or make ft-signed-local

Managing requirements

Installing new requirements

Project requirements

$ pipenv install {package}

Development requirements

$ pipenv install -d {package}

Updating requirements files from Pipenv

$ make requirements

Managing Database migrations

It is required when changing the RSTUF Worker Database Models repository_service_tuf_worker/models/

Updating the models requires a database migrations with Alembic.

Use a clear update message with M="Added field XYZ for Targets"

$ make db-migration M="update message"