Commit Graph

1159 Commits

Author SHA1 Message Date
Colin Walters
d3d3e4ea13 Add an ostree-boot-complete.service to propagate staging failures
Quite a while ago we added staged deployments, which solved
a bunch of issues around the `/etc` merge.  However...a persistent
problem since then is that any failures in that process that
happened in the *previous* boot are not very visible.

We ship custom code in `rpm-ostree status` to query the previous
journal.  But that has a few problems - one is that on systems
that have been up a while, that failure message may even get
rotated out.  And second, some systems may not even have a persistent
journal at all.

A general thing we do in e.g. Fedora CoreOS testing is to check
for systemd unit failures.  We do that both in our automated tests,
and we even ship code that displays them on ssh logins.  And beyond
that obviously a lot of other projects do the same; it's easy via
`systemctl --failed`.

So to make failures more visible, change our `ostree-finalize-staged.service`
to have an internal wrapper around the process that "catches" any
errors, and copies the error message into a file in `/boot/ostree`.

Then, a new `ostree-boot-complete.service` looks for this file on
startup and re-emits the error message, and fails.

It also deletes the file.  The rationale is to avoid *continually*
warning.  For example we need to handle the case when an upgrade
process creates a new staged deployment.  Now, we could change the
ostree core code to delete the warning file when that happens instead,
but this is trying to be a conservative change.

This should make failures here much more visible as is.
2022-04-26 13:02:46 -04:00
Colin Walters
b92dbc49f0 ci: Mask zincati for synthetic update
Our CI started falling over because coreos-assembler checks
for units stuck activating as of https://github.com/coreos/coreos-assembler/pull/2810

Really need to centralize the code for this and fix the root
problem, but...not today.

xref https://github.com/coreos/coreos-assembler/pull/2814
2022-04-20 20:23:10 -04:00
Luca BRUNO
7e83726faa
tests: move fixture to fix installed tests
This moves around the packed archive for bare-split-xattrs mode,
in order to fix installed tests.
2022-04-12 09:53:54 +00:00
Jan Tojnar
1898019fac tests/test-cli-extensions: Fix with single-binary coreutils
On systems where `coreutils` are built with `--enable-single-binary=symlinks` like Nix,
`/usr/bin/env` is symlinked to `/usr/bin/coreutils` and uses `argv[0]` to determine which program to run.
Since the `test-cli-extensions.sh` created a new symlink named `ostree-env`,
coreutils would be confused about the utility to choose, so running it would fail:

	ostree-env: unknown program ‘ostree-env’
	Try 'ostree-env --help' for more information.

Fixes: https://github.com/ostreedev/ostree/issues/2553
2022-03-26 10:55:42 +01:00
Jonathan Lebon
73bc62cac3
Merge pull request #2528 from cgwalters/test-crate-update 2022-03-14 15:20:54 -04:00
Colin Walters
afdc84b97b Update to sh-inline 0.2
Syncing up with the latest.
2022-03-14 09:54:48 -04:00
Daniel Kolesa
aca9e8e6a7 glib: bump glib requirement to 2.66 and port to GUri
This removes the old SoupURI copypasta from previous generation
of libsoup and opens up a path for a simple libsoup3 port.
2022-03-12 04:44:18 +01:00
Colin Walters
75ae283f23 Update to rand 0.8
Part of general crate updates.
2022-03-11 15:34:59 -05:00
Colin Walters
fba7efb6da Update to ostree-ext 0.6
Part of general crate updates.
2022-03-11 15:33:02 -05:00
Colin Walters
34d1bcc68a Update to nix 0.23
Part of general crate updates.
2022-03-11 15:32:27 -05:00
Colin Walters
b6d1119f91 tests: Stop using inventory crate
I was reading this thread
https://internals.rust-lang.org/t/from-life-before-main-to-common-life-in-main/16006/30
and that reminded me about this code, which it turns out actually
doesn't compile with my default local cargo config:
```
$ cat ~/.cargo/config
[target.x86_64-unknown-linux-gnu]
rustflags = ["-Ctarget-cpu=native", "-C", "link-arg=-fuse-ld=lld"]

[profile.release]
incremental = true
$ cargo b
...
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/var/srv/walters/src/github/ostreedev/ostree/target/debug/deps/ostree_test-4ca8e730f9dc6ffc.10325uqlhkyr5uol.rcgu.o" "/var/srv/walte"
  = note: ld.lld: error: undefined symbol: __start_linkme_NONDESTRUCTIVE_TESTS
          >>> referenced by 22nn09lfsklfqvyy
          >>>               /var/srv/walters/src/github/ostreedev/ostree/target/debug/deps/ostree_test-4ca8e730f9dc6ffc.22nn09lfsklfqvyy.rcgu.o:(ostree_tes)

```

