Commit graph

1535 commits

Author SHA1 Message Date
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
2dc0ecec73 koji: mark the osbuild version CGImport metadata as TODO
So we don't forget. Also, the version is changed to 0 so it's clear that
it is just a placeholder because osbuild 0 was never released.
2020-10-27 19:01:30 +00:00
Ondřej Budai
353a65356c koji: add signature to the CGImport metadata components
As suggested by Brew maintainers Tomáš Kopeček and Lubomír Sedlář.
2020-10-27 19:01:30 +00:00
Ondřej Budai
83746c5f13 osbuild/rpm: add sigpgp and siggpg keys to the metadata
This was introduced in osbuild 23, so we also need to bump the dependency
in the spec file and also the submodule.

The test is also modified and a typo in its name is fixed.
2020-10-27 19:01:30 +00:00
Ondřej Budai
befeef34a5 koji: use nvra as the filename for images
We have the same thing for AWS. The AWS target also specifies under what name
should be the image available in EC2.

As requested by Brew maintainers Tomáš Kopeček and Lubomír Sedlář.
2020-10-27 19:01:30 +00:00
Ondřej Budai
b2ed59c385 koji: use none container arch in CGImport metadata
osbuild runs directly on the host, there's no intermediate container,
therefore we should set the container type to none.

As suggested by Brew maintainers Tomáš Kopeček and Lubomír Sedlář.
2020-10-27 19:01:30 +00:00
Ondřej Budai
a0832d22e0 koji: use the host arch as the buildroot and image arch in CGImport metadata
As suggested by brew maintainers Tomáš Kopeček and Lubomír Sedlář.
2020-10-27 19:01:30 +00:00
Ondřej Budai
c64d46416e koji: use the host name from /etc/redhat-release in CGImport metadata
As suggested by Brew maintainers Tomáš Kopeček and Lubomír Sedlář.
2020-10-27 19:01:30 +00:00
Ondřej Budai
3480fe3093 koji: use typeinfo in CGImport metadata instead of the legacy format
From Koji Content Generator Metadata[1]:

"maven, win, or image: Legacy build type names which appear at this level
instead of inside typeinfo."

=> see, it's legacy

"typeinfo: A map whose entries are the names of the build types used for
this build, which are free form maps containing type-specific information
for this build."

=> struct{} is used for typeinfo.image because the docs says it should contain
"a free form map", null apparently isn't an option.

[1]: https://docs.pagure.org/koji/content_generator_metadata/

As suggested by the Brew maintainers Tomáš Kopeček and Lubomír Sedlář.
2020-10-27 19:01:30 +00:00
Xiaofeng Wang
f28e860e69 test: Add greenboot testing 2020-10-27 13:19:13 +01:00
Tom Gundersen
ff70b269fb schutzbot: move repository snapshot definitions to the -test package
The test package should be self-contained and contain all the configuration
necessary for a known-good test run (minus secrets). This moves repo
overrides from the test orchestration into the test package.

We want all the external sources (including boot isos and repositories) to
be pinned by their content hash, and never use anything that is not strictly
defined. This moves us in the right direction, but we still have some tests
to update to use these shipped repos rather than official mirrors.

One remaining challenge is that we must make sure all our test runners have
access to the RHEL snapshots, which is not currently the case for the runners
in EC2, but a solution is in the works.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-10-23 11:33:04 +02:00
Ondřej Budai
0e7a1dd407 tests: remove stray F31 occurrences
osbuild-composer doesn't support F31 anymore, this commit rips out the last
pieces.
2020-10-21 18:09:53 +01:00
Ondřej Budai
b91a63c0ad koji: fix converting rpm stage metadata to koji components
This commit adds a missing pointer and a test to verify that the conversion
is indeed fixed.
2020-10-21 11:40:01 +02:00
Ondřej Budai
a2e84bc0ac koji: fix a typo in json tag
According to the content generator metadata documentation[1], the field should
be named components.

[1]: https://docs.pagure.org/koji/content_generator_metadata/
2020-10-21 11:40:01 +02:00
Tom Gundersen
931bd8be57 test: provision test machine from tests
Don't rely on the deployment script to install the right config or to start the
services.

