Commit graph

4506 commits

Author SHA1 Message Date
Gianluca Zuccarelli
9f4e765657 metrics: build jobs arch label
Add the architecture label to build jobs
which will enable filtering and monitoring
build jobs by architecture. Build job results
contain the `arch` field in the results struct,
this is then used to pass to the metrics, where
there is a value, otherwise it is set to an
empty string.
2022-07-27 13:37:14 +02:00
Gianluca Zuccarelli
8b4aff3857 worker/server: remove duplicate metrics
Remove a duplicate call to the `DequeueJobMetrics`
function in the worker server. This duplicate call
resulted in negative numbers for pending jobs in
the prometheus metrics.
2022-07-27 13:37:14 +02:00
schutzbot
ac522a58ee Post release version bump
[skip ci]
2022-07-27 08:31:06 +00:00
Achilleas Koutsou
2b6faea320 Remove image info from all test manifests
We never generated it for the newest distro versions and we don't test
it on any of the old ones.

It's better this way.
2022-07-27 10:01:16 +02:00
Jakub Rusz
74bf3aa3df test/diff-manifests: checkout repo to $head on exit
During the diff-manifests.sh test the source repository checkout is
changed to generate manifests from current main branch for comparion. We
want to checkout back to $head after the script is done or in case of
any unexpected exit.
2022-07-26 17:08:32 +02:00
Jakub Rusz
cf562dbb57 CI: drop /tmp/artifacts upload to Gitlab
Contents of this folder are uploaded to S3 with shutzbot/upload_artifacts.sh
Also fixing epel installation in the mentioned script.
2022-07-26 17:08:32 +02:00
Xiaofeng Wang
c71ae8f455 test: Update tests to support embeded container image feature
Container image can only be embeded on commit Use fedora image
instead of ubi8 and only run embeded image checking on  RHEL
8.7, 9.1, CS8 and CS9.
2022-07-26 17:07:31 +02:00
Christian Kellner
89c2bb0d3e spec: require osbuild 62
We need the `org.osbuild.containers.storage.conf` stage and its
fixes that only landed in osbuild 62.
2022-07-26 17:07:31 +02:00
Christian Kellner
14931f1ebe ci: pin osbuild to include pytoml fix
osbuild commit 9956f54 includes a fix for the `containers.storage.conf`
to work with RHEL 8 by trying to include `pytoml` if including `toml`
fails. We need that for the RHEL 8 based container embedding on OSTree
tests.
2022-07-26 17:07:31 +02:00
Christian Kellner
34c94ab92b container: rework GetDefaultAuthFile and don't cache its result
Instead of using a cached result `GetDefaultAuthFile`, always
do call the function when a new `Client` is created, since at
least `/run/containers` can get created as a side-effect by
one of the container. Now that we check eagerly and often the
path check function was reworked to only return paths that do
exist and are accessible.

Also check if `REGISTRY_AUTH_FILE` is set and if so, and it
is accessible use that.