For now let's just go back to having a static list of functions.
We don't have *too* many of those.
2022-03-11 14:53:29 -05:00
Colin Walters
0d020a7145 tmpfiles: Create /run/ostree
This is referenced by 9645cee4f2/lib/src/globals.rs (L16)
specifically used for the (container image) pull secret in
`/run/ostree/auth.json`.

Let's pre-create the directory so users don't have to.

Motivated by https://github.com/openshift/machine-config-operator/pull/3007#discussion_r824172564
2022-03-11 13:08:23 -05:00
Simon McVittie
92ca2c7794 test-prune: Read to the end of cut(1) output
If we use head(1) to take only the first two lines, then cut(1) and
earlier pipeline entries are killed by SIGPIPE (if they have not already
terminated), and that's flagged as an error under `set -o pipefail`.
Use an equivalent sed command to take exactly the second line, but
without SIGPIPE.

Signed-off-by: Simon McVittie <smcv@debian.org>

Gbp-Pq: Name test-prune-Read-to-the-end-of-cut-1-output.patch
2022-03-07 23:03:33 +00:00
Colin Walters
fbc6d21c2f Release 2022.2 2022-03-03 18:44:30 -05:00
Luca BRUNO
aca5671eb1
tests/basic-bare-split-xattrs: add fixture, check read logic 2022-03-03 11:11:59 +00:00
Luca BRUNO
7e79b82ff8
lib/commit: disallow writing content in 'bare-split-xattrs' mode
This prevents writing content into 'bare-split-xattrs` repository,
while carving some space for experimenting via a temporary
`OSTREE_EXP_WRITE_BARE_SPLIT_XATTRS` environment flag.
2022-03-02 16:45:02 +00:00
Luca BRUNO
08e98e9042
lib/core: introduce 'bare-split-xattrs' mode 2022-03-02 16:45:00 +00:00
Saqib Ali
cf66eaccee tests/test-prune.sh: Use TAP API
Change tests to use the newer TAP API introduced
in https://github.com/ostreedev/ostree/pull/2440
2022-02-25 18:32:25 -05:00
Saqib Ali
18ab5361b9 tests/test-prune.sh: expand testing for --commit-only
Let's add additional tests to expand the test
suite for the new --commit-only functionality.
2022-02-25 18:32:25 -05:00
Dan Nicholson
6fbf759279 lib/repo: Add commit version metadata to summary metadata
The commit metadata `version` key is well established but getting it for
a remote commit is cumbersome since the commit object needs to be
fetched and loaded. Including it in the summary additional metadata
allows a much more convenient view of what each of the remote refs
represents.
2022-02-04 14:28:11 -07:00
Jonathan Lebon
5bf57ec062 tests/kolainst: Avoid recursive symlinks
`kola` now follows symlinks when archiving an external test's `data/`
dir. So the recursive `data` symlink we have here breaks it.

Let's just move the shared files in its own directory and update the
symlinks.
2022-01-25 16:44:39 -05:00
Jonathan Lebon
baf838de22 ostree/deploy: Test finalization locking
Support for that file was added previously, but the testing lived in
rpm-ostree only. Let's add it here too.

