Commit graph

1310 commits

Author SHA1 Message Date
Christian Kellner
89f372fa3c setup.cfg: set max line length in pycodestyle
Move the max-line-length setting to the `pycodestyle` section,
which is read by pylint but also other tools like autopep8.
2021-05-12 14:26:16 +02:00
Christian Kellner
6567b8f932 setup.cfg; move pylint settings here
Create a setup.cfg file and move the pylint settings from .pylintrc
here. This file can be used to configure other tooling as well, so
it is in general more useful as a central configuration place.
2021-05-12 14:26:16 +02:00
Christian Kellner
e97285e00a test/sources: add checks for org.osbuild.ostree
Add basic checks for the ostree source, which includes a successful
pull of a commit, an empty source entry and one where the specified
commit is non-existant. For this create a simple commit in a ostree
repo is checked in. The commit was created via:

  mkdir "/tmp/data"
  echo "Hello World" > /tmp/data/hello.txt
  ostree init --repo test/data/sources/org.osbuild.ostree/data/repo \
              --mode=archive

  ostree commit --repo test/data/sources/org.osbuild.ostree/data/ \
                --branch "test/ostree" /tmp/data \
                --timestamp="1995-05-13 12:34:56 +0000"
This should give an commit with the following commit id:
  d6243b0d0ca3dc2aaef2e0eb3e9f1f4836512c2921007f124b285f7c466464d8
