Commit graph

43 commits

Author SHA1 Message Date
Ondřej Budai
8d71773f7d 8
Release osbuild-composer version 8
2020-03-18 17:39:15 +01:00
Jakub Rusz
31a3cc6455 tests: rewrite rcm-tests to use go test framework
Fixes #311
2020-03-18 16:23:43 +01:00
Ondřej Budai
8d46da027e spec: remove the changelog
The changelog is distribution-specific, therefore it doesn't make sense
to have it upstream.
2020-03-18 15:23:26 +01:00
Martin Sehnoutka
76b236796c spec: add systemd scriptlets for the rcm subpackage
Fedora packaging guidelines require that we use scriptlets when shipping
unit files:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd
the rcm subpackage needs to use these as well as the main package.
2020-03-18 09:59:58 +01:00
Brian C. Lane
548c58ddda weldrcheck: Convert to go testing framework + testify/require
Convert weldrcheck to use the standard go testing framework along with
the github.com/stretchr/testify/require assert package.

This also removes the cmd/osbuild-weldr-tests and builds the test binary
directly from the weldrcheck package. This makes it easier to organize
the code instead of putting it all into a single main_test.go file.
2020-03-17 21:10:00 +01:00
Lars Karlitski
7a3c82a405 spec: build and install osbuild-rcm-tests 2020-03-17 08:38:15 +01:00
Ondřej Budai
b4a7bc6467 tests/image: add booting tests
This commit makes the osbuild-image-tests binary doing the same set of tests
like the old test/run script.

Changes from test/run:
- qemu/nspawn are now killed gracefully. Firstly, SIGTERM is sent.
  If the process doesn't exit till the timeout, SIGKILL is sent.
  I changed this because nspawn leaves some artifacts behind when killed
  by SIGKILL.
- the unsharing of network namespace now works differently because of
  systemd issue #15079
2020-03-13 18:06:56 +01:00
Alexander Todorov
bd46389059 tests: use go's test framework in osbuild-dnf-json-tests
This allows us to take advantage of the `testing` package. It also gives
the resulting test binary common command line arguments (same as `go
test`).

Tests need to be compiled with `go test -c`, which injects a `Main()`
that calls the Test* functions.

This is not supported by the golang rpm macros. Thus, build this binary
by calling `go test -c` directly, but taking care to pass the same
linker flags as the `%gobuild` macro.

Mark the test binary with the `integration` build constraint, so that
`go test ./...` doesn't pick them up. That's only for unit tests.

The idea is to move all other test binaries to this scheme as well.

Spec file changes by Lars Karlitski <lars@karlitski.net>
2020-03-10 20:29:19 +01:00
Ondřej Budai
d3d16b6afa 7
Release osbuild-composer version 7
2020-03-05 17:30:50 +01:00
Ondřej Budai
a504fc8801 spec: add weldr provide
Since the recent commit (04db4fa) we are no longer provider
of lorax-composer. This was needed because when installing cockpit-composer,
which depends on lorax-composer, dnf chose us as the lorax-composer provider
instead of the original lorax-composer package. As we are not yet ready to
fully replace lorax-composer, this broke the cockpit-composer tests.

This commit is the first part of long term fix. Osbuild-composer is now
a provider of weldr. Soon, lorax-composer will also be a provider of
weldr. After that, cockpit-composer will be switched to be depending
on weldr. Also, it will suggest lorax-composer, which will force dnf
to use lorax-composer as the default weldr backend. If someone wants
to experiment with osbuild-composer, it will be possible, because
it will also be a provider of weldr and there will be no need to
install lorax-composer to satisfy cockpit-composer dependencies.
2020-03-05 15:39:08 +01:00
Lars Karlitski
04db4fa3f5 spec: remove lorax-composer provide
We're not fully compatible with lorax-composer's API yet, and we don't
provide lorax-composer's systemd unit files.

