modularity / modularity-tools

Created 2 years ago
Maintained by nphilipp
Tools needed by Modularity developers
Members 2
Nick Coghlan committed 2 years ago


Stable API & CLI

Note that the modtools CLI and API aren't considered stable, and there's no intention to ever release them through PyPI or as a Fedora package.

fedmod defines a published CLI and API for the rpm2module functionality:

Local development

Runtime dependencies

The currently preferred means of installation is local installation with pip.

$ pip install .

This will pull in the required Python level dependencies from PyPI.

Some tests aren't currently available from PyPI, and will need to be installed system-wide (exact list TBD).

Note that the CLI name, the distribution package name, and the import package name are all currently still subject to revision:

How to run tests

To start a shell that's correctly configured to run the tests with the library and all necessary dependencies installed:

$ pipenv --three --site-packages
$ pipenv install --dev
$ pipenv shell

The tests can then be run in the launched subshell with:

$ pytest tests

Note: the tests will currently fail. Fixing that is a work in progress :)

Reviewing dependencies

To see the Python level dependencies graph:

$ pew toggleglobalsitepackages
$ pipenv graph

(If you don't turn off global site-packages access first, you'll get the dependency graph of all the system Python components as well)

modtools docker2openshift

The tool is used for generation OpenShift template from Dockerfile and from already prepared by Modularity team. As Dockerfile as openshift-template.yml have to exist in the directory.

How to use modtools docker2openshift

Run the command with following parameters:

./modtools docker2openshift --dockerfile <full_path_to_Dockerfile> IMAGENAME

where parameters mean: * dockerfile ... means full path to Dockerfile * IMAGENAME ... means image name in register. Can be taken from command docker images or from some other registry.

The output of modtools docker2openshift command is OpenShift template stored in temporary directory

Example usage:

   ./modtools docker2openshift --dockerfile path/to/Dockerfile image/repository/url
   OpenShift template is generated here: /tmp/tmpM0teUC/openshift-template.yml

modtools module2dockerfile

The tool exists to ease creation of module related Dockerfiles. It pre-filles the information from modulemd file, but be aware, the generated Dockerfile needs to be manualy extended by other info (configuration, volumes, etc.).

How to use modtools module2dockerfile

Run the command with following parameters:

./modtools module2dockerfile --template <dockerfile_template> MODULEMD_FILE

where parameters mean: * template - base for Dockerfile, if you don't want otherwise use this file: * modulemd.yaml - path to the modulemd file

Modulemd creation

modtools rpm2module script creates modulemd file from package names. Output is written in modulemd-output.yaml file (multiple packages as input) or in file named after package name (single package as input).

Please make sure you have latest module-build-service and dnf installed before running.