Commit graph

860 commits

Author SHA1 Message Date
Ondřej Budai
8f351026d8 tests/image: drop the qemu-extract boot type
Previous commit switched the ami output type to qemu boot type, therefore
qemu-extract is not needed anymore.
2020-04-24 15:27:39 +02:00
Ondřej Budai
83a3a8d821 change the format of the ami image type to vhdx
Prior this commit the ami image type produced raw.xz images. This was bad for
two reasons:

- The upload was broken because AWS doesn't support tar.xz format
- XZ compression is terribly slow

This commit changes the format to vhdx, which is supported by AWS and also
quite quick. See https://github.com/osbuild/osbuild-composer/issues/257
why vhdx was chosen.

Fixes #257
2020-04-24 15:27:39 +02:00
Ondřej Budai
5d77188de0 bump osbuild to version 12
We will soon need the support for vhdx format, which is supported since
osbuild 12.

This commit bumps the dependency in the spec file and also updates the
submodule.
2020-04-24 15:27:39 +02:00
Ondřej Budai
f21e86cd8c workflow: enable updates-testing repo when installing osbuild on f31
This is the same fix as in 7ff15e1f, but for the old package (and therefore
for f31).

Copy of the 7ff15e1f commit message:

The source of issue here is that our release cycles are synchronized and
if we want to use the latest released osbuild we need to wait for the
bodhi process. It makes sense that we don't want to use latest osbuild
from git master but we should be confident enough in the version we
submit to bodhi.

Using the version from updates-testing therefore fixes the issue with
synchronization and avoids using unreleased versions.
2020-04-24 15:27:39 +02:00
Jakub Rusz
32844d605a vendor: add github.com/stretchr/testify/suite 2020-04-24 11:46:13 +02:00
Jakub Rusz
42efce2811 tests: add coverage for store.go
This adds coverage for the methods working with Blueprints
2020-04-24 11:46:13 +02:00
Jiri Kortus
ae5924d29a Improve coverage for distro packages - F30
Refs: #442
2020-04-24 11:16:39 +02:00
Jiri Kortus
46e230212b Make TestDistro_Manifest more versatile
Move TestDistro_Manifest to a separate package and make it parametric,
so that it can be used to test specific distros.

Refs: #442
2020-04-24 11:16:39 +02:00
Major Hayden
8d59d0c798 🐫 Handle base/image test cases
Speed up test run times by putting base tests and image tests into two
separate jobs in Jenkins. Add support to the testing playbook for both
types of tests and make it easy to add more types later, especially
for image that require booting in the cloud.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-24 08:55:20 +02:00
Ondřej Budai
e890e03d68 tests/image: run the tests in parallel (somewhat)
This commits enables the parallelism for the image tests. However, there's
a catch. Osbuild cannot be reliably run in parallel, so the code uses
a mutex to ensure there's always only one osbuild instance for now. Even
with this limitation, there's a significant speed-up of the tests:

Prior this commit, the image tests run in 40 minutes on Travis. After this
commit, the time is reduced to 32 minutes.

The speed-up will have an even bigger effect when more cloud-upload tests are
added to the test suite.
2020-04-24 08:41:31 +02:00
Jiri Kortus
c4d40b4b0f Fedora31 - fix Size() for vhd
Refs: #442
2020-04-24 08:30:02 +02:00
Major Hayden
3dbfdc4ee6 🐎 Run dnf-json tests in parallel
Run multiple dnf-json tests in parallel to speed up execution. The
total number of parallel tests is limited by the number of CPUs in
the machine that is running the tests.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-23 09:13:22 +02:00
Ondřej Budai
d9cbdede41 tools/prepare-source: use a well-defined go version
go mod works differently in go 1.12 and go 1.13. When someone uses the
prepare-source tool with go >= 1.13, the ci complains because it uses
go 1.12. This commit changes the script to use a well-defined go version.
2020-04-23 08:54:29 +02:00
Major Hayden
1d743f048a 🐣 Add initial RHEL 8.3 support
The osbuild changes were made in osbuild/osbuild#341.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-22 15:25:59 +02:00
Major Hayden
ee441afb14 🥊 Resilient testing + log gathering
Convert the bash script to an ansible playbook so we can gracefully
handle testing failures and gather logs reliably. Colorful output
is nice, too.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-22 11:44:20 +00:00
Ondřej Budai
1e7978b4ef ci/travis: Disable the useless arm64 tests
The tests don't do anything useful currently. This commit disables them
to save some resources and possibly speed up the CI a bit (the free plan
allows us to have only 5 concurrent jobs, so if all slots are full,
PRs have to wait).
2020-04-22 13:00:36 +02:00
Alexander Todorov
cd1e6d3aaf tests: replace cmd.Diff() with require functions 2020-04-20 14:00:49 +02:00
Alexander Todorov
fb7373aa62 tests: Use the require package 2020-04-20 14:00:49 +02:00
Ondřej Budai
5e49b026ca tests: remove the old aws unit test
The old aws unit test is not very useful now, because there's the new
integration test which covers a lot more. Therefore, this commit
removes it.

