Commit graph

57 commits

Author SHA1 Message Date
Roy Golan
bee932e222 Add support for OCI upload provider
Signed-off-by: Roy Golan <rgolan@redhat.com>
2022-01-28 15:16:47 +01:00
sanne
c43ad2b22a osbuild-service-maintenance: Clean up expired images 2021-12-03 00:14:09 +00:00
Tomas Hozza
c5a4946135 Test all manifests with depsolved package sets
Generated image test case manifests for all supported distros, arches and
image-types are being tested as part of distro unit tests. However due
to time constrains, the unit test does not depsolve the image's default
package sets and thus does not check if they changed in the internal
osbuild-composer's representation, compared to the generated image test
case.

Extend the `TestDistro_Manifest()` function used by the unit test to
allow depsolving image's package sets.

Introduce a new test case binary `osbuild-composer-manifest-tests`
allowing to check the manifests generated by composer for all supported
combinations of images against generated manifests, including depsolving
image's default package sets.

Introduce a new CI test case `manifest_tests.sh` executing the
`osbuild-composer-manifest-tests` binary and testing all existing image
test cases. Run it in CI on RHEL-9 runner.

Modify SPEC file to ship the newly added test case.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-11-19 19:50:25 +01:00
Simon Steinbeiss
dcb5220329 Switch to simple upstream releases
This commit changes our release process from the model of having a
release commit (and pull request) which also updated the NEWS.md file
and bumped the versions in the osbuild.spec and setup.py files to simply
pushing a tag.

After the tag (containing the release notes) is pushed, a GitHub
composite action is triggered that creates a GitHub release with the
contents of the git release tag. Furthermore the bumping of the version
number now always has to happen directly after a release to avoid having
to push a(n untested) commit to main for the release and this is also
handled by the GitHub composite action.

Finally packit pushes directly to dist-git now on pushing the release
tag, so no pull-request needs to be reviewed and merged anymore.

Consequently, we also drop the docs/news folder and its content and
adjust the PR template.
2021-10-27 13:03:53 +02:00
sanne
4a057bf3d5 auth: OpenID/OAUth2 middleware
2 configurations for the listeners are now possible:
- enableJWT=false with client ssl auth
- enableJWT=true with https

Actual verification of the tokens is handled by
https://github.com/openshift-online/ocm-sdk-go.

An authentication handler is run as the top level handler, before any
routing is done. Routes which do not require authentication should be
listed as exceptions.

Authentication can be restricted using an ACL file which allows
filtering based on JWT claims. For more information see the inline
comments in ocm-sdk/authentication.

As an added quirk the `-v` flag for the osbuild-composer executable was
changed to `-verbose` to avoid flag collision with glog which declares
the `-v` flag in the package `init()` function. The ocm-sdk depends on
glog and pulls it in.
2021-09-04 02:48:52 +02:00
Brian C. Lane
097eb9f04f Makefile: Add scratch build target
Sometimes you want to build an rpm without the tests and without running
%check
2021-08-16 13:16:53 +02:00
Lars Karlitski
9c2c92f729 jobqueue: Introduce jobqueue backed by a postgres database
Co-authored-by: sanne <sanne.raymaekers@gmail.com>
2021-07-28 21:52:31 +01:00
Tomas Hozza
87d82e529d Makefile: build osbuild-upload-gcp as part of build target
Build `cmd/osbuild-upload-gcp` as part of the `build` make target,
similar to other cloud providers.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-03-12 12:17:02 +01:00
Lars Karlitski
b7367e2519 Makefile: define commit on make (s)rpm
Prepending the definition to the spec file feels brittle. Stop doing
that – pass --define to rpmbuild instead.

Keep copying the spec file from git though, so that it's always using
the one from the last commit, and not the current checkout.
2020-11-17 08:56:17 +00:00
Lars Karlitski
f3b56cc305 master → main 2020-11-13 14:09:01 +01:00
Ondřej Budai
8e34cef1ec makefile: always use the same specfile name
rpmlint doesn't like SRPMs built from specfiles with a filename different
than what it's in the Name field inside the spec. This commit removes
the renaming. Now, the specfile is always named osbuild-composer.spec.
2020-11-12 12:57:53 +01:00
Ondřej Budai
073f9dc79a test/koji: move the koji test to schutzbot
The Koji test in Github actions was always a bit quick and dirty solution.
I think it's much nicer solution to run it on Schutzbot.

