Commit graph

1137 commits

Author SHA1 Message Date
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
Tom Gundersen
27e2d17911 awsupload: fix printing of IDs
The AWS API always uses pointers to strings everywhere, rather than
plain strings. The log messages got this wrong and printed the pointers
rather than dereferencing them.

Don't require users to do a memory dump to get at the AMIs, but instead
print the actual strings. Also change to %s from %v to let the linter
warn us in the future. %s accepts only strings, whereas %v prints
whatever you throw at it.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-04 10:05:12 +02:00
Ondřej Budai
a8f6281da2 14
Release osbuild-composer version 14
2020-06-03 23:35:09 +02:00
Ondřej Budai
5f9215cbcb sync the specfiles
20c40b59 added a dependency to osbuild-ostree. However, it wasn't added to the
old specfile. This commit fixes it.

The old specfile is used only on Fedora 31. which might never get the support
for building ostree images, but I prefer the two specfiles to be as close to
each other as possible.
2020-06-03 23:35:09 +02:00
Ondřej Budai
761be27f32 upload/aws: fail ImportSnapshot when the snapshot is deleted
When ImportSnapshot fails, it goes into the deleted state. However, the code
didn't consider this state as a failure. This commit fixes that.

Fixes #706
2020-06-03 21:55:46 +02:00
Brian C. Lane
e37b513560 weldr: Add check for deleting system sources
It was passing it through to the non-system delete function
and not returning an error. This checks for system repos first and
returns a 400, SystemSource error response if it is in the system list.
2020-06-03 21:24:47 +02:00
Brian C. Lane
37258803b4 weldr: Add support for the v1 API to /projects/source/delete
This changes store.DeleteSource to DeleteSourceByName for v0 use and
DeleteSourceByID for v1 usage.

It includes a new client function DeleteSourceV1, adds a new test, and
converts the tests for the previous Source V1 API commits to use
DeleteSourceV1.
2020-06-03 21:24:47 +02:00
Brian C. Lane
982d292a96 weldr: Update projects/source/info to support API v1
This commit changes the store.GetAllSources to distinguish between
getting the source by the Name field, or by the ID (the key to the map)
using GetAllSourcesByName and ...ByID.

SourceConfig.RepoConfig() now takes an id parameter because SourceConfig
only stores the Name, not the ID.

In weldr I split the sourceInfoHandler into 2 separate functions for v0
and v1 behavior, with the core of the old function refactored as
getSourceConfigs and used by both of them.

This also adds new structs for the SourceResponseV0 and SourceResponseV1
as well as helper functions for converting to/from store.SourceConfig
2020-06-03 21:24:47 +02:00
Brian C. Lane
ddd2010815 weldr: Add support for the v1 API to /projects/source/new
This commit changes the store.PushSource function to take the key as
well as the SourceConfig so that it can be used for v0 or v1.

It adds helper functions for decoding the toml/json into a new
SourceConfig interface type which lets the core source/new code be
shared between the versions.

It also adds tests for the new API behavior.
2020-06-03 21:24:47 +02:00