2021-04-29 12:58:01 +02:00
Christian Kellner
a05a8aaed6 sources/ostree: remove export functionality
Since the `sources.SourcesServer` has been removed, nothing is
using the export functionality anymore. Inputs are now used to
make content in the store available to stages. Remove all the
export logic from org.osbuild.ostree.
2021-04-29 12:58:01 +02:00
Christian Kellner
92fad13dbf test/sources: tmpdir as fixture
Instead of creating the temporaroy directory within the unit test,
provide it to the test via a test fixture.
2021-04-29 12:58:01 +02:00
Christian Kellner
518940cfe0 sources/curls: refactor downloading code
Now that the `export` functionality is gone, the download code
can be simplified, since we are not downloading a subset of the
urls, but all of them.
2021-04-29 12:58:01 +02:00
Christian Kellner
5c19360cbe sources/curl: remove export functionality
Since the `sources.SourcesServer` has been removed, nothing is
using the export functionality anymore. Inputs are now used to
make content in the store available to stages. Remove all the
export logic from org.osbuild.curl.
2021-04-29 12:58:01 +02:00
Christian Kellner
aa19a1c4c0 sources: remove server and get method
The usage of the `sources.SourcesServer` and `sources.get` have
been removed from `Stage.run`, which was the only usage throughout
osbuild and thus it is not needed anymore and can be removed.
2021-04-29 12:58:01 +02:00
Christian Kellner
f1b406a774 pipeline: remove sources server
All sources are now pre-fetched before any pipeline and thus any
stage is being built. Additionally, in the version 1 foramt, all
stages that were using source are converted to use inputs when
the manifest is loaded. Thus, nothing should use `source.get`
and thus the sources API (`SourcesServer`) anymore.
2021-04-29 12:58:01 +02:00
Christian Kellner
fd21da3aa6 test/sources: use pytest.mark.parameterize
Parameterize `test_sources` via `pytest.mark.parameterize`, so that
now the product of source and test cases for that source is visible
to pytest and thus also the caller.
2021-04-29 12:58:01 +02:00
Christian Kellner
7a48c3b734 test/sources: check Source.download
Instead of testing the legacy `SourcesServer` and `sources.get`,
test the `Source.download` method, which is the new and exclusive
way how sources are used in osbuild. For this, the complete info
for a specific source is now included the specific test case.
For the `org.osbuild.curl` source this means that the respective
information is moved from `sources.json`, which is then unused
and thus removed. The test case that checks for an unknown
checksum is also removed because `Source.download` just fetches
everything instead of a subset.
2021-04-29 12:58:01 +02:00
Christian Kellner
3c66d1e4f5 test/sources: convert to pytest
Use `pytest`, which is a dependency of osbuild since a few versions,
instead of `unittest` for the source tests. The main reason is to be
able to use `pytest.mark.parameterize` in the near future to easily
generate a test matrix.
2021-04-29 12:58:01 +02:00
Achilleas Koutsou
1476b88dcf schutzbot: add RHEL 8.5 2021-04-19 09:12:21 +02:00
Christian Kellner
eb74ddf2ef 28
This completes the development of osbuild version 28.
2021-04-08 19:27:48 +02:00
Christian Kellner
925e205ee3 NEWS: update for osbuild version 28 2021-04-08 19:27:48 +02:00
Christian Kellner
94dedfc849 devcontainer: specify the workdir
Set the workdir to the osbuild source directory; this makes it
convenient when using docker/podman exec into the container.
2021-04-08 12:56:06 +02:00
Christian Kellner
1f86a2156d devcontainer: preserve history
Use a separate volume for /root/.local/share, which is where the
fish shell keeps its history file, in order to preserve it across
container rebuilds.
2021-04-08 12:56:06 +02:00
Christian Kellner
65cf620d4b devcontainer: install additional packages
Install more more tools and utilities that help with development
and testing of osbuild inside the dev container.
2021-04-08 12:56:06 +02:00
Christian Kellner
e7620feca4 assemblers/qemu: support for qcow2 compat version
Add a new option `qcow2_comapt` which can be used explicitly
select the compatibility level of the qcow2 file format. Qemu
version 1.1 introduced extensions to the format that became
the default with 1.7, which are not readable by qemu < 1.1.
Thus if the resulting qcow2 should be read by such older qemu
versions, the compatibility level needs to be set to 0.10.
2021-04-08 10:22:56 +02:00
Christian Kellner
d37bf0375b stages/oci-archive: write history entries
According to the OCI Image Format Specification[1] history entries
for layers in the container are optional; but when trying to push
a container quay.io via skopeo (copy oci-archive:… docker://quay)
it will fail with "Cannot convert an image with 0 history entries".
This seems to come from the containers/image[2] library when the
container is converted back from the docker distribution format
to oci-archive on quay.io. Thus it seems that when skopeo converts
the image to the docker format for the distribution it does not
fill any the history entries, which are then assumed and required
to be there when converting back.
To fix this, insert history entries for each layer that is created.

[1] https://github.com/opencontainers/image-spec/blob/master/config.md
[2] https://github.com/containers/image/
2021-04-07 19:19:16 +01:00
Christian Kellner
8429b08e79 stages/oci-archive: include limited set of xattrs
Only include a very specific set of extended attributes:
  - user.*: user specified extended attributes
  - security.ima: Integrity Measurement Architecture (IMA)
  - security.capability: Linux capabilities(7)
This follows what containers/storage[1] and containers/buildah[2]
are doing. It is important to note that we DO NOT want selinux
related extended attributes (`security.selinux`) in there, which
seems to be pulled in by some versions of `tar` even if that was
seemingly excluded via `--no-selinux`. Therefore we also exclude
selinux and xattrs explicitly from the wrapping container to
make sure they are never included.

[1] 35ebda8ae2/pkg/archive/archive.go (L399)
[2] 214e4c9335/copier/xattrs.go (L19)
2021-03-31 15:04:34 +01:00
Achilleas Koutsou
dc6090290b Revert "stages/rpm: truncate the machine id"
This reverts commit 59184b23a2.

This change breaks current testing and is not critical.
We will reintroduce it later when there is time to adapt the tests.
2021-03-30 23:52:35 +01:00
Alexander Todorov
6c68e45dbe ci: Start running image tests against 8.4
Refs https://github.com/osbuild/osbuild-composer/issues/962
2021-03-30 11:38:47 +03:00
Aleksandar Todorov
33db6cbd2f ci: Excute image_tests directly from osbuild-composer-tests
instead of duplicating the same script here!

Specifies needed cloud credentials.

NOTE: don't start osbuild-composer in deploy.sh because this is
now done by /usr/libexec/osbuild-composer-test/provision.sh. Otherwise
leads to errors because the socket is already taken.
2021-03-26 19:02:57 +00:00
Christian Kellner
59184b23a2 stages/rpm: truncate the machine id
Instead of deleting and re-creating /etc/machine-id, just truncate
it to an empty file. This should let the mode be 0444, which is
the mode that systemd also creates it with.
2021-03-22 14:25:23 +01:00
Christian Kellner
36c7d08f6e inputs/ostree: use ostree prefix for temp dir
Use `ostree-ouput` instead of `files-output` as prefix for the
temporary directory prefix.
Also fix the description of the "origin" to reflect that
pipeline and source origins are supported.
Additionally remove some dead code.
2021-03-22 14:25:23 +01:00
David Rheinsberg
87a7b4ae5f ci: update images to F33
We explicitly pinned the F32 CI images in the past due to update issues
in F33. However, those have been resolved and we should switch back to
the most recent Fedora CI images.

This commits switches all instances of the osbuild-ci image back to the
latest stream, snapshot taken on 2021-02-19 13:11 (latest-202102191311).

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2021-03-17 14:31:26 +00:00
Christian Kellner
337e0f05ea runners: add Fedora 35 runner
New `org.osbuild.fedora35` which is re-using the f30 runner.
Needed since Fedora 35 branched in early February.
2021-03-17 12:13:42 +01:00
Christian Kellner
1329fc2ca7 stages/rpm: sort packages metadata
In order to have a more stable package metadata representation,
sort the generated metadata by name. Adapt the tests' metadata
file to reflect that change.
2021-03-17 00:32:53 +00:00
Christian Kellner
b4f58ccc72 tests/stages: write out produced metadata
When the expected metadata does not match the produced metadata,
write the latter to `/tmp` for closer inspection; additionally
this should help update the metadata file in case the changes
are expected.
2021-03-17 00:32:53 +00:00
Christian Kellner
5de2d3f96b 27
This completes the development of osbuild version 27.
2021-03-16 21:39:22 +00:00
Christian Kellner
647ac51a5b NEWS: update for osbuild version 27
Various bug fixes, mainly for all the new stages introduced in
version 26 and 25.
2021-03-16 21:39:22 +00:00
Christian Kellner
c3dde19d72 stages/preptree: move home dirs to var/home
Since `/home` will not end up in the commit¹ move the home
directories to `/var/home`. This is done after the new root
file system has been initialized, and only if `/home` is not
empty.

¹ it is neither copied back in the preptree stage itself, nor
  would it be picked up by rpm-ostree compose tree postprocess
  were it copied back.
2021-03-16 21:58:02 +01:00
Jozef Mikovic
f13ea76663 runners: add runner for RHEL9 2021-03-15 13:40:11 +00:00
Christian Kellner
3eea6e54d9 stages/xorrisofs: ability to set system id
Add an option to set the systemd id of the ISO. The systemd id
is used by e.g. by osinfo to identify the RHEL boot isos, where
the system id is "LINUX"[1]

[1] https://gitlab.com/libosinfo/osinfo-db/-/blob/master/data/os/redhat.com/rhel-8.4.xml.in#L19
2021-03-14 15:33:07 +01:00
Christian Kellner
2dcc1d9cee sources/ostree: capture ostree output
Instead of using stderr for the ostree subprocess command
capture its output so that in the case of an error we get
properly return the error output. With the old behavior
all the `ostree` command output would land in the journal
of the worker.
2021-03-12 18:49:41 +01:00
Christian Kellner
b609bb81dd source/ostree: fix download only case
Source, for compatability reasons, have two modes: download only
and download and export. The difference is the arguments that
are passed to the source: For download only, the `output` param
is empty. In this case also `checksums` *can* be empty and if so
it means everything, i.e. the commits, should be fetched. The
latter was not properly handled so far. Adjust the logic, which
now closely mimics that of the `org.osbuild.curl` source to fix
this case.
Also catch exceptions invoking `ostree` and properly return them
via the json error messaging.
2021-03-12 18:49:41 +01:00
Christian Kellner
c616afa87e test: dynamically generate stage test_stages
This is a partial revert of commit d584a1e, which converted the
dynamically generate stage tests to sub tests. The problem with
the latter is that they can't be individually run, which makes
testing changes to specific stages cumbersome to develop.
Therefore switch back to a model where the stage tests are
dynamically generated via a class decorator.
2021-03-11 12:46:24 +00:00
Christian Kellner
428a9fd58c test/stages: checks for org.osbuild.resolv-conf
Implement a new stage test that checks that the new resolv-conf
stage works as expected.
2021-03-11 12:46:24 +00:00
Christian Kellner
a44a9ab04c stages: add org.osbuild.resolv-conf
Add new stage that can be used to configure the resolver(3) via
the /etc/resolv.conf(5) configuration file.
2021-03-11 12:46:24 +00:00
Christian Kellner
99160ad369 ci: increase fetch-depth to 2
Codecov apparently has trouble detecting the git commit if the
fetch depth is only 1 (the default). Therefore increase it.
See https://github.com/codecov/codecov-action/issues/190 for
more details.
2021-03-11 12:46:24 +00:00
Aleksandar Todorov
775dceaf20 tests: Save osbuild.repo file under artifacts
makes it easier to grab if we need it for manual testing or
in case one needs to download the RPMs from Schutzbot
2021-03-10 12:00:49 +02:00
Christian Kellner
eb6461c165 test/fmt_v1: check result is complete
In the output test, check that for a successful pipeline run all
the elements are present: main result, assembler result, stage
result.
NB: Build result is hard to test because we would need to actually
build a valid build root.
2021-03-09 21:40:47 +00:00
Christian Kellner
74e6302860 test/fmt_v1: check assembler failures propagate
Check that if an assembler fails the result is propagated to the
overall result status, i.e. the main `success` is also `False`.
2021-03-09 21:40:47 +00:00
Christian Kellner
dfd7ff2500 fmt/v1: correctly infer result from assembler
If a pipeline has an assembler and that assembler failed, the
overall status of the build also needs to be marked as failed.
This used to be the case, but a bug got introduced when the
format abstraction code was added.
2021-03-09 21:40:47 +00:00
Christian Kellner
72ffa50c45 assemblers: add org.osbuild.error
This is, like the stage with the same name, an assembler that
will exit with an error code (default 255, but can be specified
via the assembler options). It is mostly useful for testing.
2021-03-09 21:40:47 +00:00
Aleksandar Todorov
d98f460841 runners: add rhel 85
A runner for rhel 8.5 is added. This runner is a sym link to the rhel82
runner as was done for the rhel84 runner.
2021-03-09 16:00:32 +00:00
Ondřej Budai
555b5d0f2b schutzbot/deploy: remove the RHEL 8.3 Beta workaround
These days are long gone, we no longer test osbuild against development RHEL
versions. This is covered by osbuild-composer's test suite.
2021-03-07 12:50:06 +00:00
Ondřej Budai
3028402e71 schutzbot/deploy: bump to osbuild-composer 29
It was set to osbuild-composer 24, so old.
2021-03-07 12:50:06 +00:00
Christian Kellner
850ee4466f stages/grub2: set GRUB_CMDLINE_LINUX default
Set the "GRUB_CMDLINE_LINUX" variable in /etc/default/grub to the
kernel command line options. This is used by `grub2-mkconfig` to
assemble the full kernel command line when generating the menu
entires. NB: `GRUB_CMDLINE_LINUX` does NOT include the root fs
bits (`root=...`), since that is generated by grub2-mkconfig
itself.
2021-03-03 20:19:39 +00:00