Commit graph

1177 commits

Author SHA1 Message Date
Major Hayden
4ca535c673 Add RHEL 8.3 repository override
Override the repository for RHEL 8.3 since they can't be registered yet.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-12 09:59:25 +02:00
Alexander Todorov
6d904f062c tests: composer-cli blueprints undo. Closes #615
the remaining test for composer-cli compose cancel is part of #757
2020-06-12 06:30:54 +02:00
Ondřej Budai
37bc80b31d image-tests: allow disabling of local booting
On some environments (like RHEL gating) there's no virtualization available.
This commit adds -disable-local-boot argument to osbuild-image-tests. When
this argument is present, the local booting is skipped. This doesn't affect
the cloud booting, the test binary still tries to do that. If no credentials
are available, the fall back to local booting will be skipped if
-disable-local-boot is given.
2020-06-12 06:29:32 +02:00
Lars Karlitski
33a4c55a6f osbuild-worker: don't use /var/cache for temporary directories
When osbuild-composer crashed, it left temporary directories in
`/var/cache`. Use `/var/tmp` for these output directories, because
systemd will clean these up (we set PrivateTmp=true).

Also, put the store into `/var/cache/osbuild-store`. The worker does not
checkpoint anything. The store is only used as a cache for rpms. That
can be shared between multiple workers and successive runs of a single
worker.
2020-06-12 00:13:37 +02:00
Major Hayden
89117ebf3a Deploy quickly in CI without Ansible
Speed up the deployment during CI runs and avoid the need for lots of
extra packages to run Ansible. This gets us closer to running bare
images for each distro that better simulates a customer environment.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-11 15:58:30 -05:00
Major Hayden
d607365663 Fix image test VERSION_ID
On RHEL, `VERSION_ID` shows up as `8.2` or `8.3`, but we need it to be
just `8`.

Remove the period and everything after it in `$VERSION_ID`.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-11 15:27:06 -05:00
Martin Sehnoutka
1e5c31a7ad distro/rhel8: introduce s390x support
This patch introduces support for s390x architecture. It has some
specific requirements like using kernel-cmdline stage before the RPM
stage because RPM scriptlets require these values to be present in the
system already. It also uses zipl stage and bootloader as opposed to all
the other architectures.
2020-06-11 21:50:09 +02:00
Martin Sehnoutka
d20682fcae osbuild: introduce kernel-cmdline stage
This stage can be used to set kernel boot parameters.
2020-06-11 21:50:09 +02:00
Tom Gundersen
fcd5ff76ac tools/image-info/ostree: don't record the commit sha
This is not stable between builds, instead, record the inputhash, which
is.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 20:44:17 +02:00
Tom Gundersen
2dfa0260a6 schutzbot: run image tests on RHEL for Edge
Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 20:44:17 +02:00
Tom Gundersen
3925b3f6eb test/cases/rhel8: add RHEL for Edge image test case
We currently don't have a boot-test for this, it must be performed
manually.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 20:44:17 +02:00
Tom Gundersen
4fe8bb6baf test/cases/rhel8/tar: add image info
image-info now supports tar-balls, so add this to the test-case.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 20:44:17 +02:00
Tom Gundersen
dec644dec4 tools/test-case-generation: don't skip image info for tar
This is now supported, so default to include tar image info.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 20:44:17 +02:00
Tom Gundersen
be3541335e tools/image-info: drop a stray print()
This resulted in invalid JSON on stdout.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 20:44:17 +02:00
Tom Gundersen
654eb9d280 tools/test-case-generator: add iot and edge test-case generation 2020-06-11 20:44:17 +02:00
Tom Gundersen
c51de68301 tools/test-case-generator: make image-types a required argument
Also allow a list of them to be passed. Generating 'all' image types
makes less sense now that different distros/arches support different
ones.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 20:44:17 +02:00
Peter Robinson
f32770fed6 distro/rhel8: add RHEL for Edge
Initial definition for RHEL for edge package set on x86.
This is based marginally on the upstream Fedora IoT package set
but slimmed down and adjusted for RHEL package naming.

Based on Tom's patch.

Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2020-06-11 20:44:17 +02:00
Major Hayden
d9c7c2dd0b Convert image tests to bash
Simplify the image tests with bash and allow the output to appear live
in the Jenkins interface.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-11 13:34:36 -05:00
Tom Gundersen
cffb527a39 spec: bump osbuild deps
Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-11 19:17:03 +02:00
Major Hayden
d953e5ea18 Convert base test runner to bash
Simplify the base test runner and make it easier to see the output live.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-11 11:31:13 +02:00
Major Hayden
3d488385ff Gather compose log/metadata for AWS/qemu test
Gather logs directly for AWS + qemu tests using `composer-cli compose
log` and also gather the metadata. This will hopefully help diagnost the
problems we are seeing in #754.

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-10 16:26:43 -05:00
Major Hayden
71c4dd2c20 Cleanup integration tests
* Ensure we get the output of `composer-cli compose start` for
  diagnostics
* Hide the annoying `genisoimage` output
* Simplify the `IMAGE_EXTENSION` check
* Make it more clear what is happening while we wait for ssh

Signed-off-by: Major Hayden <major@redhat.com>
2020-06-10 13:45:38 -05:00
Tom Gundersen
130c4b80a2 test/case: update test-cases
This updates the test-cases to reflect the changes in the previous few
commits.

The osbuild rpm stage options format was changed, and the build root on
RHEL8 now includes SELinux policy, and is labelled correctly.

None of these changes affect our output images, so the image info is
unchanged.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
ab276bdb77 tools/test-case-generator: add more options
Allow individual test-cases or sub-sets of test-cases to be generated
more easily.

We allow explicit skipping of image-info generation (and hence the
osbuild run), and also individual image types to be specified.

Also drop distros and image types that are no longer supported.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
cbf19d1319 distro/rhel8: label the build root
We require the right SELinux labels to be set on some of the tools we
use, make sure the policy is installed and the labels applied in the
buildroot, in the same way as in the target image.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
5c3f4193e5 osbuild/rpm: set check_gpg per-package
Rather than passing an array of checksums, pass an array of objects
with package properties. One is the `checksum`, which is required, and
in addition to that we now pass the boolean check_gpg, which indicates
that that RPM should have its GPG signature verified.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
42de929adb rpmmd/Depsolve: expose whether to check GPG signature for each RPM
Currently each repo is annotated with this information, use the mapping
we have from packages to their originating repos to annotate each
PackageSpec with the same information.

This information is not serialized, and not yet used. It may be used to
expose this information to osbuild's org.osbuild.rpm stage.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
e9cd6409ef rpmmd/PackageSpec: duplicate the type definition
Use the new dnfPackageSpec only for communicating with dnf-json. This
allows us to drop the RepoID from the public type, as that is only meant
to be used internally in `Depsolve()`.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
4e75acc44a osbuild-pipeline: support check_gpg
Allow this to be set on the input repos, and passed on to dnf-json.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
6a7e57ce8d rpmmd: allow check_gpg to be configured for system repos
The sources weldr API already supports this, so hook it up to be
represented on disk and in our internal state tracking too.

This does not yet hook this up to be respected by osbuild, which
currently takes this to be unconditionally set to true.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Tom Gundersen
32d81d7dbf submodule: update to v17
Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-10 19:25:54 +02:00
Ondřej Budai
3913f419e2 weldr: drop getPkgNameGlob method
Not used anywhere! :-)
2020-06-10 17:40:30 +02:00
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