To check accessability, use `unix.Access` instead of `os.Stat`,
since On Fedora/RHEL 9 `os.Stat` is implemented via `statx` and
will indeed return `EACCES` for inaccessible paths. But on RHEL
8 `lstat` is used and that will return `ENOENT` but then later
when trying to open the file we will get `EPERM`.
2022-07-26 17:07:31 +02:00
Christian Kellner
62406070b6 distro/rhel9: support embedding containers in ostree commits
Add support for embedding containers in OSTree commits by
storing them in `/usr/share/containers/storage`. The storage
engine is configured accordingly so that this extra location
is automatically taken into account by e.g. `podman`.
2022-07-26 17:07:31 +02:00
Christian Kellner
d7f1ed8ba7 distro/rhel8: support embedding containers in ostree commits
Add support for embedding containers in OSTree commits by
storing them in `/usr/share/containers/storage`. The storage
engine is configured accordingly so that this extra location
is automatically taken into account by e.g. `podman`.
2022-07-26 17:07:31 +02:00
Christian Kellner
e290502a1d container: add a check to ensure auth file path is always set
We never want an empty path but always force a specific auth
file location, even if the location does not actually exist,
due to the peculiarities mentioned in the comment of the
`container.GetDefaultAuthFile` function.
2022-07-26 17:07:31 +02:00
Christian Kellner
e38e7c717d container: add a auth file path getter for Client
This is so we can check and verify what is set.
2022-07-26 17:07:31 +02:00
Christian Kellner
8a06b9ddf3 osbuild: add bindings for org.osbuild.containers.storage.conf stage
Add support for the `containers.storage.conf` stage with helper
constructors that should make it easy to use.
Add a small test for it.
2022-07-26 17:07:31 +02:00
Achilleas Koutsou
f3c166c3fd CI: fix artifact collection for diff-manifests 2022-07-25 21:23:02 +02:00
Achilleas Koutsou
46b127c898 diff-manifests: never use main explicitly
The base branch name is read from the pull request metadata.  Let's use
it everywhere and never assume `main`.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
b5c47dbe8a test/diff-manifests: warn if generation fails on merge-base
If the manifest generation fails on the merge-base with main (the target
branch of the PR), add a note to the review comment.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
404d1130bd test/diff-manifests: add link to job artifacts in review comment 2022-07-25 21:23:02 +02:00
Achilleas Koutsou
4c7fc8fd4d test/diff-manifests: fail test if manifest generation fails on PR
Fail the test if manifest generation fails on the PR HEAD, but don't
fail if the generation on main fails.
This can happen if something breaks in main (the generator, a
repository, an image definition, etc) and the PR is meant to fix it.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
7f563a6db1 test/diff-manifests: minor change in error handling 2022-07-25 21:23:02 +02:00
Achilleas Koutsou
68227ed18b test/diff-manifests: print gen-manifests output
Don't silence the output.  It should be much less noisy now that the
progress isn't printed on a timer but only when something changes.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
2afc8fd1dd gen-manifests: minor output changes
Don't print "Worker started" message.
Print "done" after submitting all jobs to the queue.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
b20605d9f1 gen-manifests: append message to failed jobs on finish
When the 'Finished' message is printed, append [failed] to the message
if the job encountered an error.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
20b6d3866a gen-manifests: support arch, distro, image type selection
Multiple values can be specified by separating with commas.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
a018c69f90 gen-manifests: simplify flag definitions
Remove the reliance on flag variable pointers and read the argument
values directly into the target variables.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
d61b553045 gen-manifests: don't print progress when nothing changed
Update the progress line only when another line was received, which in
this case means a job has started or finished.
No need to keep reprinting the progress.
2022-07-25 21:23:02 +02:00
Achilleas Koutsou
6e4a55cf9e gen-manifests: print errors on stderr 2022-07-25 21:23:02 +02:00
Christian Kellner
78a96a5414 worker: support for configuring the containers auth file
Add a new configuration section for containers and an option
to configure the authfile in it.
2022-07-25 21:21:44 +02:00
Christian Kellner
ec4598f81f weldr: use worker job to resolve container
The main reason is that there should be only one place where the
container resolution is happening, which is the worker, so that
we only have one central place to configure aspects of it, like
container credentials.
2022-07-25 21:21:44 +02:00
Christian Kellner
50e630a76f worker: add new container resolve job type
This is a new job that can be used to resolve containers. It uses
the existing `container.Resolver` class to do the actual work.
2022-07-25 21:21:44 +02:00
Christian Kellner
c2f3f76d96 container: ability to set AuthFilePath for Resolver
Add a new field `AuthFilePath` and if it is not the empty string,
it will be forwaded that information to `Client`.
2022-07-25 21:21:44 +02:00
Christian Kellner
2c0594629f osbuild: add extraEnv argument to RunOSBuild
This adds the ability to supply extra environment variables to
the osbuild process.
2022-07-25 21:21:44 +02:00
Tomas Hozza
31072c1189 Cloud API: extend a code comment with more information 2022-07-24 08:40:58 +02:00
Tomas Hozza
0614913010 worker/koji-finalize: fix error message 2022-07-24 08:40:58 +02:00
Tom Gundersen
0f5846326c image: introduce image kinds for Fedora
Implement all of Fedora in terms of this new abstraction. What used to be the
manifest functions (and before that the pipeline functions) are now the image
functions, whose purpose is to instantiate the right image kind structs from the
image type definitions we currently have in the distro definition.
2022-07-22 16:04:07 +02:00
Tom Gundersen
5a15608c89 image: add image kind abstraction
This abstracts away the manifest instantiation. The idea is that we define one
of these image kind types to represent a group of image types that are
sufficiently similar. Each image kind will have a struct with with all the
properties that can be customised for the image and a function to turn that into
an actual manifest. This is similar to how distro/fedora/manifest.go and
cmd/osbuild-playground works today, and aspires to move these closer together
and to eventually make the distro definitions simpler.

For now cmd/osbuild-playground is moved over to using the new abstraction.
2022-07-22 16:04:07 +02:00
Tom Gundersen
ce40e1d810 artifact: this represents the artifacts a manifest exports
For now this encapsulates osbuild export and filename in that
exported tree. In the future we could add MIME type.

For now this is a concrete type, but should probably be an
interface, so the consumer of artefacts know they are the right
type. Enforcing we only push AMIs to EC2, etc.