This further disentangles the tests from schutzbot.
2020-10-21 09:04:13 +02:00
Tom Gundersen
8fd93c0d7c test/ca: drop left-over file
This was meant to have moved to `test/data/ca`.
2020-10-21 09:04:13 +02:00
Tom Gundersen
3c7f61c322 test: restructure dir layout
Attempt to clarify the structure of our tests. Each test case is now
encapsulated in a script in `test/cases`. Each of these scripts should
be runnable on a pristine machine and be independent of each other. It
is up to the test-orchestractor to decide if they should be run
consequtively instance, or in parallel on separate instances. Each
script can execute several tests and call whatever helper binaries
is desired. However, each case should be assumed to always run as one.
2020-10-21 09:04:13 +02:00
Tom Gundersen
d7247e2878 schutzbot/deploy: drop journald work-around
The bug this is meant to fix is not referenced atdn not explained in
comments/commit. Drop it in an effort to find out if it still applies.
2020-10-21 09:04:13 +02:00
Tom Gundersen
5fd1d3c4a2 schutzbot/deploy: re-enable weak deps
Don't differ from defaults just for the sake of speed. We still keep
the fastestmirror option enabled as that does not affect the resulting
install.
2020-10-21 09:04:13 +02:00
Tom Gundersen
1a1ecbeadb schutzbot/deploy: re-enable modular repos
We don't want to differ from standard installs unless we have to. We
prefer tests that are closer to standard installs over faster tests.
2020-10-21 09:04:13 +02:00
Tom Gundersen
25abccf66d tree-wide: drop f31 support
We no longer release into F31, and the right specfile was anyway not
being tested.

This allows us to remove a workaround that updates the VMs during
deploy, and other fedora-31 specific hacks.
2020-10-21 09:04:13 +02:00
Tom Gundersen
1d7df26775 schutzbot: move test scripts into the test package
`run_{base,image}_tests.sh` are osbuild-composer-specific, and should
live in the `-test` subpackage, rather than as part of the testing
infratructure.

This is not a functional change.
2020-10-21 09:04:13 +02:00
Lars Karlitski
fbc93f7f87 Add DEPLOYING.md
Document how to spin up virtual machine deployments using the
tools/deploy-* scripts.
2020-10-20 15:43:30 +02:00
Lars Karlitski
c2ed3fc1b3 tools: add deploy-openstack
Similar to deploy-qemu, but deploys into an OpenStack cluster. It uses
the same logic for user-data.
2020-10-20 15:43:30 +02:00
Lars Karlitski
34e61491b0 HACKING.md: improve link 2020-10-20 15:43:30 +02:00
Ondřej Budai
b800860a30 spec: remove executable bit from certificates
Trust me, it's not very useful.
2020-10-20 13:46:48 +02:00
Ondřej Budai
baea7ac7ee docs/HACKING: add a note about how to grow the image
Yesterday, I spent more hours than I would like to admit debugging tests that
was failing because the Fedora cloud base image has only 4 GB disk space.

This commit adds a note for the future me.
2020-10-20 11:07:48 +02:00
Alexander Todorov
12b8ec2f58 tests: Fail if python36 is installed. Closes #794 2020-10-19 11:21:39 +03:00
Ondřej Budai
0e511a43c4 schutzbot: remove rhel nightly pipeline
Jenkins doesn't support two pipelines in one file. We had two and it caused
an exception in Jenkins marking all builds as failed even though all stages
passed successfully.

As this pipeline isn't used for anything right now (see #976), it's safe to
delete it.

Fixes #1032
2020-10-19 09:49:50 +02:00
Ondřej Budai
df464b0edf 22
Release osbuild-composer version 22.
2020-10-16 15:51:26 +02: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
0f70edb48e osbuild-auth-tests: print output from openssl
This helps debugging certificate errors, because it prints
configuration on success and what went wrong on errors.
2020-10-16 09:37:04 +02:00
Lars Karlitski
0aef7ff5d5 test/cmd: add api.sh
Add an additional integration test, which builds a fedora-32 image via
the newly moved composer API.

This adds a new certificate for clients to authenticate, with
CN=client.osbuild.org.

Also stop allowing certificates with `CN=worker.osbuild.org` in the
`osbuild-composer.toml` used in tests and amend `osbuild-auth-tests` to
use `CN=client.osbuild.org` for accessing the koji API.

Heavily based on an earlier version of this test in `test/cmd/aws.sh` by
Sanne Raymaekers.
2020-10-16 09:37:04 +02:00
Lars Karlitski
8161f2fa04 schutzbot: add repositories to be used by tests
Base these on https://osbuild.org/rpmrepo.

Install those repository files when deploying in schutzbot and include
them in tools/deploy/test for local testing.

Also remove copying overrides from deploy.sh, because it copied the
wrong files. We probably want to add this back properly in the future.
2020-10-16 09:37:04 +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
Lars Karlitski
835b556db7 distribution: deprecate osbuild-composer-koji.socket
Instead, call it osbuild-composer-api.socket, but provide a symlink for
backwards compatibility. Change `schutzbot/provision.sh` to only enable
osbuild-composer-api.socket.

In the future, this new socket is the only API socket, which provides
both the "cloud" API and the one for koji.

