Commit graph

2297 commits

Author SHA1 Message Date
Achilleas Koutsou
5f76ec03a7 inputs/containers: change archive format to dir
The format so far was assumed to be `docker-archive` if the container
was coming from a source and `oci-archive` if it was coming from a
pipeline.  The source format will now be changed to `dir` instead of
`docker-archive`.  The pipeline format remains `oci-archive`.

With the new archive format being `dir`, the source can't be linked into
the build root and is bind mounted instead with the use of a MountGuard
created with the instance of the service, and torn down when the service
is stopped.

The _data field is removed from the map functions.  It was unused and
these functions aren't part of the abstract class so they don't need to
have consistent signatures.

Update the skopeo stage with support for the newly supported `dir`
format.
2023-03-31 14:57:26 +02:00
SchutzBot
998f640387 schutzfile: update manifest-db ref 2023-03-20 2023-03-31 13:28:32 +02:00
schutzbot
7f68136324 Post release version bump
[skip ci]
2023-03-29 08:14:39 +00:00
Sanne Raymaekers
bae4f77661 stages: add ovf stage
This stage generates an ovf descriptor and a manifest intended for
vSphere. The resulting artifacts can be tarred together with the vmdk
into an ova.
2023-03-28 23:07:38 +02:00
Jakub Rusz
cfed69adca CI: update fedora-38 images 2023-03-28 10:02:53 +02:00
Jakub Rusz
4d5715faf1 rpmbuild: build on fedora-38 2023-03-27 14:31:52 +03:00
Simon de Vlieger
162587724a test: this test requires to be able to bindmount 2023-03-20 16:32:47 +01:00
Thomas Lavocat
2848867434 ci: update manifest tests
Manifest-db is finally unblocked and we can update the reference commit.
Done manually this time to speed up the process.
I'm also updating the set of distributions we are testing on, upgrading
it to what's is generated on manifest db.
2023-03-15 10:34:09 +01:00
Thomas Lavocat
ceb4b946dd pkg: osbuild should depend on skopeo
fixes 1105
2023-03-15 10:34:09 +01:00
schutzbot
36341203a1 Post release version bump
[skip ci]
2023-02-27 16:41:44 +00:00
Antonio Murdaca
345b2a5997 stages/ignition: support multi kargs in network kcmdline
As of today the functionality is broken if somebody passes more than one
karg as the join would simply unify the strings but
ignition_network_kcmdline is unquoted and results in just the very first
karg to be consumed by the set command.

Signed-off-by: Antonio Murdaca <antoniomurdaca@gmail.com>
2023-02-27 17:39:14 +01:00
Thomas Lavocat
996c1ca889 ci: update terraform reference
To stop leaking CI resources, we need to be above commit sha 89fb25d15.
Update to latest reference
2023-02-23 12:48:45 +01:00
schutzbot
b5b3a5ba8c Post release version bump
[skip ci]
2023-02-20 14:37:54 +00:00
Tomáš Hozza
200c2b0129 stages/copy: add option to remove destination before copying
Extend the copy stage to optionally allow removing the destination
before copying. This allows one to not follow symlinks if the
destination is a symlink to a file. By default, `cp` would change
the file pointed to by the destination if it is symlink.

Extend the stage doc text to cover the behavior with regard to
destination being a symlink.

Add unit tests for the copy stage to also test the newly added option.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-02-20 10:31:06 +01:00
Achilleas Koutsou
d3229dc929 stages/shell.init: add top-level files property
Add a top level property "files" to the schema and move the rest of the
existing schema one level down.  This way we can support adding global
properties in the future if we ever need to expand the scope of the
stage.
2023-02-15 18:14:01 +01:00
Achilleas Koutsou
eb903a9596 stages/shell.init: restrict filename pattern
Old filename pattern was too wide and contained a bug in the form of
.-_, which defined a range instead of three characters.
2023-02-15 18:14:01 +01:00
Achilleas Koutsou
b848e5d9df stages/shell.init: add pattern for env var names
Pattern for valid environment variable names as defined in
The Open Group Base Specifications Issue 7, 2018 edition
IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

Updated tests to match UPPERCASE ONLY var names.
2023-02-15 18:14:01 +01:00
schutzbot
291726a83b Post release version bump
[skip ci]
2023-02-15 08:15:11 +00:00
Thomas Lavocat
5eefdc1e9a mounts: add possiblity to use norecovery with ro
To avoid kernel panics if the kernel attempts to recover the filesystem
when it's mounted as readonly. Offer the possiblity to use the
norecovery option for journaling file systems (Xfs, Ext4, Btrfs).
2023-02-10 14:09:03 +01:00
Achilleas Koutsou
d5701dac28 test: add unit test for org.osbuild.shell.init 2023-02-08 13:30:39 +01:00
Achilleas Koutsou
03b467da72 stages: add shell.init stage
New stage for writing shell init files in /etc/profile.d.
Currently only supports writing environment variables as key-value
pairs.
2023-02-08 13:30:39 +01:00
schutzbot
ab2d48350a Post release version bump
[skip ci]
2023-02-07 15:51:39 +00:00
Tomáš Hozza
16063fff57 Add org.osbuild.chown stage
Add a new `org.osbuild.chown` stage for setting user and group ownershop
of files. The stage runs the `chown` from the image using `chroot` to
enable it to use users and groups that exist only in the (image) tree.

