Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ install:
install -D -t $(DESTDIR)$(PREFIX)/lib/coreos-assembler $$(find src/ -maxdepth 1 -type f)
install -d $(DESTDIR)$(PREFIX)/bin
ln -sf ../lib/coreos-assembler/coreos-assembler $(DESTDIR)$(PREFIX)/bin/
ln -sf ../lib/coreos-assembler/cosa $(DESTDIR)$(PREFIX)/bin/
install -D -t $(DESTDIR)$(PREFIX)/bin mantle/bin/{ore,kola}
install -d $(DESTDIR)$(PREFIX)/lib/kola/amd64
install -D -m 0755 -t $(DESTDIR)$(PREFIX)/lib/kola/amd64 mantle/bin/amd64/kolet
52 changes: 28 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
This container aggregates various tools used to build [Fedora CoreOS](https://coreos.fedoraproject.org)
style systems.
This is the CoreOS Assembler (often abbreviated COSA) build environment. It is
a collection of various tools used to build
[Fedora CoreOS](https://coreos.fedoraproject.org) style systems.


It reuses various upstream tools, such as:

Expand Down Expand Up @@ -50,7 +52,7 @@ compose. This is known as [recursive containers](https://github.com/projectatomi
### Container Build
---

To completely rebuild the coreos-assembler container image locally, execute
To completely rebuild the COSA container image locally, execute
`$ sudo podman build -t localhost/coreos-assembler .` or
`$ sudo podman build -t localhost/coreos-assembler -f Dockerfile.rhel .`
from the `coreos-assembler` repository. If building the RHEL version please
Expand Down Expand Up @@ -84,10 +86,10 @@ Now we'll define a bash function that we can use to call the assembler
container:

```
$ coreos-assembler() {
$ cosa() {
env | grep COREOS_ASSEMBLER
set -x # so we can see what command gets run
sudo podman run --rm -ti -v ${PWD}:/srv/ --userns=host --device /dev/kvm --name coreos-assembler \
sudo podman run --rm -ti -v ${PWD}:/srv/ --userns=host --device /dev/kvm --name cosa \
${COREOS_ASSEMBLER_PRIVILEGED:+--privileged} \
${COREOS_ASSEMBLER_CONFIG_GIT:+-v $COREOS_ASSEMBLER_CONFIG_GIT:/srv/src/config/:ro} \
${COREOS_ASSEMBLER_GIT:+-v $COREOS_ASSEMBLER_GIT/src/:/usr/lib/coreos-assembler/:ro} \
Expand All @@ -97,6 +99,8 @@ $ coreos-assembler() {
}
```

**NOTE**: We're using `cosa` here as it is much easier to type than `coreos-assembler`.

This is a bit more complicated than a simple alias, but it allows for
hacking on the assembler or the configs and prints out the environment and
the command that ultimately gets run. Let's step through each part:
Expand All @@ -105,7 +109,7 @@ the command that ultimately gets run. Let's step through each part:
- `-v ${PWD}:/srv/`: mount local working dir under `/srv/` in container
- `--userns=host`: the default for podman anyway, but required for docker
- `--device /dev/kvm`: needed for creating VMs
- `--name coreos-assembler`: just a name, feel free to change it
- `--name cosa`: just a name, feel free to change it


The environment variables are special purpose:
Expand Down Expand Up @@ -148,7 +152,7 @@ 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
$ cosa init https://github.com/coreos/fedora-coreos-config
```

The specified git repository will be cloned into `$PWD/src/config/`.
Expand All @@ -162,27 +166,27 @@ repository.
First, we fetch all the metadata and packages:

```
$ coreos-assembler fetch
$ cosa fetch
```

And now we can build from these inputs:

```
$ coreos-assembler build
$ cosa build
```

Each build will write an OSTree commit into `$PWD/repo/` as well
as generate VM images in `$PWD/builds/`.

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

### Running
---

```
$ coreos-assembler run
$ cosa run
```

This invokes QEMU on the image in `builds/latest`. It uses `-snapshot`,
Expand All @@ -200,8 +204,8 @@ We can hack on some local input configs by exporting them in the

```
$ export COREOS_ASSEMBLER_CONFIG_GIT=/path/to/github.com/coreos/fedora-coreos-config/
$ coreos-assembler init --force /dev/null
$ coreos-assembler fetch && coreos-assembler build
$ cosa init --force /dev/null
$ cosa fetch && cosa build
```

Currently, the assembler only takes two input files that are from `src/config`:
Expand All @@ -214,9 +218,9 @@ Currently, the assembler only takes two input files that are from `src/config`:
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
storage line `logvol /` for example. Rerun `cosa 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.
When you `cosa 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:///`
Expand All @@ -231,8 +235,8 @@ the `COREOS_ASSEMBLER_GIT` env var.

```
$ export COREOS_ASSEMBLER_GIT=/path/to/github.com/coreos/coreos-assembler/
$ coreos-assembler init https://github.com/coreos/fedora-coreos-config.git
$ coreos-assembler fetch && coreos-assembler build
$ cosa init https://github.com/coreos/fedora-coreos-config.git
$ cosa fetch && cosa build
```

#### Running in privileged mode
Expand All @@ -242,8 +246,8 @@ you can use the `COREOS_ASSEMBLER_PRIVILEGED` env var:

```
$ export COREOS_ASSEMBLER_PRIVILEGED=true
$ coreos-assembler init https://github.com/coreos/fedora-coreos-config.git
$ coreos-assembler fetch && coreos-assembler build
$ cosa init https://github.com/coreos/fedora-coreos-config.git
$ cosa fetch && cosa build
```


Expand All @@ -255,8 +259,8 @@ by setting the `COREOS_ASSEMBLER_CONTAINER` env var:

```
$ export COREOS_ASSEMBLER_CONTAINER=localhost/coreos-assembler
$ coreos-assembler init https://github.com/coreos/fedora-coreos-config.git
$ coreos-assembler fetch && coreos-assembler build
$ cosa init https://github.com/coreos/fedora-coreos-config.git
$ cosa fetch && cosa build
```

#### Using different CA certificates
Expand All @@ -267,7 +271,7 @@ using the `COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS` variable.

```
$ export COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS='-v /etc/pki:/etc/pki:ro'
$ coreos-assembler init https://github.com/coreos/fedora-coreos-config.git
$ coreos-assembler fetch && coreos-assembler build
$ cosa init https://github.com/coreos/fedora-coreos-config.git
$ cosa fetch && cosa build
```
See this [Stack Overflow question](https://stackoverflow.com/questions/26028971/docker-container-ssl-certificates) for additional discussion.