Similarly to how checkpoints work, each pipeline can be marked for
export, and the manifest can return all the names of the exported
pipelines, to be passed to osbuild. Additionally, the Export
function returns an artefact object, which can be used to know how
to access the exports once osbuild is done. For now, this is unused.
2022-07-22 16:04:07 +02:00
Tom Gundersen
9b77e67576 manifest: add Checkpoint()/GetCheckpoints()
If Checkpoint() is called on a pipeline, it is marked for
checkpointing. Calling GetCheckpoints() returns the names of all
its pipelines that are marked for checkpointing as a slice of
strings. This can be passed to osbuild by the caller, in which case
the trees produced by each of these pipelines will be checkpointed
to speed up future builds.

Before this can be used in production we need a mechanism for
automatically cleaning up the cache.
2022-07-22 16:04:07 +02:00
Tom Gundersen
a8f48822e8 platform: include image format
The format of the image is (arguable) a property of the hardware
platform, keep that in the platform abstraction.
2022-07-22 16:04:07 +02:00
Tom Gundersen
5c5c63afd1 manifest/os: split out OSCustomizations
This is meant to encapsulate the tweaks we do to the OS tree
orthogonally to anything else. For now it still contains some
configuration that only sometimes applies, but this should
continue being reworked until all the fields in this struct
always apply to any artefact that is using it.

At the same time, stop instantiating with default values, as the
empty values should work. This is not a functional change as the
caller always sets these now.
2022-07-22 16:04:07 +02:00
Tom Gundersen
0bebc107d2 manifest/os: don't depsolve empty workload
Workloads could contain no packages, in which case, skip depsolving.
2022-07-22 16:04:07 +02:00
Tom Gundersen
a92b672bc7 manifest/anaconda: pull in biosdevname if enabled
Rather than listing this in the package sets, pull it in implicitly
by the pipline that requires it.
2022-07-22 16:04:07 +02:00
Tomas Hozza
5f3f477d47 CI: test cloud upload for Koji composes
Test the functionality only on RHEL-8.6, since this is the version that
Brew workers use. Test only RHUI images, because these will be the ones
to be used with this functionality.
2022-07-22 11:39:49 +01:00
Tomas Hozza
2ff34767cc worker/osbuild: workaround cloud upload for compressed images
The AWS and Azure RHUI images are produced as compressed archives, which
can be uploaded to Koji, but they can't be uploaded to the cloud
provider in this format. To support cloud upload for these types of
images, we need to decompress them before the upload.

Add a workaround for AWS and AzureImage targets to check if the image
has `.xz` suffix and if yes, decompress it before uploading to cloud.

This workaround is needed until image definitions will support and use
multiple exports per image to allow using different export per upload
target.
2022-07-22 11:39:49 +01:00
Tomas Hozza
abc3d31222 test/repos: add AWS and Azure RHUI repos for 86/87/90/91
This is needed in order to be able to test Koji composes with cloud
upload and RHUI images.
2022-07-22 11:39:49 +01:00
Tomas Hozza
85f9f07a1f Cloud API: support cloud upload for Koji composes
Add support to handle upload options in image requests for Koji
composes. The image is always uploaded to Koji, but now it can be
uploaded to the cloud environment in addition to Koji as part of the
build.

The image name used for Koji image can't be used as is for uploading to
the cloud, because each cloud provider has its own requirements for the
valid characters. For now, let the Cloud API implementation generate a
random image name. The name is always returned in the compose status's
upload status, so it should be possible to attach it to the Koji build
to allow users to find the image.
2022-07-22 11:39:49 +01:00
Tomas Hozza
77a1672b79 worker/koji-finalize: handle multiple upload targets
Enhance the `koji-finalize` job implementation to be able to cope with
multiple upload targets being specified for an `OSBuildJob`.

Implement a convenience method `OSBuildJobResult.TargetResultsByName()`
for filtering the target results attached to the job result by their
name. Cover the method with an unit test. And lastly use this method in
the `koji-finalize` job to find the appropriate Koji upload target
results.

This is a preparation for enabling cloud uploads for Koji composes.
2022-07-22 11:39:49 +01:00
Tomas Hozza
58696e849f worker/koji-finalize: always report status back to composer and Koji
Enhance the `koji-finalize` job implementation to use deferred function
to ensure that the job status is always reported back to the composer.
In addition, if the `JobError` is set, also fail the Koji job.

Previously, composer and Koji were not updated in some corner cases when
the job would fail.
2022-07-22 11:39:49 +01:00
Tomas Hozza
1fec2c476d Cloud API: add support for gce-rhui image type
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-07-22 11:39:49 +01:00