Commit graph

1145 commits

Author SHA1 Message Date
Ondřej Budai
fa0d800850 test: add a test-case to prevent bad multilib depsolves
When gsl with version * was specified in the blueprint,
composer depsolved both x86_64 and i686 version of gsl.
This test case should prevent this from happening.
gsl is used because it has x86_64 and i686 versions on both RHEL and Fedora.
Also, gsl-devel package exists, which is not dependant on gsl and shouldn't
be depsolved.
2020-06-10 17:40:30 +02:00
Ondřej Budai
0796342fa1 weldr/api: get the package list for depsolving in a better way
blueprint.GetPackages() method was used to depsolve blueprints prior the
dnf-to-rpm switch. However, it got dropped during the switch. This commit
makes weldr use it again.

The nice effect of this change is that we can drop getPkgNameGlob function and
have only one function for getting package name-versions from a blueprint.

Also, blueprint.GetPackages() works better with * version. Previously, we had
issues with composer depsolving bash of version * to both x86_64 and i686
versions of bash package. GetPackages() converts the package to name-version
of just bash, which dnf-json correctly depsolves to just one architecture. On
the contrary, the previous method converted bash to name-version bash-*.*.*,
which confused dnf-json.

Note that conversion to bash-* is also wrong because this will cause dnf-json
to install all packages with prefix "bash-*".
2020-06-10 17:40:30 +02:00
Ondřej Budai
6e6eae24eb blueprint: do not append "-" to name-version if version is empty
Previously, bash with empty version was converted to name-version "bash-"
that is obviously ill-formed. This commit fixes it.
2020-06-10 17:40:30 +02:00
Lars Karlitski
cd674ea39f test/image: use basename of test case
This makes it easier to use the test binary with the `-run` argument.
Instead of the full path:

    -test.run TestImages//usr/share/tests/osbuild-composer/cases/rhel_8.2-x86_64-openstack-boot.json

this only requires the actual name:

    -test.run TestImages/rhel_8.2-x86_64-openstack-boot.json
2020-06-10 17:00:18 +02:00
Lars Karlitski
b3e14a4e68 test/image: pass a temporary store to osbuild
When edd7b37ea added `--output-directory` to the invocation of osbuild,
it also removed `--store`.

This was a mistake: osbuild's default store is `.osbuild`, which is not
what we want. Restore the old behavior of passing a temporary directory,
but use the same for each test run.
2020-06-10 17:00:18 +02:00
Lars Karlitski
f173714fe2 test/image: also capture osbuild's standard error
Treating stdout and stderr separately makes it hard to match what
happened when. It's also easy to miss when `-v` is passed to the test
binary.

Print the output to stdout when osbuild fails, because the test
framework we're using does not print errors if they're too large.

Also, don't special-case exec.ExitError. Output might be useful in any
case.
2020-06-10 17:00:18 +02:00
Major Hayden
0a7c97c97a Run tests on RHEL 8.3 nightly
Now that mock builds for RHEL 8.3 look good, add tests for RHEL 8.3
nightly builds. The tests are wrapped in `catchError()` which allows us
to fail the stage without failing the whole pipeline just because RHEL
8.3 is having a bad day.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-10 16:58:21 +02:00
Ondřej Budai
224bd6b341 rpmmd: rely on dnf-json shebang instead of using PATH python
RHEL doesn't have python3 in PATH by default. Instead it has /usr/libexec/
platform-python. When building the RPM, RHEL correctly mangles dnf-json's
shebang to the platform python. This commit switches osbuild-composer
to use this shebang because it should always respect target platform's
default python binary.

Fixes #745
2020-06-10 16:56:28 +02:00
Ondřej Budai
c00cf1ac11 tree-wide: use an absolute path to dnf-json
Previously, all the osbuild-composer tools must be run from a directory with
dnf-json. This was often confusing, especially with the dnf-json-tests. This
commit changes the path to be absolute, so this is no longer an issue.
2020-06-10 16:56:28 +02:00
Ondřej Budai
b93df4b524 rpmmd: require the path to dnf-json to be passed in
RPMMD had hardcoded path to dnf-json helper. This required all executables
using RPMMD to be run in the directory where dnf-json was located. This commit
makes RPMMD take the path to dnf-json as an argument. This allows its
consumers to specify whichever path they want.

Not a functional change
2020-06-10 16:56:28 +02:00
Major Hayden
5b2c06b3da Use environment variables to control Ansible
Ansible configuration can be managed by an `ansible.cfg` ini file, but
setting up that file and ensuring it's always in the same place is
difficult.