Therefore, this commit moves the koji_test.go to a new osbuild-koji-tests
executable. This new test isn't run in the base test suite as one would
anticipate but inside the koji.sh test. This is needed because
osbuild-koji-tests requires a running koji instance. This might change
in the future but I think it works for now.
2020-11-02 19:59:28 +01:00
Ondřej Budai
f43cc695ae spec: remove the old spec file
We decided to stop releasing into Fedora 31 therefore we don't need the old
spec file anyway.
2020-10-16 15:51:26 +02:00
Lars Karlitski
b25a350502 osbuild-composer: merge cloud API into main binary
This removes the osbuild-composer-cloud package, binary, systemd units,
the (unused) test binary, and the (only-run-on-RHEL) test in aws.sh.

Instead, move the cloud API into the main package, using the same
socket as the koji API, osbuild-composer-api.socket. Expose it next to
the koji API on route `/api/composer/v1`.

This is a backwards incompatible change, but only of the -cloud parts,
which have been marked as subject to change.
2020-10-16 09:37:04 +02:00
Ondřej Budai
2db4938a57 make: put all binaries into bin directory
Currently, we have osbuild-image-tests binary committed in the master branch.
IMHO the root cause is that we don't have it in .gitignore. Actually, I think
that it is pretty hard keep .gitignore in sync with the build target.

This commit solves the situation by putting all the built binaries into bin
directory and adding this directory into .gitignore. This way, it's much
harder to actually commit a new Go binary into repository.

This commit doesn't remove the binary as #1017 already does that.
2020-10-14 13:01:52 +02:00
Tom Gundersen
9d18c3bfa2 tests: rename composer-cli tests
These had the generic name osbulid-tests, rename the binary to more
closely describe what is under test: weldr API as composed by
composer-cli.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-10-06 13:08:26 +02:00
Ondřej Budai
68be242850 tests: introduce auth tests
This commit introduces a new test binary responsible for testing TLS
authentication.

Currently, it covers both remote worker API and Koji API. It tests that
the server refuses certificates issued by an untrusted CA or self-signed ones.
Also, it tests that the certificate is issued for an allowed domain.

TODO: certs with subject alternative name are currently not used in tests.
They should work just right, but a proper testing requires more tinkering with
OpenSSL than I'm willing to accept at this time
2020-09-23 11:08:21 +01:00
Ondřej Budai
fbaaf31a34 makefile: clean up certificate targets
1) generating a private key and signing request was merged into one command
2) -sha256 was dropped, let openssl decide which digest should be used
3) signing request is deleted after the it's signed
2020-09-23 11:08:21 +01:00
sanne raymaekers
9ca50ae3ac osbuild-composer-cloud: introduce the cloud-specific service 2020-09-22 11:38:28 +02:00
Tom Gundersen
06c582a206 tests: drop osbulid-composer-koji-test
This was not hooked up in CI, and was instead replaced by
`tests/image-tests/koji.sh`.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-09-17 17:34:57 +02:00
Ondřej Budai
91b86a1369 osbuild-composer: add a socket for Koji API
Add a systemd socket for Koji API. If enabled when osbuild-composer.service
is started, the service will also listen on the socket and serve Koji API
there.

Note that Koji API doesn't upload to Koji yet, this still needs to be hooked
up.

Based on a patch from Tom Gundersen, thanks!
2020-09-16 00:15:02 +01:00
Ondřej Budai
e399c05cb4 tests/image: remove travis constants
The tests are no longer run on Travis, therefore we don't need the special
setup to run them there.

This change should also fix #929 that is probably caused due to osbuild
executed in a weird way.

Fixes #929
2020-08-25 10:41:10 +02:00
Tom Gundersen
fbfa191c81 rcm: drop sub-package
The osbuild-composer-rcm package was never finished, not in use and will be replaced by osbulid-composer-koji.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-07-17 19:13:15 +01:00
Ondřej Budai
62b3cd68d7 makefile: change the indentation in release target
c886e1be changed the indentation of the NEWS file. This commit changes also
the indentation in the news template produced by `make release`.