Add unit test testing the stage in various scenarios.

Co-authored-by: Janine Olear <pninak@web.de>
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-02-07 12:14:01 +01:00
Thomas Lavocat
b97b78382f mounts: add a default value for readonly
To clarify the behavior of the mounters, specify that by default it's
not gonna mount as readonly.
2023-02-01 12:29:58 +01:00
Thomas Lavocat
8f08433804 mounts: accept more mount options
Before we could only ask OSBuild to mount a device as readonly. But
devices can have more mount options than this. Supporting more options
is necessary for the new version of image-info that is using OSBuild's
internals in order to mount the image it wants to work on. Otherwise,
for instance, some umasks aren't applied properly and we can get
differences in rpm-verify results, thus corrupting the DB.

Mount is now accepting:
* readonly
* uid
* gid
* umask
* shortname
2023-02-01 12:29:58 +01:00
schutzbot
c0fb5cf90c Post release version bump
[skip ci]
2023-01-20 16:04:06 +00:00
Tomáš Hozza
db1fa5b3c3 stages/mkdir: enhance stage documentation
Explicitly mention the stage behavior with regard to setting mode on
newly created or existing directories.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-20 14:28:36 +01:00
Tomáš Hozza
d3a63cf056 Revert "stages/mkdir: explicitly set mode using os.chmod"
This reverts commit a988aacf99.

After some discussion, the original behavior was intentional. With the
added support for gracefully handling the existence of directories, the
stage would originally not set the mode of an existing directory, while
now it will. Additional issue is that `mkdir` applies the provided mode
- umask, which was intentional. Setting the same mode without taking
umask value into account is not desired.
2023-01-20 14:28:36 +01:00
Tomáš Hozza
58579b62e9 schutzbot: add thozza's ssh key
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-19 10:05:19 +01:00
Tomáš Hozza
89660b0c7c schutzbot: remove Christian's ssh key
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-19 10:05:19 +01:00
Tomáš Hozza
282d725f6d schutzbot/deploy.sh: don't install osbuild-composer-tests
osbuild CI tests, specifically image tests are not executing the test
script from osbuild-composer any more, but it uses manifest-db.

Therefore it is not needed to set up repository for osbuild-composer nor
install it.

Delete all unneeded lines from the script and replace them by installing
all osbuild packages needed to build images from `manifest-db`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-19 10:05:19 +01:00
schutzbot
c3eef90fed Post release version bump
[skip ci]
2023-01-18 08:14:30 +00:00
Tomáš Hozza
b8e1450a35 stages/mkdir: add exist_ok option to not fail if directory exists
Add a new optional stage option to not fail if the specified directory
already exists. This will make it easier to support creation of custom
repositories via customizations in osbuild-composer. The reason is that
if a specified directory exists in an image, because it was created by
an RPM, then creating it would fail. However, the user may have
specified different mode for the directory, than it already has. Since
there is no way to know for sure if the directory already exists on the
image, without building the image itself, it is desired to handle this
case gracefully as valid in specific use cases.

The default behavior stays the same - specifying an existing directory
path will lead to an error.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-16 20:19:27 +01:00
Tomáš Hozza
a988aacf99 stages/mkdir: explicitly set mode using os.chmod
Documentation for os.mkdir() says that the mode is
ignored on some systems. Also umask value may affect
the final mode. So we set the mode explicitly.

Set the mode explicitly.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-16 20:19:27 +01:00
Ondřej Budai
a0f4cff361 osbuild.spec: migrate the license field to SPDX
See the relevant Fedora change:
https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1

We already verified that the SPDX format works well in the Enterprise Linux
pipeline.
2023-01-16 16:56:54 +01:00
Sanne Raymaekers
ae563ff896 sources/ostree: fix quotation marks in mTLS remote options
Example of broken repo config:
```
...
"tls-client-key-path=/etc/pki/consumer/key.pem"
"tls-client-cert-path=/etc/pki/consumer/cert.pem"
```
2023-01-13 11:35:43 +01:00
schutzbot
423f0a77c8 Post release version bump
[skip ci]
2023-01-04 08:14:40 +00:00
Achilleas Koutsou
fdf064b15a test: update rhsm.facts diff 2023-01-03 09:27:13 +01:00
Achilleas Koutsou
2efdbe0277 stages/rhsm.facts: create facts file in /etc
Instead of creating the file in /usr/share and symlinking to /etc,
create it directly in /etc. This fixes an issue with SELinux labeling.
The file in /usr/share does not get labelled correctly because it
doesn't match the policy and causes issues with some tools (rhc).

