Commit graph

1387 commits

Author SHA1 Message Date
Lars Karlitski
ad11ceecf4 worker: use openapi spec and generated code
Write an openapi spec for the worker API and use `deepmap/oapi-codegen`
to generate scaffolding for the server-side using the `labstack/echo`
server.

Incidentally, echo by default returns the errors in the same format that
worker API always has:

    { "message": "..." }

The API itself is unchanged to make this change easier to understand. It
will be changed to better suit our needs in future commits.
2020-09-06 18:42:23 +01:00
Martin Sehnoutka
396c2cedce weldr: make URL mandatory part of a new source
Sources without URL are useless. Make it mandatory.

Fixes: https://github.com/osbuild/osbuild-composer/issues/951
2020-09-04 20:20:24 +01:00
Alexander Todorov
951e5e66b6 Shutzbot: add pipeline for RHEL nightly builds. Refs #912
Notes:
ATM will not run any actual tests b/c we want to make sure the
pipeline configuration is correct.

run_tests() will call the deploy.sh script and then do nothing
b/c of the "dummy-" prefix which doesn't match any actual tests!
2020-09-04 09:56:25 -05:00
Alexander Todorov
c0d9bb13fc Shutzbot: show info for osbuild-composer sources
so we can actually see what sources are being used
2020-09-04 09:56:25 -05:00
Tom Gundersen
4afbaec8e0 schutzbot/ci_details: print the username
We are storing some data in the user's home directory, so let's print
the username so we know what that is.

In particular, this would tell us which user has been authorized to log
in via ssh.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-09-03 22:54:02 +01:00
Xiaofeng Wang
bb94c76818 test: Add rhel-8-beta.json to override default one
OSTree testing needs redhat-release-8.3-0.4.el8.x86_64 to
fix BZ#1848453
2020-09-03 22:51:39 +01:00
Xiaofeng Wang
c1b0d348d6 test: Add ostree image installation and upgrade test and add a
new parallel stage for ostree test
2020-09-03 22:51:39 +01:00
Martin Sehnoutka
125fce92db internal/boot: Make some function public
More specifically only those that are needed in
/cmd/osbuild-image/tests.

This patch can be merged with the previous one if we want to make sure
every commit can be built, but I'm going to keep it like this for now so
that we can easily see the changes.
2020-09-03 15:12:59 +01:00
Martin Sehnoutka
ec6ce8387d internal/boot: introduce package for booting images
The package takes the existing code from /cmd/osbuild-image-tests and
makes it available for other executables.
2020-09-03 15:12:59 +01:00
Tom Gundersen
7e0711b805 test/generation/rhel8: move to today's nightly
We need this for greenboot-status, in the RHEL for Edge images. This
updates the generator for x86_64 and aarch64 and updates the test cases
for rhel-edge-commit.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-09-03 11:02:44 +01:00
Peter Robinson
d609371a5a distro/rhel8: Updates for RHEL for Edge
We now have greenboot available so update the packages and services
also add exclude sections as subscription-manager is for some reason
getting pulled in which brings dnf and other deps we explicitly don't
want.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
[teg: minor fixes and squash several fixup commits]
2020-09-03 11:02:44 +01:00
Alexander Todorov
25c3deda83 tests: Use -pool when importing vmdk & booting a VM. Fixes #953
explicitly specify the cluster and the default resource pool
when importing b/c the import process creates a temporary VM,
which requires a ResourcePool to provision. Same thing when
provisioning a VM.
2020-09-01 11:55:45 +01:00
Major Hayden
d5ddcbc921 ⛈ Use AWS more often for testing
Now that we've reduced how much of our PSI quota we are using so the
OpenStack boot tests will work, we need to use AWS for jobs more often.
This should allow test runs to complete a little sooner by freeing up
PSI resources for the jobs that are only able to run there.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-28 13:31:52 +02:00
Ondřej Budai
05fd221bd4 upload/koji: add support for GSSAPI/Kerberos auth
Prior this commit we only had support for username/password authentication
in the koji integration. This wasn't particularly useful because this
auth type isn't used in any production instance.

This commit adds the support for GSSAPI/Kerberos authentication.
The implementation uses kerby library which is very lightweight wrapper
around C gssapi library.

