Coder Social home page Coder Social logo

coreos-assembler's Introduction

This container aggregates various tools used to build Fedora CoreOS style systems.

It reuses various upstream tools, such as:

A high level goal of this tool is to support two highly related use cases, and to keep them as similar as possible:

  • Local development ("test a kernel change")
  • Be a production build system orchestrated by an external tool (e.g. Jenkins)

See fedora-coreos-ci as an example pipeline.

Getting started - prerequisites

You can use podman or docker. These examples use podman. Note the container must be privileged, as the build process uses container functionality itself - we're using recursive containers.

Secondly, in order to build VM images, the container must have access to /dev/kvm. If you're running this in a VM, you must enable nested virt. See also GCE nested virt.

Setup

Here we store data in /srv/coreos on our host system. You can choose any directory you like. You should run these commands as root.

$ mkdir /srv/coreos
$ cd /srv/coreos
$ alias coreos-assembler='podman run --rm --net=host -ti --privileged --userns=host -v $(pwd):/srv --workdir /srv quay.io/cgwalters/coreos-assembler'

If you need access to CA certificates on your host (for example, when you need to access a git repo that is not on the public Internet), you can mount in the host certificates as read-only. For example, on a Fedora host the alias would change to:

$ alias coreos-assembler='podman run --rm --net=host -ti --privileged --userns=host -v /etc/pki:/etc/pki:ro -v $(pwd):/srv --workdir /srv quay.io/cgwalters/coreos-assembler'

See this Stack Overflow question for additional discussion.

Initializing

You only need to do this once; it will clone the specified configuration repo, create various directories and also download an installer image (used to make VMs).

$ coreos-assembler init https://github.com/coreos/fedora-coreos-config

The specified git repository will be cloned into /srv/coreos/src/config.

If you're doing something custom, you likely want to fork that upstream repository.

Performing a build

$ coreos-assembler build

Each build will write an OSTree commit into /srv/coreos/repo as well as generate VM images in /srv/coreos/builds/.

Next, rerun coreos-assembler build and notice the system correctly deduces that nothing changed. You can run coreos-assembler fetch to check for updated RPMs.

Running

$ coreos-assembler run

This invokes QEMU on the image in builds/latest. It uses -snapshot, so any changes are thrown away after you exit qemu. To exit, type Ctrl-a x. For more options, type Ctrl-a ?.

Making changes

Currently, the assembler only takes two input files that are from src/config:

  • manifest.yaml: An rpm-ostree "manifest" or "treefile", which mostly boils down to a list of RPMs and a set of rpm-md repositories they come from. It also supports postprocess to make arbitrary changes. See the upstream docs.
  • image.ks: An Anaconda Kickstart file. Use this to define the base disk image output.

Let's try editing the file src/config/image.ks. Change the root storage line logvol / for example. Rerun coreos-assembler build, and notice that the OSTree commit didn't change, but a new image is generated in builds. When you coreos-assembler run, you'll get it.

Another thing to try is editing src/config/manifest.yaml - add or remove entries from packages. You can also add local rpm-md file:/// repositories.

Development

The container image is built in OpenShift CI.

coreos-assembler's People

Contributors

cgwalters avatar dustymabe avatar jlebon avatar ashcrow avatar yuqi-zhang avatar miabbott avatar lucab avatar arithx avatar

Watchers

Gerard Braad avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.