1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-06 00:45:22 +01:00

57 Commits

Author SHA1 Message Date
HuijingHei
e08bc29784 filetree: add failpoint when doing exchange
Inspired by https://github.com/coreos/bootupd/pull/669#issuecomment-2220760948
2024-08-05 09:44:01 +08:00
HuijingHei
d26845a6f0 ci: minor updates
- Remove fast track for `virtiofsd` as higher version is installed
- Update `grub2` to newer version in ci testing
2024-07-10 16:40:05 +08:00
HuijingHei
261fb5e7f2 Drop systemd service
Fixes https://github.com/coreos/bootupd/issues/551

Get hints by https://github.com/coreos/bootupd/issues/551#issuecomment-2124477922,
and copy the comment here:
Basically we detect if we're running in systemd; if we're not,
we re-exec ourselves via systemd-run. Then we can just directly
run code in what is now the daemon.

I think an important aspect of this is that we retain something
like `--unit bootupd` which acts as a lock - only one unit with
that name can run at a time to avoid two concurrent invocations
breaking things.
2024-05-29 21:36:13 +08:00
HuijingHei
104c9ff904 ci: fix failed log 2024-05-16 10:47:22 +08:00
Colin Walters
17c5628812 Print previous version too when updating
Keep current format to avoid having to update Fedora CoreOS tests as
well.

Based on: https://github.com/coreos/bootupd/pull/472
Co-authored-by: Colin Walters <walters@verbum.org>
Closes: https://github.com/coreos/bootupd/issues/445
2024-04-19 19:25:23 +02:00
Dusty Mabe
65670572aa coreos: update aleph version handling
In https://github.com/osbuild/osbuild/pull/1475 we are updating
aleph version to have more information and some of the fields
are changing slightly. Notably here `imgid` is no longer going to
be populated and `build` -> `version` now. Let's make these tweaks
and also just drop any fields from the definition here that we
aren't using to tolerate changes better.
2023-12-18 17:28:26 -05:00
Colin Walters
d07dd17013 ci: Adapt for Fedora 39
Part of the every-6-months CI breakage.
2023-11-19 11:35:31 -05:00
Colin Walters
ffbe10c1db ci: use explicit path
This may be a regression from the virtiofs work.
2023-09-19 12:10:30 -04:00
Colin Walters
8ac4aa1607 ci: Use f37 for overrides
This should fix CI.
2022-12-20 16:47:15 -05:00
Colin Walters
d26202d89b Statically enable bootupd.socket
The fact that we're a systemd unit is mostly an implementation
detail so that we get a natural locking mechanism and
can reuse systemd sandboxing.

If you have the software installed, we want the socket to be
enabled.

Having to work through adding this into presets is just
compounding pain for shipping it in multiple places.

Instead, install a static symlink.
2022-11-01 10:23:38 -04:00
Benjamin Gilbert
07b1d03afa tests/e2e-update: s/fcct/butane/ 2021-12-09 09:39:21 -05:00
Colin Walters
a53f6ef7f8 ci: Drop adoption test
Trying to boot FCOS-Fedora-32 is not sustainable; it turns
out that the recent update to coreos-assembler which passes
a newer Ignition config version broke the adoption test.

In the end, the adopt workflow was really a hack and I'd like
to slowly deprecate it.

In general, most people should be reprovisioning nodes anyways.
Once they do that, they'll pick up the updated shim/grub naturally.
2021-12-08 17:59:58 -05:00
Colin Walters
0b459f9930 ci: Bump to F35 grub
This is the F35 equivalent of
https://github.com/coreos/bootupd/pull/203

Closes: https://github.com/coreos/bootupd/issues/242
2021-11-29 13:07:38 -05:00
Colin Walters
16312def35 tests/e2e-update: Bump to f34 grub
Need to tweak this to auto-detect gold versus updates, or
probably better just synthesize an update.
2021-09-03 07:40:38 -04:00
Colin Walters
a2d715b32f ci: Archive console.txt
So we can debug this.
2021-09-03 07:40:38 -04:00
Colin Walters
9c9c3eda5b ci: Drop unnecessary rerun of make+make install
Closes: https://github.com/coreos/bootupd/issues/193

When we switched to a split buildroot/cosa containers, this
broke.  We can just delete this line because the code-under-test is in
`overrides/rootfs`, so doing `rm overrides/rpm/*` won't remove it.
2021-08-16 10:28:52 -04:00
Colin Walters
70a0effa2d ci: Add Prow-oriented CI flow
This is copied/adapted from rpm-ostree.  I'm mainly doing
this to prove out adding another GH repo using the nested
virt support.