Also, the koji unit test and the run-koji-container script were modified
so the GSSAPI auth is fully tested.
2020-08-27 17:29:57 +01:00
Ondřej Budai
ecc7340570 upload/koji: allow passing a custom transport to koji.Login
In the near future, we will need to communicate with Koji using HTTPS.
This will surely bring the need for ignoring bad certificates/providing
our own self-signed ones. Thus, this commit prepares the Koji integration
by adding a way to accept a custom http transport which can be used to
customize the TLS settings.
2020-08-27 17:29:57 +01:00
Ondřej Budai
bc02da786d upload/koji: ensure that Koji type instance is always logged-in
Previously, Koji instance could be both logged-in and not logged-in.
This change disallows it: Now, the Koji instance is created by calling
koji.Login, so it must be always logged-in. This change should lead to more
robust code.
2020-08-27 17:29:57 +01:00
Ondřej Budai
f77f570202 upload/koji: extract RoundTripper from Koji type
The RoundTripper bits are not dependant on the Koji type, this commit extracts
them, so the responsibilities are clearly separated.
2020-08-27 17:29:57 +01:00
Ondřej Budai
1a13f6936c upload/koji: reuse the transport used by xmlrpc when uploading a chunk
This way, the handling of session and callnum is done at one place instead of
two places.
2020-08-27 17:29:57 +01:00
Ondřej Budai
a6b33e394b ci/koji: use the same container setup as for local testing
Services in Github Actions are cool but have some drawbacks:
1) We want to be able to use the container setup locally, therefore there's
   run-koji-container script which does exactly the same setup as it's defined
   in Github Actions. We don't want duplicities though.

2) In the near future, we will need more complicated setup - generating
   certificates before a container is started. This is not possible with
   the current Github Actions capabilities.

This commit removes the container setup from Github Actions and just reuses
the run-koji-container script in the GH Actions environment. This way we
have only one setup which is also more flexible.
2020-08-27 17:29:57 +01:00
Ondřej Budai
c9d7892ec0 upload/koji: reorganize run-koji-container script
run-koji-container has now two actions: start and stop:
- ./run-koji-container.sh start
- ./run-koji-container.sh stop

The start action starts all containers. When it exits, all containers are
started and running in the background. To stop and removethem, use the stop
action.

This change is needed so we're able to easily use this script also in the CI
environment.
2020-08-27 17:29:57 +01:00
Ondřej Budai
355f4da115 upload/koji: use v1 koji container
rc1 doesn't seem to exist anymore.
2020-08-27 17:29:57 +01:00
Ondřej Budai
a32ff633ba upload/koji: make koji runner work with docker
The setup should be container engine agnostic. This changes allows this script
to be run on systems which prefer docker over podman (e.g. Github Actions).
2020-08-27 17:29:57 +01:00
Alexander Todorov
963e46f50d Always use .vmdk suffix after streamOptimized conversion
b/c vCenter gets confused by the .stream suffix
2020-08-26 14:45:31 +02:00
Alexander Todorov
e41dc46748 tests: remove vmwaretest.ConvertToStreamOptimizedVmdk()
in favor of OpenAsStreamOptimizedVmdk() which is also used by
the worker.
2020-08-26 14:45:31 +02:00
Alexander Todorov
3292b5eb68 Do not unlink file while it is still open
- inside RunJob() there is a deferred function which will remove
  the entire temporary directory in which images are created, including
  the streamOptimized file

- inside testBootUsingVMware(), which wants to use this function,
  there is already a deferred function which removes the converted
  image
2020-08-26 14:45:31 +02:00
Alexander Todorov
e7aa9c10c2 Move openAsStreamOptimizedVmdk() into importable package
so it can be used later within tests
2020-08-26 14:45:31 +02:00
Tom Gundersen
5803abfeee osbuild/result: parse the metadata from the rpm stage
osbuild support returning metadata about each of the stages/assembler
runs. Parse the results from the rpm stage, which contains the header
fields from the installed RPMs, in particular the MD5 sum of the RPMs in
question. This information is needed to be passed as metadata to koji
when uploading images.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-26 12:12:37 +02:00
Tom Gundersen
ac5f69e757 osbuild: move result serialization from common
In the same way `osbuild.Manifest` is the input to the osbuild API,
`osbuild.Result` is the output. Move it to the `osbuild` package where
it belongs.

This is not a functional change.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-26 12:12:37 +02:00
Ondřej Budai
360bf2aa04 rerun prepare-source after a bad merge
#932 bumped the minimal Go version to 1.13. Prepare-source script had to be
rerun because of some changes in vendoring.

Unfortunately, while this PR was waiting to merged, #797 also touching
vendoring was merged. This "commit race condition" led to a failing check
on master branch because of bad vendoring.

This commit reruns the prepare-source script to fix the vendoring once again.
2020-08-25 11:16:12 +02:00
Ondřej Budai
b525cee26e ci: bump golangci-lint version 2020-08-25 10:42:54 +02:00
Ondřej Budai
d3f98a4b40 prepare sources for Go 1.13
Vendoring differs a bit betweem Go 1.12 and 1.13. This commit is a rerun of
tools/prepare-source.sh for Go 1.13
2020-08-25 10:42:21 +02:00
Ondřej Budai
5e6e77b565 bump minimal Go version to 1.13
All our downstream platforms now support Go 1.13:

RHEL 8.2: golang-1.13.4
Fedora 31: golang-1.13.14

