Commit graph

1615 commits

Author SHA1 Message Date
Lars Karlitski
f3b56cc305 master → main 2020-11-13 14:09:01 +01:00
Tom Gundersen
bf86e8ad79 workerapi: serialize koji errors as strings
Serializing an interface does not work, let us simply use the string
representation and treat the empty string as no error. This is
compatible with the current API in the success case, and fixes the
error case, which is currently broken.

Also extend the test matrix for the kojiapi to ensure that all the
different kinds of errors can be serialized correctly and leads to
the correct status being returned.

Fixes #1079 and #1080.
2020-11-13 09:39:55 +01:00
Ondřej Budai
21f4a6416d spec: fix the osbuild depedency
osbuild-composer doesn't actually require osbuild. osbuild-composer-worker
does. Let's remove the dependency from osbuild-composer and depend on the
right version of osbuild in the worker.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-11-12 19:51:00 +00:00
Ondřej Budai
a6df2877a3 fsjobqueue: accept jobs of any type
Soon, we want to begin tagging the jobs with the name of its submitter.
The simplest way to add a tag to a job is to put it into its type string.
However, as we don't know (and don't want to know) the submitters' names when
osbuild-composer is initialized, we need to be able to push arbitrary job
types into the jobqueue.

This commit therefore lifts the restriction that a jobqueue accepts only
a predefined set of job types. Now, jobqueue clients can push jobs of
arbitrary names.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-11-12 15:30:30 +00:00
Ondřej Budai
e007f9964e fsjobqueue: extract channelSize constant 2020-11-12 15:30:30 +00:00
Ondřej Budai
3bcce32c9b .github: add rpmlint
rpmlint errors are usually not a big deal but it's always nice when we can
catch them early. This commit introduces a new Github workflow that builds
an SRPM and runs rpmlint against it.
2020-11-12 12:57:53 +01:00
Ondřej Budai
7160e54b25 spec: fix obsolete warning
#1070 removed osbuild-composer-koji and introduced a new Obsoletes field.
However, rpmlint doesn't like unversioned obsoletes. This commit fixes that
by adding the last version of osbuild-composer that had the koji subpackage
to the Obsoletes field.

Fixes #1076
2020-11-12 12:57:53 +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
e02e5da1bf spec: add one changelog entry to make rpmlint happy
rpmlint doesn't like spec files without any changelog entries, let's
add a symbolic/phony one.
2020-11-12 12:57:53 +01:00
Lars Karlitski
ae17b5aa3c mockbuild: move installing dependencies down
These don't need to run when we're not building anything.
2020-11-12 09:41:36 +01:00
Lars Karlitski
ca3360c6d1 mockbuild: don't build repository when it already exists
This avoids doing unnecessary work and speeds up restarting tests.
2020-11-12 09:41:36 +01:00
Lars Karlitski
4bd891be9e schutzbot: don't copy dnf repo file between stages
Now that the repository URLs are predictable, don't use Jenkins' stash
feature to pass the repo file between stages.

Instead, simply create the repo file where it is needed, in deploy.sh.
2020-11-12 09:41:36 +01:00
Ondřej Budai
692a8076bb 24
Release osbuild-composer version 24
2020-11-11 23:10:04 +01:00
Tom Gundersen
f9af1e3e13 kojiapi/logs: adjust for multi-build composes
Return the full array of image build logs, as well as logs for the
init and import tasks.
2020-11-11 18:16:42 +01:00
Tom Gundersen
a99127aed9 kojiapi: add basic test
This test schedules a compose, pops the jobs off the queue, marks each
as done and verifies that the compose is correctly marked as successful.
2020-11-11 18:16:42 +01:00
Tom Gundersen
4a484c8192 worker/server: extend the route tests a bit
Test the update and upload routes too, for completeness.
2020-11-11 18:16:42 +01:00
Tom Gundersen
5dac422b9c cmd/composer: drop koji configuration
Now that all interaciton with the koji API happens in the workers
we can drop koji configuration from composer itself. This means
that composer no longer needs to be provisioned with kerberos
credentials, and does not need to know about which koji servers
the workers support.
2020-11-11 18:16:42 +01:00
Tom Gundersen
654daf96c1 kojiapi: return BuildID from status route
This is no longer returned when creating a compose, as it is obtained
asynchronously.

The TaskID is still returned, and is always set to 0. This is not right,
and should either be fixed or dropped. The caller should know the TaskID
(if they have one), so this is redundant and currently unused.
2020-11-11 18:16:42 +01:00
Tom Gundersen
c777a18df0 jobqueue: expose dependencies when querying status
The status of a job may depend on the status of its dependenices,
as we do not repeat for instance the failed state in each dependent
job.

Return also the list of dependencies so these can be queried too.
2020-11-11 18:16:42 +01:00
Tom Gundersen
9adae8a3a7 kojiapi: support multi-build composes
This removes the restriction of only having a single build per compose
and uses the new job types to schedule the broken-appart build.