Configure Ansible via environment variables instead.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-10 07:53:33 -05:00
Major Hayden
7b562d943c Expand native tests to include VHD/VMDK
Add VHD/VMDK support to the QEMU native compose/boot test.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-10 07:53:33 -05:00
Major Hayden
ffb846d3b5 Re-enable RHEL 8.3 mock build
Signed-off-by: Major Hayden <major@redhat.com>
2020-06-08 20:07:55 -05:00
Major Hayden
bd8168adbd
CI hotfix: Remove cpu passthrough
Some hypervisors really dislike cpu passthrough and it causes tests to fail.
2020-06-08 20:06:46 -05:00
Major Hayden
bc2a91a688 AWS: Fix console screenshot retrieval
The JSON from AWS was not being passed to `jq` and the console
screenshots were empty. 🤦

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-08 19:39:47 -05:00
Major Hayden
904335cc94 Add retries to AWS smoke test check
Signed-off-by: Major Hayden <major@redhat.com>
2020-06-08 19:38:54 -05:00
Major Hayden
860bb219af Add native qcow2 boot test
Add an end-to-end qcow2 test that follows a customer's steps with
`composer-cli`. The image is booted with libvirt to allow the best
virtualization options to be chosen by libvirt. It also uses libvirt's
default network.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-08 19:38:54 -05:00
Christian Kellner
1e310b61b9 image-info: support for analyzing tarballs
If the target is a tarball, extract the tarball and then analyze
the extracted directory.
2020-06-08 21:22:54 +02:00
Christian Kellner
ee240e2bf4 image-info: read the system passwd for ostrees
When analyzing a ostree filesystem, also parse and add the system
passwd and group files.
2020-06-08 21:22:54 +02:00
Christian Kellner
0479bfc78a image-info: add support for ostree commits
Support analyzing ostree repositories or directory that contain an
ostree commit as created by osbuild. Will return the mode of the
repository along with the references and their commits. For the
first references, the commit is resolved and checked-out to a temp
directory. This directory in turn is then analyzed via the existing
append_filesystem function. The latter has gained some small ostree
specific tweaks.
NB: for the ostree checkout /usr/etc/ is bind mounted to /etc in
order to make append_filesystem happy. The rpm verification step
is NOT run, because that is not really compatible with ostree.
2020-06-08 21:22:54 +02:00
Christian Kellner
18d1dcee20 image-info: extract package listing into function
Move the logic that retrieves the installed packages via rpm into
its own function.
2020-06-08 21:22:54 +02:00
Christian Kellner
7a250188bf image-info: move image opening to own function
Move the code of the current main into is own method and call that
from main. This prepares support for analyzing other types than
images. Additionally, add argument parsing via argparse to get a
help texts.
2020-06-08 21:22:54 +02:00
Tom Gundersen
cf952836e4 submodule: bump to v16
Run our CI against the most recent release.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-08 20:03:02 +02:00
Tom Gundersen
52273756d4 tests/compose: use qcow2 rather than ami for tests
qcow2, unlike ami, is guaranteed to exist on all the architectures we
support.

Also, now that we preserve the cache, make two composes, rather than
just one. This verifies that nothing breaks horribly just because the
cache not being cold. The fact that we have a cache at all should make
this tolerably fast.

This should fix #693.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-08 18:06:43 +02:00
Major Hayden
5903cc42fe Run AWS test using osbuild worker code
The `osbuild-image-tests` code does a good job testing image builds for
AWS, but it doesn't use the same code paths that a customer would when
using `composer-cli`.

Add a test that builds a compose and uploads the image using
osbuild-composer and its worker. Also, build an instance in AWS based on
the image we imported and check to see if the smoke test file is
present.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-08 10:31:27 -05:00
Major Hayden
540ca29c0a
Add sudo to the osbuild-mock dnf check
This is a quick fix to add `sudo` and avoid RHSM errors.
2020-06-08 08:19:15 -05:00
Tom Gundersen
e20919b494 tools/test-case-generator: add further filtering support
Allow a test case to be generated for a specific image type, rather than
for all at once.

This is useful when adding additional image types, rather than
regenerating the existing ones.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-08 13:32:59 +02:00
Tom Gundersen
83a63aaf17 distro/rhel8: add tar image type for all architectures
This is a very minimal image type, which is not expected to do anything
with an empty blueprint. It is documented as a way to install RHEL for
Satellite.

This fixes #720.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-08 13:32:59 +02:00
Tom Gundersen
31f7bd9e74 image-tests: skip tests if the test case cannot be opened
Schutzbot currently runs all the same tests an all arches/distro
combinations. This will not work as we introduce image types only on
some distro/arches.

In the future we should make the image-test binary more clever, so
Schutzbot won't have to tell it which cases to run at all. For now,
simply don't fail if the specified test-case does not exist.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-08 13:32:59 +02:00
Tom Gundersen
b8f4b9eae9 tests: split up TestEverything
This is not a functional change, just helps to make the output more
readable to indicate which sub-command is being tested.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-07 19:25:33 +02:00
Alexander Todorov
099f0abeb3 tests: composer-cli sanity tests for compose metadata|results
Refs #643, #644
2020-06-07 19:25:33 +02:00
Alexander Todorov
a70b47ebb6 Enable composer-cli tests for blueprints commands. Refs #356, #615 2020-06-07 19:25:33 +02:00
Alexander Todorov
9d1d4e44ce tests: Don't pass --json to composer-cli unless needed. Refs #356
most invocations of composer-cli do not need to parse JSON so use
the canonical invocation instead. I've left existing functions
which assert on the returned results intact.