As a result, cockpit-composer's integration tests fail, because `dnf
install lorax-composer` on Fedora can result in installing
osbuild-composer in some cases.
2020-03-05 11:04:30 +01:00
Brian C. Lane
2d4e4d14d0 Add osbuild-weldr-tests to run the weldr integration tests
This runs tests against a running API server, either lorax-composer or
osbuild-composer, and reports the results to stdout. It uses the
/run/weldr/api.socket to communicate with the server.
2020-03-03 12:21:40 +01:00
Ondřej Budai
6a37883c1e spec: move worker-related service units to worker sub-package
Prior this commit installing the worker sub-packages shows the following
warning:

Failed to preset unit: Unit file osbuild-worker@.service does not exist.

Moving the unit file to the sub-package fixes it.
2020-03-02 14:29:38 +01:00
Ondřej Budai
0dcd16aa36 tests: begin rewriting of ./test/run test suite to Go
./test/run test suite has served us well over the last months. However,
there is currently a major effort to run the better defined integration
test suite on a CI. Nonetheless, two very important parts are still missing
from the integration test suite: inspecting the image with image-info
and booting the image. This commit begins the work on this matter by porting
a part of ./test/run suite to Go. Currently, only image-info tests work, the
rest will come in the following commits.
2020-02-26 16:58:39 +01:00
Brian C. Lane
58839cf927 Use semver to enforce blueprint version numbers
This changes osbuild-composer's behavior to match lorax-composer when
encountering invalid versions. Instead of leaving them as-is it will
return a BlueprintError explaining the problem. eg.

"errors": [
    {
        "id": "BlueprintsError",
        "msg": "Invalid 'version', must use Semantic Versioning:  is not in dotted-tri format"
    }
]

This is enforced on new blueprints (including the workspace). If a
previously stored blueprint has an invalid version and a new one is
pushed it will use the new version number instead of trying to bump the
invalid one.

This also moves the version bump logic into blueprint instead of store,
and adds an Initialize function that will make sure that the blueprint
has sane default values for any missing fields.

This includes tests for the Initialize and BumpVersion functions.
2020-02-25 09:00:35 +01:00
Tom Gundersen
ca599a8f6f 6
Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-02-24 16:25:13 +01:00
Martin Sehnoutka
28a1230105 spec: create rcm subpackage
We don't want to ship the RCM API socket unit in the main
osbuild-composer package. This way it will be only available in the -rcm
subpackage.
2020-02-24 12:03:25 +01:00
Jakub Rusz
0a4ce9dc68 spec: fix osbuild version dependency 2020-02-20 18:14:24 +01:00
Ondřej Budai
04c0becd67 spec: Split the worker into its own rpm subpackage
As the worker can now be running on a different machine than the composer
it makes sense to install only worker binary on some machines. This commit
does exactly that - worker is now its own subpackage with the beautiful name
of golang-github-osbuild-composer-worker.

The main osbuild-composer package requires the worker subpackage, therefore
there will always be worker installed with composer. When composer is started
one local worker process will be spawned. If you don't want the default
worker process you need to mask its unit file:

systemctl mask osbuild-worker@1.service
2020-02-20 13:47:59 +01:00
Martin Sehnoutka
251d63c06a osbuild-tests: create repository test
this test will create a temporary directory, create repo inside, then
fetch the checksum, and finally clean up the directory
2020-02-20 13:04:28 +01:00
Alexander Todorov
90bf26cc4b Requires osbuild>=7 because of the --build-env argument 2020-02-19 23:39:00 +01:00
Tom Gundersen
02a194f612 tests: add basic integration tests
Introduce a new osbuild-tests command and ship it in the -tests
sub-package.

The intended usecase is to install the -tests subpackage into an
otherwise pristine VM, and call the osbuild-tests binary over ssh
from the outside of the booted VM. If the binary exits with a return
code of 0, the tests passed, otherwise they failed. The VM should
not be reused after running the tests.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-01-03 22:35:52 +01:00
Tom Gundersen
4919ef1271 repositories: install the base repositories in the filesystem
During development of a new distro, we need to test composer against
nightly or beta repositories, but we cannot ship composer itself
with the nightly repository information hardcoded in. At the same
time, we want to distinguish between the system repositories of the
host and the repositories we use to generate images (the host may not
use the same distro/version/architecture as the target, and it may
include custom repositories that the target should not).

We therefore ship per distro repository information that can be
overriden (typically in testing) by dropping files in /etc.

For now use the latest nightlies for RHEL-8.2, we may want to
replace these with the official mirrors for GA eventually.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-01-03 22:35:52 +01:00
Tom Gundersen
ddde71f9c1 spec: make the same specfile work on RHEL as on Fedora
In RHEL golang dependencies must be vendored, whereas on Fedora they
must be packaged separately. Add conditionals accordingly.

Some macros are not yet available in RHEL, so fall back to older
versions. We may want to just use macros avilable everywhere
unconditionally, but I left that for a follow-up.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-23 17:09:47 +01:00
Tom Gundersen
fce9fa9fa2 spec: provide lorax-composer
The API provided is the same, allow osbuild-composer to replace
lorax-composer.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-23 17:09:47 +01:00
Ondřej Budai
66885bc9d6 spec: fix build
Commit 04012641 broke the rpm build by introducing bad package name
to be build. This commit fixes it.
2019-12-17 08:54:05 +01:00
Lars Karlitski
74812cad85 5 2019-12-16 01:49:09 +01:00
Tom Gundersen
04012641ba spec: don't ship devel tools
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-11 15:23:24 +01:00
Tom Gundersen
b21ebf81c8 4
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-01 00:09:17 +01:00
Ondřej Budai
613b659b95 test: use google cmp library to do the deep reflect
The cmp library has two advantages:

- it shows diffs between compared values
- it allows ignoring fields based on field name or type
2019-12-01 00:05:17 +01:00
Alexander Todorov
4790e4e593 Provides: osbuild-composer in .spec
this is a small helper to enable easy switch between backends
in the existing test suite where we reference everything by name.

The current working variant is:

	yum install $BACKEND
	systemctl enable $BACKEND.socket

where BACKEND is either lorax-composer or osbuild-composer!
2019-11-28 14:06:54 +01:00
Tom Gundersen
7f5c869cd2 upload/aws: add a sample AWS upload client
This commandline tools uploads a file to S3, as a proof of concept.

All options are mandatory. Credentials are only read from the
commandline and not from the environment or configuration files.

The next step is to add support for importing from S3 to EC2,
currently the images we produce cannot be imported as-is, so this
requires more research.

To try this out: create an S3 bucket, get your credentials and
call the tool, passing any value as `key`. Note that if the key
already exists, it will be overwritten.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 01:05:34 +01:00
Martin Sehnoutka
78ea0e0b6f Introduce Azure upload CLI utility
It uses Azure SDK to connect to Azure storage, creates a container there
and uploads the image. Unfortunately the API for page blobs does not
include some thread pool for upload so I implemented one myself. The
performance can be tweaked using the upload chunk size and number of
parallel threads.

The package is prepared to be refactored into common module within
internals package as soon as we agree on the of these common packages
for image upload.

Add azure-blob-storage rpm package as a dependency

It didn't work for me using the `golang(package)` syntax. Using the
package name explicitly works.
2019-11-25 17:10:11 +01:00
Ondřej Budai
cd5a192dfd 3 2019-11-15 17:22:20 +01:00
Ondřej Budai
306ca58588 spec: update to packaging guidelines
- %{_libexecdir}/osbuild-composer/ is good enough for listing the directory
  and its whole tree

- summary should not end with full stop
2019-11-13 19:37:28 +01:00
Tom Gundersen
1055d1167d 2
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-11 21:13:43 +00:00
Tom Gundersen
9c34e6bbea spec: make python script executable
This is how the file is in git, install with the same permissions.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-11 21:13:43 +00:00
Tom Gundersen
6d20991e90 spec: update to golang packaging guidelines
The guidelines have changed for F32, so update to use the goprep and
gochecks macros.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-11 21:13:43 +00:00
Tom Gundersen
339e887693 spec: add systemd hooks
According to Fedora packaging guidelines, the rpm scriptlets must
call into systemd to make sure the services are enabled/disabled
corerctly on install and uninstall.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-11 21:13:43 +00:00
Tom Gundersen
88c0cf4b27 distro: move binaries to /usr/libexec to follow Fedora packaging guidelines
This makes no difference, so let's just put them where the Fedora
guidelines say they should be.

Also, make sure to own the containing directory.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-11 21:13:43 +00:00
Tom Gundersen
d87d9eb27b spec: fix a couple of rpmlint warnings
Addressing https://bugzilla.redhat.com/show_bug.cgi?id=1768774#c1

The review also points out that the Source0 URL is wrong, I fixed
this by pushing a new tag: `v1`, rather than just `1`.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-11 21:13:43 +00:00
Tom Gundersen
d9e3f1f173 1
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-10-31 23:05:32 +01:00
Ondřej Budai
ead3ae6cab Add spec file for building RPM package
The version is set to 0 as we haven't release the first version yet.
2019-10-25 14:21:04 +02:00