Also - in front of the Location was changed to — to please David.
2020-05-28 00:31:30 +02:00
Ondřej Budai
3ce3a2ad80 makefile: add the old specfile to the release instructions 2020-04-29 18:15:04 +02:00
Ondřej Budai
3f9e5e1e35 makefile: fix parsing the version from the spec file
The .* before the digit group is greedy and it catches the first version
digit when the version >= 10. This commit changes the .* to [^[:digit:]]*
so it doesn't catch the first digit.
2020-04-29 18:15:04 +02:00
Ondřej Budai
75dd7886e4 makefile: do not print the comments in the release target
Prior this commit `make release` printed the comments. This commit fixes that.
2020-04-29 18:15:04 +02:00
David Rheinsberg
6319d52fe4 docs: import changelog as NEWS.md
Import a new `NEWS.md` file with the changelog for each release. This is
targetted at distributors, so it should contain information on new
features, modified features, and anything important to packagers. This
is not a replacement for the git-changelog, but rather a human-readable
instruction to packagers what needs to be changed when using the new
release.

Additionally, copy `make release` from *osbuild* to help in creating new
release entries in NEWS.md.
2020-04-01 00:22:59 +02:00
David Rheinsberg
d344e967e5 build: rework Makefile for man-page target
This adds `make man` with SRCDIR and BUILDDIR support. This is copied
from *osbuild*. Since `make man` will be the official way to build the
man-pages, lets also import `make help` and some documentation for the
Makefile.
2020-04-01 00:22:59 +02:00
Brian C. Lane
856eb59edf client: Move the weldrcheck integration tests to client
With this change the integration tests can now also be run as unit tests
against the mocked server. The way it works is this:

internal/client/unit_test.go sets up the mock server and is built
when the `integration` build tag is *not* included.

internal/client/integration_test.go sets up the connection to an
existing server and is built when the `integration` build tag *is*
included.

The test code is built and run for both cases.

Currently they all pass for the integration test run. The unit test
cases need some work because the mocked server isn't a real server with
real depsolving and package lists. A future commit will fix this.
2020-03-27 19:07:33 +01:00
Ondřej Budai
48a51611ec makefile: use the new spec file for rpm targets
This commit switches the rpm and srpm targets to use the new spec file.
Also, it introduces old-rpm and old-srpm targets to build an rpm from
the old spec file.

Note that the rpm target builds also the tests subpackages (they are not
built by default).
2020-03-25 11:43:39 +01:00
Brian C. Lane
a87c0ee44d Makefile: Fix osbuild-image-tests build 2020-03-23 21:08:01 +01:00
Ondřej Budai
acfb461aa5 tests/image: switch the implementation to go testing framework
We're currently rewriting all the integration tests to use the Go
testing framework. This commit does the switch for the image tests.

I decided not to use the testing framework in functions which are
not directly tight to testing (booting images, running osbuild). I think
it's reasonable to use classic error handling there and propagate the errors
to places directly tight to testing and use the testing library.
This enables us to reuse the code in different part of projects if needed.
2020-03-19 14:25:08 +01:00
Jiri Kortus
48027293cb Use testing module syntax and asserts in osbuild-tests
Fixes #312
2020-03-19 13:22:14 +02:00
Jakub Rusz
31a3cc6455 tests: rewrite rcm-tests to use go test framework
Fixes #311
2020-03-18 16:23:43 +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
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
Martin Sehnoutka
885704db05 tests: introduce RCM API testing executable
It is an equivalent to what we already have for Weldr API but this one
is for the RCM API. It should test the expected use cases:
 * submit a compose
 * get a status