In the process add a hidden `--lock-finalization` to `ostree admin
deploy` to make testing easier (though it could also be useful to update
managers driving OSTree via the CLI).
2022-01-21 13:48:35 -05:00
Luca BRUNO
da72c245f4
lib/commit: reject empty metadata keys
This adds one more check to the metadata validation logic in order
to reject empty metadata keys.
2022-01-20 10:54:30 +00:00
Colin Walters
998154f8ff main: Also support CLI extensions in /usr/libexec/libostree/ext
In fixing https://github.com/coreos/rpm-ostree/pull/3323
I felt that it was a bit ugly we're installing `/usr/bin/ostree-container`.

It's kind of an implementation detail.  We want users to use
`ostree container`.

Let's support values outside of $PATH too.

For example, this also ensures that TAB completion for `ost` expands
to `ostree ` with a space.
2022-01-11 20:13:33 -05:00
Luca BRUNO
0bdba574d7
ostree: check g_setenv return value
This adds proper return-value checks on g_setenv calls.
It fixes a static analysis warning highlighted by Coverity.
2022-01-10 13:33:36 +00:00
Colin Walters
d2f5a0476f tests: Fix clang-analyzer not seeing through g_error()
Basically due to the glib structured logging rework we lost the
`noreturn` attribute on `g_error()`.
This is fixed in glib as of f97ff20adf

But we might as well just throw an error here.
2021-12-21 15:14:34 -05:00
Luca BRUNO
5dbe37ce78
tests/cli-extensions: tweak test logic
This updates the test logic for CLI extensions, actually checking
for functional output from the subcommand.
It also cleans up some environmental leftover.
2021-12-21 10:18:30 +00:00
Luca BRUNO
513b3c09a5
main: add support for CLI extensions via external binaries
This adds some logic to detect and dispatch unknown subcommands to
extensions available in `$PATH`. Additional commands can be
implemented by adding relevant `ostree-$verb` binaries to the system.

As an example, if a `/usr/bin/ostree-extcommand` extension is provided,
the execution of `ostree extcommand --help` will be dispatched to that
as `ostree-extcommand extcommand --help`.
2021-12-20 10:00:02 +00:00
Luca BRUNO
f44eaf7e8c
tests: assert mandatory values are present
This adds a couple of string assertions to make sure that
the test run is sane.
2021-12-10 11:33:35 +00:00
Joseph Marrero
581a58067b Update FSF license notices to use URL instead of address 2021-12-07 08:34:25 -05:00
Luca BRUNO
cefc1d7854
lib: misc static analysis fixes
This fixes a few warnings from coverity, none of which really
interesting.
2021-11-26 15:11:00 +00:00
Luca BRUNO
f93d96620c
tests/var-mount: tweak test setup
This reworks the var-mount destructive test in order to properly use
the datadir for the current stateroot instead of a duplicated one.
In turn, it ensures that the resulting `var.mount` after reboot is
correctly pointing to the same location which hosted `/var` on the
previous boot.
2021-10-19 08:03:09 +00:00
Colin Walters
58dc6a08b4 tests/rollsum: Use g_malloc not malloc
To pacify gcc's `-fanalyzer`.
2021-10-18 11:44:44 -04:00
Colin Walters
307707c3a0
Merge pull request #2459 from smcv/test-commit-sign
test-commit-sign.sh: Skip a unit test when running as an installed-test
2021-10-06 15:26:08 -04:00
Simon McVittie
92ed1857ae test-commit-sign.sh: Skip a unit test when running as an installed-test
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-10-05 23:51:55 +01:00
Colin Walters
63bf5e606b Release 2021.5 2021-10-05 15:59:43 -04:00
Colin Walters
e6a560b407 deploy: Ignore sockets, fifos in /etc during merge
https://bugzilla.redhat.com/show_bug.cgi?id=1945274 is an issue where a privileged
kubernetes daemonset is writing a socket into `/etc`.  This makes ostree upgrades barf.