See rhbz#2147450.
2023-01-03 09:27:13 +01:00
Christian Kellner
d466d5d66a test/objectstore: use os.stat instead Path.stat
Instead of using `Path.stat` use `os.stat` since the former only
gained the `follow_symlinks` argument in 3.10 but we still need
to support Python 3.6 for RHEL 7 and 8.
Additionally, reduce the precision by converting timestamps to an
integer to avoid false negatives due to floating point arithmetic.
2022-12-28 11:35:37 +01:00
Eric Curtin
f542aa342f runners: add Fedora Asahi runner
Fedora Asahi is just a minor fork of mainstream Fedora with some Apple
Silicon hardware enablement.

See https://github.com/osbuild/osbuild/issues/1215
2022-12-25 11:13:01 +01:00
schutzbot
1133f4d24f Post release version bump
[skip ci]
2022-12-21 08:15:55 +00:00
David Rheinsberg
18c69d2620 util/fscache: add cachedir-tag support
The cachedir-tag specification defines how to mark directories as
cache-directories. This allows tools like `tar` to ignore those
directories if desired (e.g., see `tar --ignore-caches`). This is very
useful to avoid huge cache-directories in backups and remote
synchronizations.

The spec simply defines a file called `CACHEDIR.TAG` with the first 43
bytes to be: "Signature: 8a477f597d28d172789f06886806bc55" (which
happens to be the MD5-checksum of ".IsCacheDirectory". Further content
is to be ignored. Any such files marks the directory in question as a
cache-directory.

The cachedir-tag has been successfully deployed in tools like `cargo`
and `VLC`, and is currently discussed to be implemented in Firefox. More
information is available here: https://bford.info/cachedir/

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:43 +01:00
David Rheinsberg
a3e49df619 test/fscache-coherency: add coherency tests
Add an extension to the FsCache tests which verifies cache coherency and
atomicity of the FsCache implementation. Additionally, if available, it
utilizes a cache on NFS storage to test network-support.

Unfortunately, the stress-tests keep triggering kernel-oopses in the NFS
client driver, so they are disabled for now. However, once investigated,
we can re-enable them.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00
David Rheinsberg
51d0f60843 util/fscache: add trace hooks
Add trace-hooks to the FsCache._atomic_open() helper, including a
primitive trace-infrastructure. They allow interrupting cache operation
and running arbitrary code.

The trace-hooks will be used by the test-suite to trigger the races we
want to protect against. During runtime, the traces should not be used
and thus will always be `None`.

This is a very primitive way to hook into the runtime execution and test
the atomicity of the operations. However, it is simple enough for our
tests and avoids pulling in huge tracing suites.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00
David Rheinsberg
290efe50fe util/fscache: make _atomic_open() NFS compatible
On NFS, we need to be careful with cached metadata. To make sure our
_atomic_open() can correctly catch races during open+lock, we must be
careful to catch `ESTALE` and `ENOENT` from `stat()` calls. Otherwise,
the lock-acquisition guarantees that data is coherent, even on NFS.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00
David Rheinsberg
144e0126a3 util/fscache: drop unused _libc
We no longer use the direct libc accessor, so drop it.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00
David Rheinsberg
2c18a54e4d util/fscache: avoid RENAME_NOREPLACE on commit
We used to commit cache-entries with a rename+RENAME_NOREPLACE. This,
however, is not available on NFS. Change the code to use `os.rename()`
and rely on the _documented_ kernel behavior that non-empty target
directories cannot be replaced.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00
David Rheinsberg
e6b77ac7df util/fscache: avoid RENAME_NOREPLACE in _atomic_file()
The `RENAME_NOREPLACE` option is not available on NFS. Avoid using it
in _atomic_file() to allow NFS backed storage.

If the caller allows replacing the destination entry, we simply use the
original `os.rename()` system call. This will unconditionally replace
the destination on all file-systems.

If the caller requests `no-replace`, we cannot use `os.rename()`.
Instead, we use `os.link()` to create a new hard-link on the
destination. This will always fail if the destination already exists.
We then rely on the cleanup-path to unlink the original temporary
entry.

This will require adjustments in future maintenance tasks on the cache,
since they need to be aware that entries can be hardlinked temporarily.
However, we already consider `uuid-*` entries in the object-store to be
temporary and unaccounted for similar reasons, so this doesn't even
break our cache-maintenance ideas.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00
David Rheinsberg
8a9efa89fc util/fscache: provide store_tree() helper
Add a helper that copies an entire directory tree including all metadata
into the cache. Use it in the ObjectStore to commit entries.

Unlike FsCache.store() this does not require entering the context from
the call-site. Instead, all data is directly passed to the cache and the
operation is under full control of the cache.

The ObjectStore is adjusted to make use of this. This requires exposing
the root-path (rather than the tree-path) to be accessible for
individual objects, hence a `path`-@property is added alongside the
`tree`-@property. Note that `__fspath__` still refers to the tree-path,
since this is the only path really required for outside access other
than from the object-manager itself.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00