Fixes #512
2020-04-19 21:54:43 +02:00
Alexander Todorov
869bb2afd7 tests: Use the require/assert package and replace cmp.Diff 2020-04-19 18:20:57 +02:00
Major Hayden
3740e9bc6b 🐎 Allow qemu to use all available CPUs
Speed up the boot tests by allowing qemu to use all of the available
CPUs on the system. Our CI VMs have at least 2 CPUs and this shortens
the time required for a boot test.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-17 17:10:56 +02:00
Major Hayden
af0f3a4585 🦥 Try running some integration tests together
We may be able to shorten test time by running some tests
simultaneously.

Signed-off-by: Major Hayden <major@redhat.com>
2020-04-16 15:24:58 +00:00
Lars Karlitski
4a710429de worker: rename API to Server
This makes it symmetric with the client:

    s := worker.NewServer()
    c := worker.NewClient()
2020-04-16 01:02:16 +02:00
Lars Karlitski
ac40b0e73b jobqueue: rename to worker
This package does not contain an actual queue, but a server and client
implementation for osbuild's worker API. Name it accordingly.

The queue is in package `store` right now, but about to be split off.
This rename makes the `jobqueue` name free for that effort.
2020-04-16 01:02:16 +02:00
Jacob Kozol
76bd5ab984 docs: update cockpit-composer repo url
Cockpit-composer has moved from the weldr github organization to the
osbuild organization and its github url has changed. The url in the
man-page source is updated.
2020-04-15 20:26:55 +02:00
Jacob Kozol
39a162368c README: update cockpit-composer repo url
Cockpit-composer has moved from the weldr github organization to the
osbuild organization and its github url has changed. The README's url is
updated.
2020-04-15 20:26:55 +02:00
Ondřej Budai
dbfc2a0929 10
Release osbuild-composer version 10
2020-04-15 16:59:42 +02:00
Martin Sehnoutka
aa39579ff8 travis: disable image tests on arm to workaround kernel bug
The image tests fail in travis because there is a bug in the kernel,
that travis uses. See this upstream bug report for a reference:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1872757
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
e34607b955 travis: plug in arm image test cases
The test generation script we use outputs the test cases prefixed with
"fedora_$RELEASE" so I renamed all the current test cases to follow this
convention and also changed the travis job names so that it can run both
x86_64 test cases and aarch64 test cases.
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
58b550061b test/cases: include fedora test cases for aarch64
These tests were generated by the script in tools/ directory and are not
modified in any way.
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
439b005514 distro: harcode partuuids
We need to make partition uuids stable to be able to run image-info
tests on images using gpt. For example all aarch64 images use gpt.

Also change the type of the (part) UUID to string because that's what
the other UUIDs use and it is easier to work with.
2020-04-15 15:22:57 +02:00
Martin Sehnoutka
e887518736 image-tests: Include qemu command specific for aarch64
The osbuild-image-tests don't currently support boot test for any
alternative architecture because the qemu-system-x86_64 command is
hardcoded. This patch introduces a branch specific to aarch64, but
without a KVM support as I was unable to make it run in Beaker, which is
currently the only offering we have with ARM machines. As a workaround
the boot tests will be skipped if kvm kernel module is not found and only
image-info tests will run.
2020-04-15 15:22:57 +02:00
Brian C. Lane
f960985c17 client: Add functions to support compose testing
Also adds new types to weldr/json.go to support them.
ComposeEntry had to be duplicated instead of used as-is because it
enforces image type strings that do not match what the API uses (the API
types are all lower case, the internal names are capitalized).
2020-04-15 11:35:05 +02:00
Brian C. Lane
7c86dc533c client: Add GetRawBody function to return the io.ReadCloser from the request
And refactor GetRaw to use it.
2020-04-15 11:35:05 +02:00
Brian C. Lane
b6bf49fc46 weldr: Fix /compose/image response for an unknown UUID
If the UUID is unknown it should return UnknownUUID not
BuildMissingFile.
2020-04-15 11:35:05 +02:00
Brian C. Lane
bd061b575d weldr: Fix the compose/delete response
The UUID list should only include UUIDs that are successfully deleted.
If there was an error it should only be listed in the errors list. This
matches the behavior of lorax-composer.
2020-04-15 11:35:05 +02:00
Brian C. Lane
2860398c2a store, weldr: Add support for fake composes
Yes. This goes against my desire not to change code to accommodate
tests. But there is no other good way to test compose results without
long running, and possibly fragile, composes. And this matches lorax's
behavior.

