This repository contains kiwi definitions to build containers for SUSE OpenStack Cloud. The containers are built in the Open Build Service.
We want to build containers based on different base containers (eg. for openSUSE or SLE). To accomplish that, we use Jinja2 templates and YAML based (.yml) files which contain variables to fill the templates.
The tool to process the single template (usually .kiwi.j2) and the variable files(s) (usually .yml) is j2gen
j2gen allows multiple variable files which are combined together (for dict/hash like data structures, the structures are merged where the last occurance wins). So we can have a chain of variable files like:
- common/global.yml (used for all containers)
- $image/common.yml (used for all $image containers)
- $image/$distro.yml (used for the $distro specific container)
- $image/$image.kiwi.j2 (the template to build $image for all distros)
The .kiwi output file (eg. for a memcached SLE15SP1 image) can be generated from the above files with:
j2gen generate --output memcached-image.kiwi \ memcached-image/memcached-image.kiwi.j2 \ common/global.yml \ memcached-image/common.yml \ memcached-image/SLE_15_SP1.yml
The generated file is then memcached-image.kiwi.
The OpenBuildService (OBS) has the concept of source services which can be used to automate most of the tasks needed.
To get the code from this repository (git) into an OBS package, there is the tar_scm source service. This service will download and extract the files needed to generate a .kiwi file for building a container
Instead of manually running j2gen with all the needed parameters, there is a j2gen source service available. This service will render the kiwi.j2 template into a .kiwi file.
Contributions are welcome. Please open pull requests (PR) against https://github.com/SUSE-Cloud/soc-container-images/ .
There is a script to run j2gen and kiwi for validation. To execute this locally, do:
tox -evalidate