2020-03-09 09:37:11 +01:00
Lars Karlitski
23fe851d4d Makefile: use spec file from HEAD to make rpm
The spec file in the current working directory might have changes. When
building rpms with the commit hash in the version, they ought to be
built with the spec file from that hash as well.
2020-03-05 20:37:02 +01:00
Lars Karlitski
5e4d6359fe Makefile: document rpm targets 2020-03-05 15:57:46 +01:00
Lars Karlitski
a6cc88e4ff Makefile: split rpm rule
Reintroduce `make srpm`, because it is useful for some workflows and
executes much quicker than building the binary packages.
2020-03-05 15:57:46 +01:00
Lars Karlitski
39b584e077 Makefile: remove PACKAGE_NAME
It was not used consistently. Most of the things this Makefile does is
specific to osbuild-composer anyway.
2020-03-05 15:57:46 +01:00
Lars Karlitski
132554d015 Makefile: simplify make rpm
Prior to this patch, `make rpm` would produce rpms that have the latest
tag as their versions. This was confusing, because one could never know
which contents are in a locally built rpm.

Change this so that the is version always based on the commit hash of
HEAD. This is easy: the golang macros read a `%commit` macro when it
exists and do this for us.

To simplify more, only define `%_topdir` to ./rpmbuild and use
rpmbuild's known directory structure (SPEC, SOURCES, RPMS, ...)
otherwise, to make it easier to find build results.

Build the specfile, tarball, source rpms, and rpms with `make rpm`,
without separate sub-targets. We can reintroduce them if they're needed
somewhere.

Also remove the `check-working-directory` target. It should be clear
from the output that only the currently-committed files are included,
because the resulting tarball and rpms contain the commit hash. Without
the check, one can work on the Makefile without having to commit all the
time, for example ;)
2020-03-04 23:06:37 +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
820d23fd9d Add tcp and tls support for worker and job API
There's a usecase for running workers at a different machine than
the composer. For example when there's need for making images for
architecture different then the composer is running at. Although osbuild has
some kind of support for cross-architecture builds, we still consider it
as experimental, not-yet-production-ready feature.

This commit adds a support to composer and worker to communicate using TCP.
To ensure safe communication through the wild worlds of Internet, TLS is not
only supported but even required when using TCP. Both server and client
TLS authentication are required. This means both sides must have their own
private key/certificate pair and both certificates must be signed using one
certificate authority. Examples how to generate all this fancy crypto stuff
can be found in Makefile.

Changes on the composer side:
When osbuild-remote-worker.socket is started before osbuild-composer.service,
osbuild-composer also serves jobqueue API on this socket. The unix domain
socket is not affected by this changes - it is enabled at all times
independently on the remote one. The osbuild-remote-worker.socket listens
by default on TCP port 8700.

When running the composer with remote worker socket enabled, the following
files are required:
- /etc/osbuild-composer/ca-crt.pem     (CA certificate)
- /etc/osbuild-composer/composer-key.pem (composer private key)
- /etc/osbuild-composer/composer-crt.pem (composer certificate)

Changes on the worker side:
osbuild-worker has now --remote argument taking the address to a composer
instance. When present, the worker will try to establish TLS secured TCP
connection with the composer. When not present, the worker will use
the unix domain socket method. The unit template file osbuild-remote-worker
was added to simplify the spawning of workers. For example

systemctl start osbuild-remote-worker@example.com

starts a worker which will attempt to connect to the composer instance
running on the address example.com.

When running the worker with --remote argument, the following files are
required:
- /etc/osbuild-composer/ca-crt.pem     (CA certificate)
- /etc/osbuild-composer/worker-key.pem (worker private key)
- /etc/osbuild-composer/worker-crt.pem (worker certificate)

By default osbuild-composer.service will always spawn one local worker.
If you don't want it you need to mask the default worker unit by:
systemctl mask osbuild-worker@1.service

Closing remarks:
Remember that both composer and worker certificate must be signed by
the same CA!
2020-02-20 13:47:59 +01:00
Ondřej Budai
2d09f7c27f Add missing PHONY targets to Makefile 2020-02-20 13:47:59 +01:00
Martin Sehnoutka
d1c766abe7 Makefile: include tests in make build
When I run make build I expect to build all the code we have to make
sure it still compiles just fine.
2020-02-20 13:04:28 +01:00
Alexander Todorov
a1c1ba1255 Build osbuild-tests as well 2020-02-14 15:37:24 +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
df73a9bfad service: make sure the worker pulls in the socket
The worker cannot be started unless the socket is available, so make
this a hard requirement.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-11 15:23:24 +01:00