As part of this, add the "standard" `tests/kolainst` directory
that just copies in our un-installed tests.
2021-03-09 19:35:49 +01:00
Kelvin Fan
402bc6ca6a tests: Mount ESP before operations
Following https://github.com/coreos/fedora-coreos-config/pull/794,
the ESP will no longer be mounted in /boot. Adjust tests to mount
it before reading from it.
2021-01-05 15:33:16 -05:00
Kelvin Fan
b0b6cb607e tests: Remount /boot and /boot/efi as rw
In the future, FCOS' /boot and /boot/efi may be read-only.
Remount them as read-write before attempting to write to those
locations.
2020-12-02 00:04:58 +01:00
Colin Walters
7be8eb204c Add bootupctl status --print-if-available
This is a middle ground between:

1) Parse arbitrary text output from `bootupctl status`; this could
   change at any time.
2) Parse JSON from `bootupctl status --json`; parsing this requires
   knowlege of bootupd and the JSON format still isn't 100% fixed
   in stone either.

Projects like https://github.com/openshift/machine-config-operator/
will basically want a flow that just allows them to check for
outstanding updates and apply them one node at a time.
2020-11-16 14:28:30 +01:00
Colin Walters
9873aaa8a0 tests: Add a serialization test for adoptable data
Pointed out in code review in https://github.com/coreos/bootupd/pull/104
2020-11-13 19:59:40 +01:00
Colin Walters
e00de4a6b6 Update all {F,RH}CoreOS systems that have an aleph version
Came up in review in https://github.com/coreos/fedora-coreos-docs/pull/203
Basically it's confusing to users that they need to understand
the difference between `update` and `adopt-and-update`.

From bootupd's perspective these are quite different things;
the first case is a completely known quantity, the second isn't.

However...we can be pretty confident that we can update systems
that have a CoreOS aleph version (i.e. they were generated by coreos-assembler),
since we haven't changed how the bootloader is installed there
really much at all.

This means that for now RHCOS 4.{1,2} bootimages that were
generated via Anaconda will still require `adopt-and-update`,
but detecting and validating that can come as a second phase.

The high level logic here is that the status gains a new
`confident: bool` flag (which corresponds right now to
"have CoreOS aleph").  The client side looks at this
and automatically bridges the `update` CLI to
`adopt-and-update`.

Closes: https://github.com/coreos/bootupd/issues/103
2020-11-13 17:38:33 +01:00
Colin Walters
bfb2ce6aaf Parse old "0.1" format installed state format
Since bootupd 0.1.1 shipped in FCOS stable
we need to support updating it, as well as
"pre-bootupd" systems and bootupd 0.2 systems.

I tested this manually; not yet adding an e2e yet for
this because our test suite is already really
expensive and the unit test covers most of it.

Closes: https://github.com/coreos/bootupd/issues/91
2020-10-29 03:44:09 -04:00
Colin Walters
7161a34a53 Drop requirement for BOOTUPD_ACCEPT_PREVIEW=1
I'm increasingly confident in our testing, so let's
drop the requirement to set the environment variable.
2020-10-14 09:36:08 +02:00
Colin Walters
6d9d2e36a4 Implementation of adoption
So far we've supported updating systems that we installed,
but we also need to handle updating at least older CoreOS
systems.

This shares a lot of similarity with `update`; the biggest
difference is that we aren't sure which files we should
be managing.  So given a pending update, we only replace
files that exist in that update.

Closes: https://github.com/coreos/bootupd/issues/38
2020-10-13 19:39:55 +02:00
Colin Walters
9fb4418764 Drop operating system from status, print client side
For now let's address concerns over how we represent
the operating system by dropping them from the status
JSON.  Instead detect CoreOS specifically client side
too and print the aleph there.
2020-10-12 11:27:44 -04:00
Colin Walters
4a07ead918 model: Deny unknown fields, add test for status json
There's no reason for us to ever parse unknown fields
in status JSON, so let's deny it.

Related, we do want tooling to parse `bootupctl status --json`, so let's
add a test to validate we're not unexpectedly breaking it.
2020-10-09 04:32:12 -04:00
Colin Walters
8d8c06b2aa Merge pull request #62 from cgwalters/rename-e2e
Rename tests/e2e → tests/e2e-update
2020-10-06 17:58:49 -04:00
Colin Walters
20d4aaa6ff status: Fix indentation of CoreOS aleph image ID
If it's indented it looks like it's part of the EFI component.
2020-10-06 16:19:56 -04:00
Colin Walters
97753fd84d Rename tests/e2e → tests/e2e-update
I plan to add another test `e2e-adopt` for the case of going
from a known disk image not using bootupd initially.
2020-10-06 13:40:21 -04:00
Colin Walters
536aca6b15 Parse and print CoreOS aleph version
This is prep for work on "adoption":
https://github.com/coreos/bootupd/issues/38

In order to (as safely as possible) take over management
of a system *not installed via bootupd* we want to gather
as much information as we can.