A small change in behavior is introduced: the koji build ID is not
known when the call to `compose` returns, so it is always set to
`0`. In the future we should remove this from the API, and instead
rely on the status call to return this information, when it is
known.

The status route will be updated in follow-up commits to reflect the
changes introduced here.
2020-11-11 18:16:42 +01:00
Tom Gundersen
98fd290a08 worker: make Enqueue() specific for each job type
Most of the worker API is now untyped, but keep Enqueu() typed to
ensure the job objects match the names in the queue. This means we
must add a version of Enqueue() for each job type we support.
2020-11-11 18:16:42 +01:00
Tom Gundersen
79f87ea347 worker/RequestJob: treat 'osbuild-koji' jobs like 'osbuild' ones
We must special-case the treatment of architecture, to select the
correct remote worker for any job that requires a specific
architecture. For now this means any jobs that run osbuild.
2020-11-11 18:16:42 +01:00
Tom Gundersen
0e382e9cf4 worker: implement koji job types
The three new job types osbuild-koji, koji-init, and koji-finalize
allows the different tasks to be split appart and in particular for
there to be several builds on different architectures as part of a
given compose.
2020-11-11 18:16:42 +01:00
Tom Gundersen
a2895376ae worker: introduce dynamicArgs
In addition to the arguments passed when scheduling a job, a job now
also takes the results of its dependencies as additional arguments. We
call these dynamic arguments for the lack of a better term.

The immediate use-case for this is to allow koji jobs to be split up
as follows:
 - koji-init: Creates a koji build, and returns us a token.
 - osbuild-koji: one job per architecture, depending on koji-init
   having succeeded. Builds the image, and uploads it to koji,
   returning metadata about the image produced.
 - koji-finalize: uses the token from koji-init and the metadata
   from osbuild-koji to import the build into koji if it succeeded
   or mark it as failed if it failed.
2020-11-11 18:16:42 +01:00
Tom Gundersen
11d0da0b5c jobqueue/JobStatus: return result as json.RawMessage
Similarly to the recent changes to Dequeue(), let the caller unmarshal the
return JSON. This allows us to pass the result on without being able
to unmarshal it.

In follow-up patches, we will pass results of jobs to dependent jobs,
but the worker API does not know about the different job types, nor how
to unmarshal them.
2020-11-11 18:16:42 +01:00
Tom Gundersen
e277501ca3 jobqueue: return dependencies on dequeue
Once a job has been enqueued, there is no way to query its dependencies.

This makes dequeue more symmetric to enqueue by returning the
dependencies that were passed to enqueue, allowing the caller to
query the dependencies and their results.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-11-11 18:16:42 +01:00
Tom Gundersen
e72b14bdd1 jobqueue: do not sort dependencies
While dependencies are purely internal, sorting and pruning them is a
reasonable optimization. However, we wish to expose them in follow-up
commits and then we want them to remain unchanged from the input.

Nothing in the internal logic seems to rely on the fact the dependencies
were sorted.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-11-11 18:16:42 +01:00
Tom Gundersen
f355bdd426 testjobqueue: initialize dependants map
Adding to a nil map leads to panic. We must ensure that all maps are
initialized before use.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-11-11 18:16:42 +01:00
Tom Gundersen
23dc0a2c28 .gitignore: ignore vscode state 2020-11-11 18:16:42 +01:00
Lars Karlitski
888e7ea910 mockbuild: don't use short commit ids
The length of these is not predictable. It depends on the shortest
unique prefix in the repository and git configuration.

Just use the full one, which also makes it easier to copy the id from
`git log` or GitHub.
2020-11-11 15:35:56 +01:00
Lars Karlitski
420ba53797 mockbuild: change repository path
Change the repository path on S3 to a more predictable one. We really
only need the name of the project (static osbuild-composer for this
repository), the name of the distro (use the same as osbuild-composer's
API for consistency) and the commit SHA.

In particular, drop the PR number / branch name. Also don't remove the
dots from version numbers. All places we're using them in (paths and
URLs) support dots.

For example, osbuild composer commit xxxxxxx for fedora-33 on x86_64
will result in this URL:

    osbuild-composer/fedora-33/x86_64/xxxxxxx
2020-11-11 15:35:56 +01:00
Lars Karlitski
acae39c905 mockbuild: move path logic into separate variable 2020-11-11 15:35:56 +01:00
Lars Karlitski
d57238869a mockbuild: remove unused variable 2020-11-11 15:35:56 +01:00
Lars Karlitski
0f3ea935ac mockbuild: remove unused logs
These logs are not preserved, just remove them.
2020-11-11 15:35:56 +01:00
Lars Karlitski
3d1d42b341 mockbuild: remove the "latest" repo
This is not used anywhere and something we want to discourage: these
repos are meant for testing, and one ought to know what one tests
against.
2020-11-11 15:35:56 +01:00
Lars Karlitski
c7b712742d mockbuild: rename POST_MERGE_SHA
Jenkins has been configured to use the latest commit on a pull request
(instead of merging to master) for a long time now. Rename the variable
to reflect that.
2020-11-11 15:35:56 +01:00
Ondřej Budai
a07783ce43 schutzbot: enable F33 testing
osbuild-composer now has support, let's fire up more VMs! Currently, F33 beta
is used in both AWS and PSI.
2020-11-11 09:52:28 +01:00
Ondřej Budai
8bbe2b9c0e test/image: regenerate the test cases
This commit does several things:

