Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example deploying from an encapsulated ostree commit #5

Open
wants to merge 17 commits into
base: dusty-fedora-coreos
Choose a base branch
from

Conversation

lukewarmtemp
Copy link

Instead of calling from a remote repository, this example uses an ostree commit constructed in a previous stage of the pipeline and encapuslates it into an oci-archive. This oci-archive is then used to deploy the OS. By doing this, we work around the problem of relying on remote repositories in a testing context.

dustymabe and others added 17 commits October 9, 2023 13:08
Similar to the cleanups in 4e99e80, let's start using the library
code for the calls to ostree here.
Similar to the cleanups in 4e99e80, let's start using the library
code for the calls to ostree here.
This moves the setup_remote function from the ostree source into
util/ostree. This is prep for sharing this function with an mpp
helper in the future.
This will make it easier to resolve OSTree refs into commits similar
to how mpp-resolve-images works for container image references to
SHA256 digests.
This adds a Fedora CoreOS manifest that uses the recently
added mpp-resolve-ostree-commits osbuild-mpp functionality.
With these changes you can now run:

```
osbuild-mpp /path/to/fedora-ostree-image.mpp.yaml /tmp/output.json
sudo osbuild /tmp/output.json  --store store/ --output-directory out/ --export qcow2
```

Then the disk will be in `out/qcow2/disk.qcow2`.

Right now we need to delete the `root=LABEL=root` kernel argument
since FCOS doesn't work well on first boot with that argument:

```
virt-edit -a disk.qcow2 -m /dev/sda3 /loader.1/entries/ostree-1-fedora-coreos.conf -e 's/root=LABEL=root//'
```

Now you can feed this disk into `cosa` using `--qemu-image`:

```
cosa run -c --qemu-image=disk.qcow2
cosa kola run --parallel=5 --qemu-image=disk.qcow2
```
My original calculations were wrong.

Also let's set a size for the root partition for now otherwise it will
fill the disk which isn't what we want.
These aren't set in FCOS images today.
For FCOS for now we use COSA as our build environment. There's really
no reason for us to build a "builder" and worry about controlling those
inputs when we already have everything we need in COSA and controls for
the inputs there.
It's no longer required by the ostree.deploy stage and it's not
what we want for FCOS anyway because we rely on the root= kernel
argument not being there on first boot of FCOS.
There are a bunch of failures when these commands run and it's annoying.
I started a thread in the ImageBuilder matrix channel to try to
understand why we can't override the runner for a non 'build' pipeline.
For now let's just delete the calls because AFAICT we don't need them.
skopeo needs to access /etc/containers/policy.json
The ostree.deploy stage now accepts either a ostree input:

```
```

or a containers input:

```
      - type: org.osbuild.ostree.deploy
        options:
          osname: fedora-coreos
          mounts:
            - /boot
            - /boot/efi
          kernel_opts:
            - rw
            - console=tty0
            - console=ttyS0
            - ignition.platform.id=qemu
            - '$ignition_firstboot'
        inputs:
          images:
            type: org.osbuild.containers
            origin: org.osbuild.source
            mpp-resolve-images:
              images:
                - source: quay.io/fedora/fedora-coreos
                  tag: stable
                  name: quay.io/fedora/fedora-coreos:stable
```

In the containers input case we will run `ostree container image deploy`
wheras for ostree commits input we will continue to execute `ostree admin deploy`.

Co-authored-by: Dusty Mabe <[email protected]>
Instead of calling from a remote repository, this example uses an
ostree commit constructed in a previous stage of the pipeline and
encapuslates it into an oci-archive. This oci-archive is then used
to deploy the OS. By doing this, we work around the problem of relying
on remote repositories in a testing context.
@dustymabe dustymabe force-pushed the dusty-fedora-coreos branch 5 times, most recently from 27a23df to 4608b1c Compare October 24, 2023 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants