No description
Find a file
Lars Karlitski 356f62058f remoteloop: remove dir_fd argument in create_device
If dir_fd wasn't passed, create_device() openend it to `/dev` and forgot
about closing it. To fix this, it would have to gain logic to only close
the fd if it wasn't passed in.

Side-step the problem by removing dir_fd, since nothing is using it
right now. We can add it back if something needs it.
2019-10-07 10:10:51 +02:00
assemblers remoteloop: don't close a socket it didn't open 2019-10-07 10:10:51 +02:00
osbuild remoteloop: remove dir_fd argument in create_device 2019-10-07 10:10:51 +02:00
samples samples: remove base-from-yum.json 2019-10-07 00:17:43 +02:00
stages stages/dnf: exclude-packages → exclude_packages 2019-10-03 12:53:01 +02:00
test test: introduce OSBUILD_TEST_STORE 2019-10-07 00:06:23 +02:00
.gitignore gitignore: Add test directories to gitignore 2019-09-10 09:22:26 +02:00
.packit.yaml packit: use default tarball and version behavior 2019-09-16 15:16:37 +02:00
.pylintrc pylint: disable too-many-arguments rule 2019-07-24 12:55:48 +02:00
.travis.yml test: refactor boot test 2019-09-26 19:20:47 +02:00
bump-version.sh release version 2 2019-09-18 00:05:43 +02:00
LICENSE Add LICENSE 2019-04-09 18:18:44 +02:00
Makefile Remove tarball-alternative rule and replace tarball rule 2019-09-02 10:28:21 +02:00
MANIFEST.in introduce spec file and related build scripts 2019-07-23 15:22:40 +02:00
osbuild-run tree-wide: always explicitly pass check to subprocess.run 2019-09-24 20:17:04 +02:00
osbuild.spec 3 2019-10-04 11:13:21 +02:00
README.md assemblers/qemu: fix the partition UUID in the pipeline 2019-10-02 15:10:37 +02:00
RELEASE.md sum up the procedure necessary for releasing new version 2019-10-04 22:27:06 +02:00
setup.py 3 2019-10-04 11:13:21 +02:00
tree-diff tools: add a helper to generate a 'deep diff' of two trees 2019-09-18 14:53:02 +02:00

osbuild

A build system for operating system images, working towards an image build pipeline that's more comprehensible, reproducible, and extendable.

Pipelines

The build process for an image is described by a pipeline. Each stage in a pipeline is a program that, given some configuration, modifies a file system tree. Finally, an assembler takes a filesystem tree, and assembles it into an image. Pipelines are defined as JSON files like this one:

{
  "name": "Example Image",
  "stages": [
    {
      "name": "org.osbuild.dnf",
      "options": {
        "releasever": "30",
        "basearch": "x86_64",
        "repos": [
          {
            "metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch",
            "gpgkey": "F1D8 EC98 F241 AAF2 0DF6  9420 EF3C 111F CFC6 59B9",
            "checksum": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
          }
        ],
        "packages": [ "@Core", "grub2-pc", "httpd" ]
        }
    },
    {
      "name": "org.osbuild.systemd",
      "options": {
        "enabled_services": [ "httpd" ]
      }
    },
    {
      "name": "org.osbuild.grub2",
      "options": {
        "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac"
      }
    }
  ],
  "assembler": {
    "name": "org.osbuild.qemu",
    "options": {
      "format": "qcow2",
      "filename": "example.qcow2",
      "ptuuid": "0x7e83a7ba",
      "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
      "size": 3221225472
    }
  }
}

osbuild runs each of the stages in turn, isolating them from the host and from each other, with the exception that they all operate on the same filesystem-tree. The assembler is similarly isolated, and given the same tree, in read-only mode and assembles it into an image without altering its contents.

The filesystem tree produced by the final stage of a pipeline, is named and optionally saved to be reused as the base for future pipelines.

Each stage is passed the (appended) options object as JSON over stdin.

The above pipeline has no base and produces a qcow2 image.

Running

usage: python3 -m osbuild [-h] [--build-pipeline PIPELINE] [--store DIRECTORY]
                   [-l DIRECTORY]
                   PIPELINE

Build operating system images

positional arguments:
  PIPELINE              json file containing the pipeline that should be built

optional arguments:
  -h, --help            show this help message and exit
  --build-pipeline PIPELINE
                        json file containing the pipeline to create a build
                        environment
  --store DIRECTORY     the directory where intermediary os trees are stored
  -l DIRECTORY, --libdir DIRECTORY
                        the directory containing stages, assemblers, and the
                        osbuild library

Running example

You can build basic qcow2 image of Fedora 30 by running a following command:

sudo python3 -m osbuild --libdir . samples/base-qcow2.json
  • Root rights are required because osbuild heavily relies on creating systemd containers and bind mounting.

    It shouldn't interfere with host OS but please be careful! It's still under development!

  • --libdir argument is required because osbuild expects itself to be installed in directories under /usr. Using this argument you can change the expected path.

  • You don't need to use any kind of virtual environment, modern version of Python 3 is enough. osbuild uses only standard library and linux commands.