1) Changes the Fedora 33 repos in the test case generator from development
   to release ones.

2) Fixes format-request-map.json so we can generate fedora-iot-commit
   "images".

3) Regenerates all the cases.
2020-11-11 09:52:28 +01:00
Ondřej Budai
bb3efe0435 test/ostree: fail on unsupported distros
If the ostree test was run on an unsupported distro, it failed but with a
very weird error message. This commit makes the test fail fast and with a
nice message.
2020-11-11 09:52:28 +01:00
Ondřej Budai
4b19095b20 test/ostree: add support for Fedora 33
Let's use the same repository as for Fedora 32, it proved to be very stable.
2020-11-11 09:52:28 +01:00
Ondřej Budai
eacb8ff14c test/qemu: not use tmpfs for the downloaded image
The downloaded image may not fit inside tmpfs, especially when testing
on a constrained VM. This commit makes the test script use a different
temporary directory while handling the possibly big image.
2020-11-11 09:52:28 +01:00
Lars Karlitski
41a797547a distribution: remove osbuild-composer-koji
Remove both the package osbuild-composer-koji, and the only file it
shipped: osbuild-composer-koji.socket.

It's been deprecated since 835b556, but the backwards-compatible
solution in that commit never worked, because osbuild-composer only
checks for "osbuild-composer-api.socket" when starting up.

Since this has been meant to be deprecated for a while, just remove it
outright.

Add an "Obsoletes:" for the package, so that it gets uninstalled on
existing systems.
2020-11-10 16:26:03 +01:00
Lars Karlitski
e47b44329e kojiapi: expose logs on the API
Add an API route that returns logs for a specific compose.

For now, this contains the result of the job, in JSON. The idea is to
put more and more of this information into structured APIs. This is a
first step to make logs available at all.

Amend koji-compose.py to check that the route exist and contains as many
"image_logs" as images that were requested (currently always 1).

Based on a patch by Chloe Kaubisch <chloe.kaubisch@gmail.com>.
2020-11-10 16:23:49 +01:00
Chloe Kaubisch
263f8d6360 koji: add tests
Add some simple tests to ensure invalid routes
and bad requests are handled.
2020-11-10 16:23:49 +01:00
Ondřej Budai
e62bbf096d test/integration: delete composes after we're done
The integration tests are leaving the composes (which include images) in
osbuild-composer. This can lead to exhausting the disk space we have available
on our tiny testing machines. This commit adds a removal of the composes
after each integration test is finished. This issue is not present in koji.sh
and api.sh as they use different osbuild-composer APIs that doesn't use the
artifact feature.

This issue occurred when I worked on enabling the Fedora 33 tests, see:

https://osbuildci.cloud.paas.psi.redhat.com/blue/organizations/jenkins/osbuild%2Fosbuild-composer/detail/PR-1014/23/pipeline
2020-11-10 14:22:51 +01:00
Martin Sehnoutka
1b4db3377b base_tests.sh: make the test self-contained
We claim to have self-contained test cases, but the base_tests.sh script
still requires the WORKSPACE environment variable to be set outside of
the script, which is what Jenkins does.

This patch replaces WORKSPACE with a temporary directory and modifies
Jenkinsfile to use it when collecting logs.
2020-11-10 10:44:13 +00:00
Ondřej Budai
6962c4d8e6 tools/koji-compose: use the central test repositories
We have several repository definitions across the tests which is quite messy.
This commit switches the Koji test to use the "central" repository configs defined in test/data/repositories/
2020-11-10 09:38:25 +01:00
Ondřej Budai
085e3d987d test/repos: enable gpg check
We can use GPG when using RPMRepo. Let's turn it on then.
2020-11-10 09:38:25 +01:00
Ondřej Budai
c807820774 test/repos: bump to the latest RPMRepo snapshot
This also fixes Fedora 33 repos that were pointing to a non-existing snapshot.
2020-11-10 09:38:25 +01:00
Lars Karlitski
59e73a686a worker: generalize job types in the server
The worker server was heavily tied to OSBuildJob(Result). Untie it so
that it can deal with different job types in the future.

This necessitates a change in the jobqueue: Dequeue() now returns the
job type, as well as job arguments as json.RawMessage. This is so that
the server can wait on multiple job types with different argument
types.

The weldr, composer, and koji APIs continue to use only "osbuild" jobs.
2020-11-09 14:17:19 +01:00