Commit graph

2492 commits

Author SHA1 Message Date
Simon de Vlieger
f371651d66 depsolve-dnf: enable weak deps selection
The import of `dnf-json` came from `osbuild-composer`, as we sadly
have/had multiple copies this wasn't the *right* version as it was
lacking previous work to disable weak dependencies.
2023-10-26 15:11:24 +02:00
Dusty Mabe
d4b3e3655d objectstore: also mount /etc/containers for "host" buildroot
In the case we are not using a buildroot (i.e. we are using
the host as the buildroot) let's also mount in /etc/containers
into the environment. There are sometimes where software running
from /usr can't operate without configuration in /etc and this
will allow it to work.

An example of software hitting this problem is skopeo. With a
simple config like:

```
version: '2'
mpp-vars:
  release: 38
pipelines:
  - name: skopeo-tree
    # build: name:build
    source-epoch: 1659397331
    stages:
      - type: org.osbuild.skopeo
        inputs:
          images:
            type: org.osbuild.containers
            origin: org.osbuild.source
            mpp-resolve-images:
              images:
                - source: quay.io/fedora/fedora-coreos
                  tag: stable
                  name: localhost/fcos
        options:
          destination:
            type: containers-storage
            storage-path: /usr/share/containers/storage
```

We end up hitting an error like this:

```
time="2023-10-24T18:27:14Z" level=fatal msg="Error loading trust policy: open /etc/containers/policy.json: no such file or directory"
Traceback (most recent call last):
  File "/run/osbuild/bin/org.osbuild.skopeo", line 90, in <module>
    r = main(args["inputs"], args["tree"], args["options"])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/osbuild/bin/org.osbuild.skopeo", line 73, in main
    subprocess.run(["skopeo", "copy", image_source, dest], check=True)
  File "/usr/lib64/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['skopeo', 'copy', 'dir:/tmp/tmp5_qcng99/image', 'containers-storage:[overlay@/run/osbuild/tree/usr/share/containers/storage+/run/containers/storage]localhost/fcos']' returned non-zero exit status 1.
```

This PR adds in a mount for /etc/containers from the host so that
/etc/containers/policy.json can be accessed.
2023-10-25 22:05:54 +02:00
schutzbot
5579257c65 Post release version bump
[skip ci]
2023-10-25 08:14:34 +00:00
Dusty Mabe
41652343a4 manifests: add fedora-coreos-container example/test
This example shows how to build a qcow2 very similar to the one
delivered by Fedora CoreOS. It uses an input container that has
the Fedora CoreOS OSTree already baked into it, which means that
the OSTree isn't built using this manifest, but taken as an input
from a remote registry.
2023-10-24 13:46:10 -04:00
Dusty Mabe
da07300f38 stages/ostree.deploy: create ostree_commit_deploy function
This drains some of the logic out of `main()` into a
`ostree_commit_deploy()` function. Doing this will make it easier
to diff this stage with the recently added `ostree.deploy.container`
stage.

This commit also changes the `ref` in the schema to be optional,
which is a fixup for 3cc733d. We need to make the ref optional because
the ref could come from the user in the toplevel schema or it could
come from input commit in the schema.
2023-10-24 13:46:10 -04:00
Luke Yang
f9a039d068 stages: add ostree.deploy.container stage
This stage is similar to ostree.deploy, but deploys from a container
image rather than from an OSTree commit by using the `ostree container
image deploy` command. An example stage definition could look like:

```
  - type: org.osbuild.ostree.deploy.container
    options:
      osname: fedora-coreos
      target_imgref: ostree-remote-registry:fedora:quay.io/fedora/fedora-coreos:stable
      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
```