The change adds support for the ?test=1|2 query parameter to the compose
POST, and a new store function - PushTestCompose that handles creating
the fake compose results.

Passing ?test=1 will create a failed compose. Passing ?test=2 will
create a successful compose, but one without any files.

The purpose of these is to be able to test the compose result API
responses like compose/failed, etc.
2020-04-15 11:35:05 +02:00
Martin Sehnoutka
ebeecfaf33 github/workflows: downgrade golang to 1.12
We currently declare compatibility with golang 1.12 so we should also
use it in our CI. Once we agree that we would benefit from some features
in golang 1.13 or 1.14 we can bump it back.
2020-04-15 10:34:32 +02:00
Ondřej Budai
b2048b9796 upload/aws: double the timeout for snapshot import
us-east-1 seems to very slow these days, some imports can take up to
15 minutes. This commit raises the number of attempts before we give up.
Previously, we did 40 attempts, each delayed by 15 seconds, making the total
timeout equal to 10 minutes. Now we do 80 attempts with the same delay,
making the total timeout 20 minutes.
2020-04-15 01:16:33 +02:00
Martin Sehnoutka
7ff15e1fc2 workflow: enable updates-testing repo when installing osbuild
The source of issue here is that our release cycles are synchronized and
if we want to use the latest released osbuild we need to wait for the
bodhi process. It makes sense that we don't want to use latest osbuild
from git master but we should be confident enough in the version we
submit to bodhi.

Using the version from updates-testing therefore fixes the issue with
synchronization and avoids using unreleased versions.
2020-04-14 19:12:44 +02:00
Martin Sehnoutka
cdb4b72cf0 osbuild: add partuuid into the partition struct
The partuuid is a uuid of a specific GPT partition as opposed to the ptuuid
which is associated with the partition table and filesystem uuid which
is associated with a filesystem on a partition.

The support for partuuid was introduced in osbuild 11, see this PR for
reference: https://github.com/osbuild/osbuild/pull/306
2020-04-14 07:55:48 +02:00
Tom Gundersen
bb85acf36f dnf-json: set metadata_expire
We were using dnf's default of 48h, but that does not work for
updates repositories, as they depend on an expiration time of 6h.

Allow the metadata_expire value to be configured per repository.
If the value is unset, then never expire the metadata. Set the
value to 6h for all the fedora testing repos.

This fixes issue #476.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-04-11 19:14:02 +02:00
Martin Sehnoutka
ae294f967d distro: don't include grub2 stage in ext4 images
There is no point in having the grub2 stage in pipelines for image types
that are not bootable. The current version is probably a result of
previous refactoring where the member variable was named `IncludeFSTab`.

Moving the grub2 stage into the conditional branch should also fix test
generation on aarch64.

Finally it is necessary to regenerate test cases for non-bootable image
types.
2020-04-11 13:10:13 +02:00
Martin Sehnoutka
bceb51b330 tools/image-info: dont fail if /boot/grub2/grubenv is missing
The file is missing on non-bootable images and we skip missing files in
all other cases. Do it in this one as well.
2020-04-11 13:10:13 +02:00
Brian C. Lane
4f502a286c store: Set JobStarted time when PopJob is called
If you don't set the time it ends up being the default Go time which is
1/1/1 and when you convert that using UnixNano() you get a nice big
negative number (-6795364578871345152) which then eventually shows up in
the queue, finished, and failed output as 'Fri Aug 30 17:47:39 1754'
and since the Time Travel feature is not yet complete this is
impossible.

The fix is to set it when the job is started.
2020-04-11 12:42:50 +02:00
Lars Karlitski
54c44cf135 README: we're only requiring Go 1.12 right now 2020-04-09 15:18:58 +02:00
Lars Karlitski
47df3820ce jsondb: don't use error wrapping (%w)
This is a Go 1.13 feature. We're trying to run on 1.12 for now.
2020-04-09 15:18:58 +02:00
Major Hayden
a604482f09 📜 Add PR gating docs
Signed-off-by: Major Hayden <major@redhat.com>
2020-04-09 12:33:38 +00:00
Jacob Kozol
105124dd25 store: use default size in image build
If a user creates a compose with a size of 0, the default image size for
the image type should be used. Also, certain image types have
requirements for the image size. In order to ensure that the proper image
size is stored in the compose object, the compose's ImageBuild object
uses ImageType.Size() to get the correct image size for the image type.
2020-04-09 13:56:21 +02:00
Martin Sehnoutka
d702760182 test/cases: regenerate fedora test cases for x86_64
We made few changes to the format of the test cases, regenerate them to
reflect the change and also to make sure it still works.
2020-04-09 13:22:59 +02:00