Now, they should clearly move it to `/run`.  However, one option is for us to
just ignore it instead of erroring out.  Some brief investigation shows that
e.g. `git add somesocket` is a silent no-op, which is an argument in favor of ignoring it.

Closes: https://github.com/ostreedev/ostree/issues/2446
2021-10-01 11:28:11 -04:00
Jonathan Lebon
d61a499163
Merge pull request #2450 from cgwalters/revdep-ext-ci 2021-09-30 16:15:45 -04:00
Colin Walters
bcc0ef7583 tests: Use ostree-ext 0.3.0
This updates to the modern glib 0.14 and paves the way for
some reverse dependency testing by using ostree-ext's code.
2021-09-30 13:38:25 -04:00
Colin Walters
ab12e380fc bin/commit: Fix --tree=tar with --selinux-policy
The logic for `--selinux-policy` ended up in the `--tree=dir`
path, but there's no reason for that.  Fix the imported
labeling with `--tree=tar`.  Prep for use with containers.

We had this bug because the previous logic was trying to avoid
duplicating the code for generic `--selinux-policy` and
the case of `--selinux-policy-from-base --tree=dir`.

It's a bit more code, but it's cleaner if we dis-entangle them.
2021-09-30 11:44:27 -04:00
Colin Walters
bc30806c6e tests: Add new TAP APIs
Having to touch a global test counter when adding tests is
a recipe for conflicts between PRs.

The TAP protocol allows *ending* with the expected number of
tests, so the best way to do this is to have an explicit
API like our `tap_ok` which bumps a counter, then end with `tap_end`.

I ported one test as a demo.
2021-09-10 17:07:42 -04:00
Colin Walters
213b8608ea tests/pull-test: Avoid duplicating test numbers
We do this in other places; avoids touching two numbers when
adding tests.  Let computers do the addition.
2021-09-10 17:07:38 -04:00
Colin Walters
55090f108d Release 2021.4 2021-09-08 14:00:12 -04:00
Colin Walters
ce36e05d38
Merge pull request #2434 from cgwalters/custom-remote
Add support for "custom remotes"
2021-09-08 09:27:26 -04:00
Colin Walters
511c7a13ee Add support for "custom remotes"
This will be helpful for the "ostree native container" work in
https://github.com/ostreedev/ostree-rs-ext/

Basically in order to reuse GPG/signapi verification, we need
to support adding a remote, even though it can't be used via
`ostree pull`.  (At least, not until we merge ostree-rs-ext into ostree, but
 even then I think the principle stands)
2021-09-08 07:42:25 -04:00
Colin Walters
8821ec6e56 upgrade: Stabilize deployment staging
We're waaay overdue for this, it's been the default
in rpm-ostree for years, and solves several important bugs
around not capturing `/etc` while things are running.

Also, `ostree admin upgrade --stage` (should) become idempotent.

Closes: https://github.com/ostreedev/ostree/issues/2389
2021-09-07 16:12:43 -04:00
Luca BRUNO
fff24089dd
tests: skip a broken fsck case
There are some existing issues around fsck in unprivileged bare mode,
so this test does not really work at the moment. Leaving it as a FIXME
for the moment.
2021-09-06 07:52:42 +00:00
Luca BRUNO
aa0bb176c5
tests/basic: avoid changing ownership
This avoids possible issues when trying to chmod, tweaking
permissions instead.
2021-09-06 07:41:02 +00:00
Colin Walters
9f5b636990
tests/basic: Skip --no-xattrs if we have selinux
It cannot work to use `--no-xattrs` when SELinux is enabled
because we get a `security.selinux` attribute on created files
regardless.  So just skip this test if true.

Also add some `ostree fsck`s in here which helped me debug
this.
2021-09-06 07:41:01 +00:00
Luca BRUNO
27fcee861a
libtest: tweak selinux/relabel message 2021-09-06 07:41:00 +00:00