This means that the koji API is always enabled.
2020-10-16 09:37:04 +02:00
Alexander Todorov
d5a22097b8 tests: Add notes for downstream testing
also includes PR template to make this more visible to
everyone!
2020-10-15 19:01:47 +01:00
Alexander Todorov
c451262cf0 tests: move 2 of the text sections under section Golang tests
b/c it makes logical sense to have this information here
2020-10-15 19:01:47 +01:00
Lars Karlitski
ce0f99c1be test: install koji-compose.py
And use it from its installed location in test/cmd/koji.sh.
2020-10-15 12:10:15 +02:00
Martin Sehnoutka
6badebef4f schutzbot/run_cloud_cleaner: pass BRANCH_NAME instead of CHANGE_ID
CHANGE_ID is unset in master branch. Use BRANCH_NAME instead.
2020-10-14 16:58:58 +02:00
Ondřej Budai
7a2f72281e schutzbot: enable F33 mockbuild
Let's start slowly. This commit enables F33 mockbuilding in Schutzbot.
Actual testing will be enabled in a follow-up.
2020-10-14 16:44:26 +02:00
Ondřej Budai
1a69a8919b schutzbot: use s3cmd from repositories
s3cmd from pip doesn't work with Python 3.9. Fortunately, s3cmd in Fedora has
a downstream patch to fix it.

See rhbz#1884607 and https://github.com/s3tools/s3cmd/pull/1137
2020-10-14 16:44:26 +02:00
Ondřej Budai
a67baf5a4d upload/koji: use the new API of kolo/xmlrpc by default
Fedora 33 ships the new API so let's do the switch now.

But... this would break older Fedoras because they only have the old API,
right?

We have the following options:

1) Ship xmlrpc compat package to Fedora 33+. This would mean that we delay the API switch till F32 EOL. This would be the most elegant solution, yet it has two issues: a) We will surely not be able to deliver the compat package before F33 Final Freeze. b) It's an extra and annoying work.

2) Downstream patch. No.

3) Use build constraints and have two versions of our code for both different
   API.

I chose solution #3. It has an issue though:

%gobuild macro already passes -tags argument to go build. Therefore the
following line fails because it's not possible to use -tags more than once:

%gobuild -tags kolo_xmlrpc_oldapi ...

Therefore I had to come up with manual tinkering with the build constraints
in the spec file. This is pretty ugly but I like that:

1) Go code is actually clean, no weird magic is happening there.
2) We can still ship our software to Fedora/RHEL as we used to
   (no downstream patches)
3) All downstreams can use the upstream spec file directly.

Note that this doesn't affect RHEL in any way as it uses vendored libraries.
2020-10-14 16:44:26 +02:00
Ondřej Budai
d32345104c upload/koji: extract processXMLRPCResponse method
Fedora 33 ships kolo/xmlrpc with a different API. This commit extracts the
affected code so we can use build flags in the future allowing us to use
both API versions.
2020-10-14 16:44:26 +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
Martin Sehnoutka
174e3f2037 ci: fix artifact name generation in cloud cleaner
The issue comes from the fact that the PR introducing it was very old
and meanwhile the variable used for image name creation has changed.
This patch makes sure both functions are the same.
2020-10-14 13:00:48 +02:00
Ondřej Budai
f52ff68798 spec: fix %check on ELN
%gotest ./... was failing on ELN because it couldn't find the vendored
dependencies.

Let me explain why this worked before:
In Fedora, we don't use vendored deps, therefore we had no issue.

In RHEL8, we use vendored deps and -mod=vendor with GO111MODULE unset.
In this case, vendored deps were indeed used.

However, ELN added GO111MODULE=off. When modules are disabled, -mod=vendor
is ignored[1]. It turns out that go with disabled modules uses vendor directory
only in case when $(pwd) is inside GOPATH. Don't ask me why.

Therefore, this fix uses cd to ensure that pwd inside GOPATH (even though
technically we're still in the same directory).

Note that in %build we already had this magic cd command, therefore it wasn't
an issue there.

[1]: Actually `GO111MODULE=off go build -mod=vendor` returns an error. However,
`GO111MODULE=off GOFLAGS=-mod=vendor go build` just ignores the go flag from
env.

Fixes #rhbz1884383
2020-10-13 18:56:16 +02:00
Ondřej Budai
84711d518e spec: add krb5-devel also to RHEL's BuildRequires
krb5-devel isn't in ELN buildroot, therefore we need to require it explicitly.
2020-10-13 18:56:16 +02:00
Lars Karlitski
d7bff4bd3b kojiapi: add simple test for the /status API
Add a simple unit test for the koji API.

This adds a Handler() method to the koji.Server struct, which made
writing the test easier. This is a direction we want to go in anyway in
the future.
2020-10-13 18:52:44 +02:00
Martin Sehnoutka
6b137d0ac5 cloud-cleaner: introduce script to wipe all CI artifacts
In case the job fails completely, resources might leak. This patch
together with the one introducing predictable names for CI artifacts
will make sure we wipe all resources after each CI run.
2020-10-13 14:41:32 +02:00