'quiet' parameter has been removed b/c it was never used
2020-06-07 19:25:33 +02:00
Alexander Todorov
b51b80f35c tests: rename functions 2020-06-07 19:25:33 +02:00
Tom Gundersen
6002a128b8 osbuild-worker: don't flush cache between jobs
Until osbuild-14, the images were unconditionally kept in the cache,
meaning the cache could grow very large. Now only the downloaded RPMs
are saved, which greatly limits how big it can grow.

Having the RPMs cached should speed up all but the first image build a
lot, so we should take advantage of that by not flushing the cache
between each build.

The cache is still flushed when the worker is stopped / restarted.

This moves the cache from /var/tmp/osbulid-worker* to
/var/cache/osbulid-worker/osbulid-worker-*. This means that each worker
gets a dedicated cache, in case there are several on one machine. In the
future we may want to combine them and only ever have one cache, but for
that we need improvements in parallel access and cache-cleanup.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-07 19:22:52 +02:00
Tom Gundersen
253379a3b9 tests: use more reliable mirrors for Fedora tests
Move away from the round-robin fedora mirrors, and use the most reliable
one we have found (kernel.org).

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-07 13:33:32 +02:00
Martin Sehnoutka
385df479f3 distro/rhe8: introduce ppc64le qcow2 image type
This patch introduces a qcow2 image type for RHEL8 distro and associated
test case.
2020-06-06 16:56:39 +02:00
Major Hayden
904750965a
Only run image tests in PSI
AWS has no nested virtualization.
2020-06-05 13:13:52 -05:00
Martin Sehnoutka
7979a705b6 osbuild: filesystem is not required member of qemu assembler
The input options of qemu assembler do not require filesystem for every
partition. This patch makes it optional and omits the object in case it
is empty.

osbuild schema definition:
162797f206/assemblers/org.osbuild.qemu (L63)
2020-06-05 20:09:20 +02:00
Martin Sehnoutka
673e967b2d osbuild: Change QEMUPartition "Type" to match osbuild
Partition type, as defined in osbuild qemu assembler, is of type string
because it is either UUID or identifier. See here for details:
162797f206/assemblers/org.osbuild.qemu (L88)

Change type of the "Type" struct member to match the definition in
osbuild. This patch is needed for ppc64le support.
2020-06-05 20:09:20 +02:00
Major Hayden
38e4fe8781 Add more emojis to AWS upload logs
Now that we know emojis work properly with osbuild-composer and systemd,
let's add some more.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-05 19:56:57 +02:00
Major Hayden
4364b0a181 Add CI details script
Dump the machine specs for the system running the CI job very early
during the job run.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-05 19:54:57 +02:00
Martin Sehnoutka
d74fc4e3fa osbuild: introduce zipl stage
zipl is a z initial program loader used with IBM Z systems. This stage
is required to get support for the s390x architecture.
2020-06-05 19:29:16 +02:00
Major Hayden
c8666061f0 Use S3 for CI repositories
Upload artifacts from the mock builds into S3 to allow us to burst into
AWS when needed.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-05 09:37:47 -05:00
Ondřej Budai
d65057e164 weldr: add support for toml format in /blueprints/freeze
This is needed for lorax parity. When multiple blueprints are being frozen in
toml mode, the API returns an error. This is the same behaviour as in the
/blueprints/info route.

Fixes #667
2020-06-05 13:51:04 +02:00
Martin Sehnoutka
1f580738db tools: fix generate-test-case script
Commit 8dd4554491 introduced a bug because
the output from osbuild is not captured. The problem is that osbuild
itself writes JSON document to STDOUT so two different JSON documents
are written to STDOUT: osbuild output and generated test case. The
generate-test-cases script then fails because it cannot json.loads() the
test case.

This patch simply supresses the output which fixes the issue.
2020-06-05 12:00:50 +02:00
Ondřej Budai
14a3f2a9d3 weldr: move projects and modules routes towards lorax parity
lorax-composer returns more information about projects and modules. They are
all meaningless, but we need them for parity.

Fixes #664
2020-06-05 10:01:32 +02:00
Martin Sehnoutka
604f7c2a55 osbuild: introduce bootloader struct into qemu assembler
osbuild takes a "bootloader" object as an option to the qemu assembler:
3f14ace5c1/assemblers/org.osbuild.qemu (L43)
we don't use it because for x86_64 with enabled legacy support it
defaults to the right value:
3f14ace5c1/assemblers/org.osbuild.qemu (L482)
but in order to gain support for ppc64le we need to introduce this.
Example usage can be found in samples directory:
3f14ace5c1/samples/f30-ppc64le.json (L819)

This change itself does not alter osbuild-composer output.
2020-06-05 10:01:24 +02:00
Brian C. Lane
0f5b99c754 Fix fonud typo in rpmmd 2020-06-05 08:27:25 +02:00
Jakub Rusz
f5680284df Increase coverage of store.go
Closes #455
2020-06-04 17:35:42 +02:00