Commit graph

1502 commits

Author SHA1 Message Date
Christian Kellner
e92b40952b samples: replace with symlink to test data
Instead of maintaining a separate set of samples that by now are very
much outdated (using Fedora 31 or older), make the samples directory
a symlink to the test data. Manifests in there are indeed tested and
maintained.
The error and noop samples are also covered in unit tests, so no need
for extra samples there either.

CI: remove the sample validation since all the test data manifests
    are actually built.
2021-07-12 18:44:50 +02:00
Christian Kellner
d09f07a24c test/data: remove users from ostree-image
Let's not have users in the ostree commit itself since we have
zezere ignition enabled for user provisioning.
2021-07-12 18:21:05 +02:00
Christian Kellner
284e73a018 test/data: enable greenboot and zezere ignition
Enable greenboot for health checks and zezere ignition so we get
user provisioning like Fedora IoT. Also explicitly opt into rngd
and sshd.
2021-07-12 18:21:05 +02:00
Christian Kellner
75e3856967 test/data: use new ostree stages
Use the new ostree stages instead of the old monolithic one.
2021-07-12 18:21:05 +02:00
Christian Kellner
0d625f34ea stages/fstab: add support for OSTree
Add experimental support for writing the fstab file to `/etc` in on
OSTree deployment. Experimental here means that options might be
replaced in the near future with a different mechanism and are thus
not considered stable API.
2021-07-12 18:21:05 +02:00
Christian Kellner
3d197247b2 stages: add org.osbuild.ostree.selinux
Fix SELinux labels for an OSTree deployment.
2021-07-12 18:21:05 +02:00
Christian Kellner
467f313cee stages: add org.osbuild.ostree.remotes
Configure OSTree remotes for a repository.
2021-07-12 18:21:05 +02:00
Christian Kellner
98d0a856df stages: add org.osbuild.ostree.fillvar
Pre-populate /var directory for a given deployment.
2021-07-12 18:21:05 +02:00
Christian Kellner
d284bc0ef2 stages: add org.osbuild.ostree.deploy
Create an OSTree deployment[1] for a given ref.
2021-07-12 18:21:05 +02:00
Christian Kellner
d793ffd805 stages: add org.osbuild.ostree.config
Change OSTree configuration for a repository via `ostree config`.
2021-07-12 18:21:05 +02:00
Christian Kellner
ee124df336 stages: add org.osbuild.ostree.init-os
Initializes a new stateroot (see [1]) for the OS with the
name `osname`.
2021-07-12 18:21:05 +02:00
Christian Kellner
784d29218f stages: add org.osbuild.ostree.init-fs
Creates the basic file system layout for an OSTree based system.
2021-07-12 18:21:05 +02:00
Christian Kellner
54fe67ece5 utils/ostree: deployment path helper
Add a simple helper method that returns the path for a deployment,
given the sysroot, the osname, the reference or commit and the
deployment serial. Path might not exist.
`
2021-07-12 18:21:05 +02:00
Christian Kellner
dc201d45fd utils/ostree: add rev_parse helper function
Add a simple helper function that wraps `ostree rev-parse` to make
it easy to resolve an OSTree reference given a repository.
2021-07-12 18:21:05 +02:00
Christian Kellner
368d0a5c18 tools/mpp: support multiple image definitions
Support more than one image definition by introducing a `id` attribute
which can be used to specify how the variable for the definition is
called.
2021-07-09 19:50:38 +01:00
Christian Kellner
042a3424e4 tools/mpp: support skip_if_unavailable
Add `skip_if_unavailable` as an supported attribute
for the repository configuration.
2021-07-09 19:50:38 +01:00
Christian Kellner
c5c5550ad5 stages/qemu: remove mixed indention
Only spaces, no tabs!

Reported-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-07-09 19:50:38 +01:00
Christian Kellner
0c871c26c0 objectstore: use recursive bind mounts
When bind-mounting the tree for i/o, use recursive bind mounts.
This could be needed in the case that `/usr` is not one single
mount but assembled from different ones. Normally this should
not be the case but we want to support in, just in case.
Conversely, when unmounting, do so recursively too.
NB: This should not make any differences for trees that we have
built ourselves since they don't contain any mounts.
2021-07-09 18:09:37 +01:00
Christian Kellner
2b4e913e1e objectstore: only bind-mount /usr for host trees
The only thing we should ever need from the host is `/usr`. Therefore
instead of bind-mounting the entirety that is `/`, just bind-mount
`/usr`.
2021-07-09 18:09:37 +01:00
Christian Kellner
d2c4888843 test/data: use mpp-define-image in ostree-image
Use the new partiton layout support in MPP. NB: start data as
well as the size of the last partition have been omitted now,
since `sfdisk` will figure those out for us.
2021-07-08 22:47:45 +02:00
Christian Kellner
d39e3a239e tools/mpp: support for defining partitions
It is now possible to define a partition layout via `mpp-define-image`.
The defined layout is actually written to a temporary sparse file and
read back via `sfdisk`, so that all partition data like `size` and
`start` include actual padding and such. The `image` variable will be
defined with `size` and `layout` keys, the latter containing the
partition layout data. It can be accessed via the "String expansion"
mechanism.
2021-07-08 22:47:45 +02:00
Christian Kellner
4456e1f276 stages: add org.osbuild.mkdir
Can create one or more directories, optionally also their parents.
Add some basic tests as well.
2021-07-08 21:14:21 +01:00
Christian Kellner
3a69bf39b7 host: catch BrokenPipeError while sending replies
Catch the BrokenPipeError exception when sending a reply. This will
happen when the other side closes their side of the connection/pipe
so in that case we just break out of the serve loop.
2021-07-08 15:01:33 +01:00
Christian Kellner
254c1cd9fb api: remove host side arguments facility
Now that arguments are transmitted via a mapped, i.e. bind-mounted,
file instead of using the jsoncomm RPC mechanism, all the methods
related to the latter can be removed from API.
2021-07-08 15:01:33 +01:00
Christian Kellner
affd384669 pipeline: deliver stage arguments via a file
Instead of using the jsoncomm API to transmit stagge arguments,
write them out to a file that is then mapped into the container.
The `api.arguments` function is re-written just read that file
from within the container.
2021-07-08 15:01:33 +01:00
Christian Kellner
82d33a35ae api: remove unused 'monitor' parameter
The monitor parameter, which previously was used for stream logs
to via the output handling of API, is now no longer needed. Thus,
it can be removed.
2021-07-08 15:01:33 +01:00
Christian Kellner
2643a85758 pipeline: use single tempdir for inputs, mounts
Instead of creating two separate temporary directores, use one and
create sub-directories for inputs and mounts in it.
2021-07-08 15:01:33 +01:00
Christian Kellner
a449bf0c42 pipeline: small whitespace change
No need to spread the BuildRoot instantiation over two lines.
2021-07-08 15:01:33 +01:00
Christian Kellner
46d675b102 api: remove unused methods
Remove the functions `_prepare_output` and `_output_ready`, which
both were used when stdout for the stages was handled by the api.
2021-07-08 15:01:33 +01:00
Christian Kellner
83fc64c565 devices/loopback: since file on close
On rare occasions, when trying to mount a file system via the
loopback device that was created in the stage before the mount
fails with `wrong fs type, bad option, bad superblock on ...`.
It is not yet fully clear why this appears since in theory the
kernel should handle the sequence of operations we do, but it
might be down to the caching or bugs in the underlying file-
system.
To mitigate with potential caching issue we therefore now sync
the file that is backing the loopback device after the device
has been closed. In order to not have to re-open the file we
keep the file descriptor around as long as the loopback device
is open.
2021-07-07 17:24:58 +01:00
Christian Kellner
23628b3f62 objectstore: sync before unmounting
This should, in theory, not be necessary because the bubblewrap
process and its children should be stopped already and umount
should just block until it is finished. But, if the store is on
a filesystem, like the one used by docker machine, unmounting
frequently produces errors like:
  `umount: .../tmp9nlyzwdu-writer: target is busy.`
Syncing the filesystem before that seems to help in some cases
and it surely does not hurt.
2021-07-07 17:24:58 +01:00
Christian Kellner
1dc845f331 tools/mpp: properly support substitutions
Previous versions of mpp would already set the arch and basearch
substitution, which would work for dep-solving itself, but not
properly re-write the resulting URLs which means that the manifest
was broken. Fix this by properly replacing the substitutions in
the URL. Also support official 'releasever' substitution.
2021-07-07 15:10:00 +02:00
Christian Kellner
7c9035e48a tools/mpp: set module_platform_id again
This, together with the "ignore-weak-deps" option got lost in the
refactoring. Add it back.
2021-07-07 15:10:00 +02:00
Alexander Todorov
6f86cf455f ci: Start building on 8.5 aarch64
we need the RPM before we can even start testing osbuild-composer on
aarch64.
2021-07-05 16:43:35 +02:00
Paul Wayper
6ee1bb93dd Reformat other subprocess.run commands to highlight command
Signed-off-by: Paul Wayper <paulway@redhat.com>
2021-07-02 11:38:02 +01:00
Paul Wayper
6d0054826b Trivial formatting change to test public contribution system
Signed-off-by: Paul Wayper <paulway@redhat.com>
2021-07-02 11:38:02 +01:00
Christian Kellner
d47f735112 tools/mpp: create PkgInfo class for package info
Instead of passing dictionaries around that are inconvenient to
use in code and even more in the `mpp-format-*` directives, use
a simple class to represent package information. Use that in
the `pkginfo` dict that can be accessed via `mpp-format-*`. Use
the `evra` property instead of string manipulation in the
`fedora-boot.mpp.json` and `-ostree-bootiso.mpp.json` manifest.
2021-07-02 11:28:43 +02:00
Christian Kellner
d5c5947271 test/data: generate the fff... uuid
Instead of writing 32 `f` chars, we can now generate it. The
future is here.
2021-07-02 11:28:43 +02:00
Christian Kellner
8a27de0d10 tools/osbuild-mpp: include nevra in package list
Include the nevra in the list of dep-solved packages. Use that for the
package info. Adapt the boot manifest accordingly.
2021-07-02 11:28:43 +02:00
Christian Kellner
ff76b6fade tools/osbuild-mpp: small whitespace fixes
Since David is on leave, I have to do them. Also Move the pylint
comment above the line, not next to it.
2021-07-02 11:28:43 +02:00
Christian Kellner
5ac1e004a6 spec: ship osbuild-mpp in new -tools
Include the `osbuild-mpp` tool, that is now installed via `setup.py`
in a new `osbuild-tools` package.
2021-07-02 11:28:43 +02:00
Christian Kellner
a247b8cc1e setup: install osbuild-mpp
Install the Manifest Pre-Processor tool.
2021-07-02 11:28:43 +02:00
Christian Kellner
44fec6cd91 tools/mpp: rename mpp.py to osbuild-mpp
Prepare the optional installation of the script via a more unique
and langauge independent name.
2021-07-02 11:28:43 +02:00
Christian Kellner
e4f39c5e03 devcontainer: add pyyaml dependency
This is needed for the pylint to work correctly with the new
cloud-init stage.
While there, add some more utilities useful for debugging. Also
add glibc-langpack-en needed for `en_GB`.
2021-07-01 23:29:03 +02:00
Alexander Larsson
53af328b7c mpp: Use the right format for the file secrets
I was getting:

.sources.org.osbuild.curl.items.sha256:02c8f76fd8b13972c541e4fa3bd2101681b7d4baa1320e3101bc4167b5531685:
  {'url': 'https://cdn.redhat.com/content/dist/rhel8/8/aarch64/baseos/os/Packages/e/elfutils-libelf-0.182-3.el8.aarch64.rpm', 'secrets': 'org.osbuild.rhsm'} is not valid under any of the given schemas

Because the secrets key should have an object, not a string value.
2021-07-01 18:15:00 +02:00
Alexander Larsson
e4eb3e0fd0 Use the new formating features to simplify the test manifests
This uses size computations to simplify the partition size/offsets
and the depsolv results to get the kernel version.

This makes no changes to the resulting json files.
2021-07-01 15:06:57 +02:00
Alexander Larsson
bdfef651eb mpp: Set a variable to the set of depsolved rpms
This allows you to format strings based on what will get installed.
A common example here is extracting the kernel version for the
dracut stage.
2021-07-01 15:06:57 +02:00
Alexander Larsson
e541c1c196 mpp: Add support for formating strings
This lets a mpp manifest define some variables and then use
these variables inside python f-strings to expand things in a
flexible way. This allows a single value such as `rootfs_size` to
be expanded in various places, including using computations to
e.g. define the partition offsets/sizes.
2021-07-01 15:06:57 +02:00
Achilleas Koutsou
ba3467d747 test/data: update nginx.conf manifests
- Update to v2 manifest
- Add build stage
2021-07-01 10:49:38 +02:00
Achilleas Koutsou
7e1f2fa9b9 test/data: update chmod manifests
- Update to v2 manifest
- Add build stage
- Create file from inline data and use it for testing chmod
2021-07-01 10:49:38 +02:00