Co-authored-by: Dusty Mabe <dusty@dustymabe.com>
2023-10-24 13:46:10 -04:00
Dusty Mabe
49acf488af stages/ostree.deploy: add description for commits input 2023-10-24 13:46:10 -04:00
Achilleas Koutsou
dd2aa57987 test: update stage diffs
Diffs for stage tests have changed after the sources were updated.
Update them to match expected behaviour.
2023-10-21 07:34:32 +02:00
Dusty Mabe
ca3b831c29 manifests/fedora-vars: bump snapshot date
This should correspond to the snapshots from 6b85149.
2023-10-21 07:34:32 +02:00
Evgeny Kolesnikov
c4de5389e7 stages/oscap.remediation: Properly utilize offline capabilities
The scanner will now properly react to the chroot environment. Also,
there are some optimizations to logs and results.
2023-10-19 12:43:57 +02:00
Dusty Mabe
b32ddc4136 tools/osbuild-mpp: include container tag in default name
In case the tag was something other than `:latest` let's include the
tag in the default name.
2023-10-18 19:55:26 +02:00
Michael Ho
258735d8a6 test/stages/users: make test data date agnostic
The test for this stage is failing because etc/shadow changes content
depending on the date that it runs on (due to the "date of last password
change" field). This causes the checksums to not be constant for our
tests and depends on the date.

This commit removes the checksums for etc/shadow from the test so that
they are not checked as part of the test. This worksaround the test
failure issue for now until a solution to the dynamic contents is
determined.

Signed-off-by: Michael Ho <michael.ho@ieee.org>
2023-10-18 13:56:20 +02:00
Alexander Larsson
745f86c94c tools/osbuild-mpp: Really fix empty ostree commit object in deploy stage
The fix in 980ca03685 ensured that
no empty commit object was changed, but it still created an (empty)
input object, which causes failures, like:
 https://gitlab.com/CentOS/automotive/sample-images/-/merge_requests/388

We need to move the check before the line that adds the empty default
input object.
2023-10-17 14:02:39 +02:00
Simon de Vlieger
7c35b945ee depsolve: import dnf-json
Import the `dnf-json` Python script that is included in the "images" and
"osbuild-composer" repository into "osbuild".

`dnf-json` provides dependency solving capabilities by taking in some
JSON and then outputting the package set that JSON resolves to. Since it
is a Python script it moves into a subpackage of `osbuild`.

The script is renamed to `osbuild-depsolve-dnf`.
2023-10-16 20:47:17 +02:00
Luke Yang
980ca03685 tools/osbuild-mpp: Fix empty ostree commit object in deploy stage
This adds an early return to the `_process_ostree_commits` function to
prevent an empty ostree commit object from being created in the deploy
stage which causes violations to the deploy stage input schema.
2023-10-16 20:26:10 +02:00
Dusty Mabe
ecc997a81a tools/osbuild-mpp: add mpp-resolve-ostree-commits helper
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.
2023-10-16 20:26:10 +02:00
Dusty Mabe
8844bc260e osbuild/util/ostree: create setup_remote function
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.
2023-10-16 20:26:10 +02:00
Dusty Mabe
f4ab2f43e2 sources/ostree: leverage util/ostree library code
Similar to the cleanups in 4e99e80, let's start using the library
code for the calls to ostree here.
2023-10-16 20:26:10 +02:00
Dusty Mabe
7de357f1a9 inputs/ostree: leverage util/ostree library code
Similar to the cleanups in 4e99e80, let's start using the library
code for the calls to ostree here.
2023-10-16 20:26:10 +02:00
Achilleas Koutsou
cf14de3558 test/stages/users: extend to add ssh keys
Added three users to the test to test all combinations of ssh key
definitions:
- a user called `onekey` that has a single key defined in the `key`
  option.
- a user called `multikey` that has a multiple keys defined in the
  `keys` array.
- a user called `bothy` that defines both a single key in the `key`
  option and two other keys in the `keys` array.
2023-10-16 18:05:27 +02:00
Michael Ho
21054b181c stages/org.osbuild.users: support multiple SSH keys
Add a new attribute, "keys", to allow specifying multiple public SSH
keys to install to a users authorized_keys file.

This maintains backwards compatibility with the existing "key" attribute
that can only specify a single SSH key to install into the file (without
using some newline hacks).

Signed-off-by: Michael Ho <michael.ho@ieee.org>
2023-10-16 18:05:27 +02:00
schutzbot
6b851493c1 schutzfile: Update snapshots to 20231015 2023-10-16 14:49:34 +02:00
schutzbot
d66d58ae8a schutzfile: Update snapshots to 20231012 2023-10-13 00:20:46 +02:00
schutzbot
f0982873e2 Post release version bump
[skip ci]
2023-10-11 08:14:13 +00:00
Dusty Mabe
3cc733d7cd stages/ostree.deploy: support an ostree input
This will allow a user to specify an input directly to the deploy
stage rather than requiring a ostree.pull stage to be called first.

Adding inputs will also be useful when we soon add support for
deploying from a container rather than just deploying from an existing
ostree commit in a repo.
2023-10-06 15:55:26 +02:00
Dusty Mabe
c6c9454f6f osbuild/util: create pull_local function in util/ostree
This is prep for sharing this functionality with other stages than
the ostree.pull stage.
2023-10-06 15:55:26 +02:00
Dusty Mabe
4e99e80c4a osbuild/util: hoist ostree code into util/ostree
Prep for sharing with other stages later.
2023-10-06 15:55:26 +02:00
Dusty Mabe
34d3471fdd stages/ostree.passwd: delete dead code ostree function
As far as I can tell this is unused in this file.
2023-10-06 15:55:26 +02:00
Dusty Mabe
0f477889be stages/ostree: add deprecation notice/warning
I've been informed that this stage is old and shouldn't be used for
newly created manifests. Let's add a comment to the top for future
explorers of this code base.
2023-10-06 15:55:26 +02:00
Maxime Ripard
7af2f1a5c1 Create additional option to setup FS geometry
Some platforms like the TI AM62 require a particular FAT geometry for
their CPU to read the file system (and thus the bootloader). Failing
that the CPU will simply not boot and keep looking for a bootloader.

Let's add some options to enforce a particular filesystem geometry
through the -g option of mkfs.fat.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
2023-10-05 20:17:40 +02:00
Maxime Ripard
e58fc3d289 Consolidate the options setup for mkfs.fat
The current options building code for mkfs.fat prevents to have multiple
options at a time since it will assign the opts list to either the label
or fatsize options.

If both are set, only the last one, fatsize, will be set.

Use the occasion to rewrite the code a bit and limit the number of
lists concatenation.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
2023-10-05 20:17:40 +02:00
Dusty Mabe
4e5de3808e osbuild/util: add containers_source helper
This will hoist even more code into util out of the skopeo stage.
Now a caller can call:

    with containers.container_source(image) as (image_name, image_source):
        print(f"{image_name}, {image_source}")

to process containers inputs.
2023-09-30 02:29:05 +02:00
Dusty Mabe
4cd9af47d0 osbuild/util: hoist container handling code into util/containers
This hoists container handling code from the skopeo stage into
util/containers. It is prep for adding another stage that accepts
containers as an input. The code is common so we should share it
amongst all stages that use containers as input.
2023-09-30 02:29:05 +02:00
Otto Fowler
cfe7818771 fix link to developer guide 2023-09-29 07:01:56 -07:00
Dusty Mabe
c88b3982e8 stages/ostree.deploy: switch to v2 schema
Prep for possibly adding inputs to the ostree.deploy stage in the
future.
2023-09-28 21:38:58 +02:00
Achilleas Koutsou
7b359e3ecd Update Fedora 39 x86_64 runner 2023-09-28 09:15:53 -07:00
schutzbot
ad2fed1a3b Post release version bump
[skip ci]
2023-09-27 08:13:30 +00:00
Michael Vogt
e48360e01c docs: update the samples used in osbuild.1.rst
The file `./samples/base-qcow2.json` used in the osbuild.1.rst
man-page does no longer exists. It was removed in e92b409 and
`samples` is now a symlink into the test data. The closest in
the test data to the original `base-qcow2.json` seems to be
the `fedora-boot.json` so this is now used in the examples
section.

This removes the references to `./samples/base-rpm-qcow2.json`
which was remove in fe95d93. Here `fedora-boot.json` is also
used.
2023-09-18 22:13:09 +02:00
Dusty Mabe
e31b0fe931 stages/ostree.deploy: drop requirement on rootfs option
For Fedora CoreOS we don't actually have any root= kernel command
line option in our baked images. We have services that rely on this
and set up sysroot on first boot. The code in this stage doesn't
require for this option to have been provided and actually gracefully
handles when it's not provided. Let's just change the schema to also
not require it.
2023-09-14 13:02:19 +02:00
schutzbot
4e2f17bfca Post release version bump
[skip ci]
2023-09-13 08:16:15 +00:00
Tomáš Hozza
66b1da022a Actions: add workflow for marking and closing stale issues and PRs
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-09-06 17:49:43 +02:00
Eric Curtin
005d76be97 runners: add autosd runner
autosd is a CentOS Stream 9 derivate. User reported:

 "ValueError: No suitable runner for org.osbuild.autosd"

in Automotive SIG community Matrix. We are going through some name
changes at the moment.
2023-09-05 13:41:51 +02:00
Colin Walters
fd44af4fe7 osbuild.ostree.selinux: xref ostree issue for this
We should drop this stage entirely once we have a way to
force on selinux in ostree.
2023-08-31 14:01:12 +02:00
schutzbot
feee1255b0 Post release version bump
[skip ci]
2023-08-30 08:17:13 +00:00
Colin Walters
2972949d13 tests/ostree-container: Drop hardcoded max layers
This should just defer to rpm-ostree.
xref https://github.com/coreos/rpm-ostree/issues/4530

(If someone cares about reproducibility here, they can specify it;
 alternatively and more reliably, they can create builder container
 images and pin to those)
2023-08-29 10:56:49 +02:00
Brian Masney
e7fb2e1117 stages/dracut: add dracut omit drivers option
Add option to exclude specific kernel modules from the initramfs that's
generated by dracut.

Signed-off-by: Brian Masney <bmasney@redhat.com>
2023-08-28 13:25:04 +02:00
Sanne Raymaekers
6c4e5c5378 .gitlab-ci: update RHEL ga runners 2023-08-28 12:16:24 +02:00
Ondřej Budai
546c8267d1 test/run/stage: cover the btrfs stages
A simple test to make sure that our btrfs stages work.
Updating the testing container is needed, because the old version
didn't have btrfs-progs in it.
2023-08-25 12:35:56 +02:00
Ondřej Budai
b94048dfd4 mounts/org.osbuild.btrfs: add support for compression
Also, add it to the sample manifest.
2023-08-25 12:35:56 +02:00
Ondřej Budai
3bbded4607 org.osbuild.mkfs.btrfs: add support for -m argument
Osbuild doesn't support creating btrfs over multiple devices, thus it should
be fine to have only single and dup in the schema (other options are for raid)
2023-08-25 12:35:56 +02:00