For example, we can use the imgid as the "version" of the
current bootloader data.
2020-10-06 11:28:30 +02:00
Colin Walters
8dea81707d state: Consistently kebab-case and validate a previous saved format
I noticed we were missing `kebab-case` on a few structs (but
it doesn't matter since none of them have a name that would change).

To ensure we don't regress on parsing old file formats, add a JSON
file from a current system and test loading it.
2020-10-05 19:25:26 +02:00
Colin Walters
784189cb64 tests/e2e: Validate adding a new RPM
With new content.  This helps test things more.
2020-10-02 09:20:59 -04:00
Colin Walters
ac3cd8d6f4 daemon: Exit when done processing requests
There's no reason to sit there taking up RAM just because
someone did `bootupctl status`.  Properly implementing
exit-on-idle really requires an event loop (e.g. `tokio`)
but that'd be a large change.

For now let's just exit when a client disconnects.  However,
this quickly broke the test suite which does a lot of
commands in a row.

Tweak the systemd unit to allow more restarts, and also
add a few strategic sleeps.

Closes: https://github.com/coreos/bootupd/issues/43
2020-10-02 03:38:33 -04:00
Colin Walters
51f4f89831 Add a more realistic e2e upgrade test
The way we generate updates uses the timestamp and version
numbers from the set of RPMs.
2020-10-01 11:16:20 -04:00
Luca BRUNO
3658f5aafe cli: rework into a multicall binary
This reworks the CLI options parser to branch the inner logic
to accommodate two entrypoints, `bootupd` and `bootupctl`, into
a single multicall binary.
2020-09-25 12:58:43 +00:00
Colin Walters
4444591165 Add a validate command
Let's add support for checking the on-disk state.  This helps
cross-check our implementation and is also useful for administrators
(ref `ostree fsck`, `rpm -V` etc).
2020-09-24 15:35:59 +00:00
Colin Walters
ce2ce0ae4d Make version number not optional
There's no good reason to have version numbers be optional.
They're essential for human understanding of things.

We still use a timestamp around for total ordering.

Rework the model to more precisely keep track of "upgradable".
2020-09-23 15:42:29 +00:00
Colin Walters
80664ca246 update: Require BOOTUPD_ACCEPT_PREVIEW in environment
Further ensure admins don't accidentally try this until we've
tested it very heavily.
2020-09-22 18:19:08 +00:00
Colin Walters
918d5efef7 tests: Validate that we can't run bootupd as non-root
Perhaps in the future we'll allow non-root status but
that's a lot more code complexity, no immediate need
for it.
2020-09-21 17:00:46 -04:00
Colin Walters
0cb6012d8c Move more update logic to client side
Similar to the previous move of `status`, return a structure
from the daemon and render it on the client.  This actually
moves more logic for updating to the client too; the IPC request
updates just one component, and the client iterates over all
installed components to update.

This way we also better return "partial" status.
2020-09-21 10:15:46 -04:00
Colin Walters
dbe4b01783 Move formatting of status to client
The way we were just serializing a `String` from daemon → client
was rather...crude.  Instead have the daemon return a serialized
status object which we print on the client end.
2020-09-21 10:15:46 -04:00
Colin Walters
721b887e20 Move binary to /usr/bin/bootupctl
A good way to look at what we need is something much like
systemd's `bootctl` except for shim/grub2.

It's not as nice for admins to explicitly type
`/usr/libexec/bootupd`, plus it intermixes options
with things they shouldn't use.

Move the "backend" options to a hidden `backend` verb for now.
2020-09-15 21:48:12 +00:00
Colin Walters
5c23caf0dd Fix update, clippy warnings, and start passing test suite
The test suite now passes again and has somewhat basic reasonable
coverage.
2020-09-04 13:59:22 +00:00
Colin Walters
8c53933f42 Major rewrite/simplification
The previous code ended up being fairly wrong in various ways.
It was trying to be too abstract - let's keep *some* level
of abstraction but just implement EFI for now.

Among other changes, this now correctly works when inserted
into the rpm-ostree flow and also the coreos-assembler flow.
2020-09-02 20:19:56 +00:00
Colin Walters
cfb673ab32 Consistently accept components as non-option args
We were inconsistent.
2020-06-24 22:18:32 +00:00
Colin Walters
a4c46bacb7 Rework to have everything run via daemon
A bit ugly (manual protocol over bincode, serializing our prints
into a string buffer) but gets us closer to where we need to be.
2020-06-24 21:57:12 +00:00
Colin Walters
2483a19f8f Drop sysroot bits for update/adopt/status
Because we run as a daemon now it doesn't make sense.
And drop the old test.
2020-06-24 17:01:43 +00:00
Colin Walters
c6bf680e98 tests: Extend with updates 2020-06-24 13:29:15 +00:00
Colin Walters
b5ffe13736 tests/kola: Extend a bit 2020-06-24 11:51:47 +00:00