There's no reason anymore to stay on 1.12, therefore this commit bumps
the minimal required Go version to 1.13
2020-08-25 10:42:21 +02:00
Ondřej Budai
8d1c187f3c upload/azure: delete the unused test
This test is not run anywhere because it was surpassed by image tests with
azure boot type which perform more than just uploading a randomly generated
file to Azure. Let's delete dead code.
2020-08-25 10:41:10 +02:00
Ondřej Budai
c711b9149e remove travis mentions in codebase
Travis is no longer used, let's ditch these.
2020-08-25 10:41:10 +02: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
Major Hayden
70c32ef7c5 awsupload: Add comments for Register()
Please the golang linter by adding a small comment for the Register
function.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
02306c978e awsupload: Better emoji for snapshot wait
The clock emoji isn't as well supported as the 🚚.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
6659ab58ad awsupload: Apply tags to imported snapshot
Applying a `Name` tag to the snapshot makes the name of the image appear
in the snapshot listing in EC2's console. It also makes it easier to
remove a snapshot after deregistering the AMI.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
fc7f6349eb awsupload: Add description to snapshots
Make it easier to tell which snapshot goes with each AMI by labeling
them with a description.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
1dbc271506 Add Install section to remote worker unit file
Although the obuild-remote-worker@.service unit can be started, it can't
be enabled at boot time since the `Install` section is missing in the
unit file.

Add a small `[Install]` section with the same `WantedBy` as
osbuild-composr.service.

Fixes #924.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:56:45 -05:00
Major Hayden
01c8daabf7 ⏱ Extend golangci-lint timeout to 5m0s
For reasons unknown, golangci-lint's default 1m0s timeout is *slightly*
too short for CI runs occasionally. Extend it to 5 minutes to ensure the
job always has enough time to run.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:21:38 -05:00
Tom Gundersen
b7fb52dc7d 20
Release osbuild-composer version 20.
2020-08-23 16:44:07 +02:00
Lars Karlitski
b5bd00d739 dnf-json: don't initialize dnf plugins
acf91a4 enabled fastestmirror but also calls `base.init_plugins()` to
initialize dnf plugins. This is not necessary and not what we want
conceptually.

Not necessary, because `fastestmirror` is a dnf built-in (it was a
plugin during yum-times [1]). The same patch sets the `fastestmirror`
option as well. Thus, this patch does not revert functionality.

Not what we want, because we're using dnf more as a library, explicitly
passing all options. Plugins depend on additional host configuration,
which we'd like to avoid pulling in. In particular, the
subscription-manager plugin tries reading certificates in `/etc/pki`,
which are not readable by the `osbuild-composer` user. This leads to
these errors in the journal:

    [ERROR] dnf-json:54297:MainThread @logutil.py:194 -
      [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' -
      Further logging output will be written to stderr
    [ERROR] dnf-json:54297:MainThread @identity.py:156 -
      Reload of consumer identity cert /etc/pki/consumer/cert.pem
      raised an exception with msg:
      [Errno 13] Permission denied: '/etc/pki/consumer/key.pem'

These errors are not fatal, but could confuse people when inspecting
logs to find unrelated problems. This patch makes them disappear.

[1] https://fedoraproject.org/wiki/Yum_to_DNF_Cheatsheet
2020-08-23 16:08:25 +02:00
Tom Gundersen
496f921eff schutzbot: don't boot-test vmdk images in libvirt
The vmdk images are meant to be imported into VMWare vCenter, not to be
booted directly.

Our image-info tests verifies that this work, they should be converted
into integration tests similar to the aws.sh script in the future.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-23 14:45:27 +02:00
Tom Gundersen
b0cd29f78b worker: support returning returning images as StreamOptimized
vCenter requires images to be uploaded as vmdk StreamOptimized. Lorax
always produced images on this format, so we should make sure to do the
same for our VMWare images.

Allow LocalTarget to request the images produced by osbuild be converted
to be streamOptimized before saving in composer, and hook the weldr API
up to enable this option for vmdk images.

Ideally this should simply be an option in osbuild, but that would
require some more work, which we will not manage in time for RHEL8.3.
Therefore do this minimal fix.

Note that that means the images produced by our manifests (including in
our image-test test cases) are not on the format that the weldr API
returns, so the tests we run on them would also, for now, need to
convert before uploading to vCenter.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-23 14:45:27 +02:00
Alexander Todorov
bdea79613c Return a string from runWithStdout() instead of []byte
and trim invisble newlines b/c they were messing up with ssh
2020-08-20 21:59:54 +02:00
Tom Gundersen
f3cba8ecfc vmwaretest: avoid using the cli
This is not shipped in RHEL, so use the library directly to query the IP
address. This is a massive hack, but let us revisit this after the next
release.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-20 21:59:54 +02:00
Alexander Todorov
5a395cda38 tests: manually convert to streamOptimized vmdk 2020-08-20 21:59:54 +02:00
Alexander Todorov
dcee05d8b6 Read vCenter credentials for Schutzbot & document them 2020-08-20 21:59:54 +02:00
Alexander Todorov
9cce43d384 tests: upload & test in vCenter. Closes #338 2020-08-20 21:59:54 +02:00