Commit graph

1400 commits

Author SHA1 Message Date
Achilleas Koutsou
143eb5cb91 worker: add PipelineNames to Job descriptions
The names of the pipelines that make up a Manifest for a job are
attached to the job data that is stored in the queue. The pipelines are
separated into Build and Payload.

This information is useful for identifying the build pipeline results
and metadata and for the order of the pipelines as they appeared in the
manifest.
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
a0479a1bcf osbuild2: test result Write() function
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
65f1a24ecd osbuild2: remove Prints in lvm.create stage test
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
682fc245e5 kojiapi: use osbuild2.Result in test
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
dc0e3dea92 osbuild: test result conversions
Moved and adapted tests from osbuild1 to osbuild2.
Moved test data from osbuild1 to osbuild2.
Added conversion tests for v1 to v2.
Added full v2 result raw data from successful build.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
b7bab25e73 osbuild2: check v1 data before converting
Don't convert stage results if there are none.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
6731984326 distro: ImageType build and payload pipeline names
Each image type now implements BuildPipelines(), which returns a list of
pipeline names that set up the build environment, and
PayloadPipelines(), which returns a list of pipeline names that create
the OS image (all non-build pipeline names).

Older distros that produce v1 manifests should call the distro Fallback
functions to return the common defaults.

A Fallback function for the Exports() method is also added and called by
older distros.

All image types that produce v2 manifests (distros after RHEL 8.4)
should include the information in the image type definition and should
not rely on fallbacks for default values.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
fbdc19f6d8 rpmmd: deduplicate RPM list based on NEVRA
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
e73d35d7c1 osbulid2: unmarshal PipelineMetadata into ptr receiver 2021-11-16 09:49:37 +01:00
Achilleas Koutsou
a9ea5e12a8 osbuild2: omitempty Error field in v2 Result 2021-11-16 09:49:37 +01:00
Achilleas Koutsou
5f8bd4fd6e osbuild2: small code reorganisation
Move main type to the top of the file
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
10eb0d65a1 osbuild2: convert from osbuild1 results
Convert osbuild1.Result{} to osbuild2.Result{}.
For the Metadata objects, it assumes they are directly convertible: the
stage metadata structs have the same members.

The old conversion code from v2 to v1 is removed and the equivalent
conversion logic is moved to osbuild2:
- version detection based on stub
- custom unmarshaller that calls conversion function if v1 result is
  detected

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
9eff6f1e95 osbuild2: v2 Result writer
Implementing writer for osbuild2 Result type.
Since Go maps don't have stable ordering, sorting by the pipeline name
provides stable output.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
2004c71f89 cloudapi: use osbuild v2 result struct to extract metadata
Reading stage metadata using osbuild's v2 result format.
For RPM stages we only want the core (OS) RPMs (not the build root
RPMs). Skip the build pipeline by name, but this should be handled
better since names are arbitrary.

Using type switch to convert metadata types instead of relying on the
type string of the stage result.

The rpmmd helper function isn't used anymore since that requires two
conversion passes (osbuild.StageMetadata -> rpmmd.RPM ->
cloudapi.PackageMetadata).

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
9dff17e172 rpmmd: convert from v2 result metadata
Function renamed to better fit the argument element type
(StageMetadata).
Argument is a map to fit the pipeline metadata in the result object.
Signature function is made public to be reused in the cloud API
conversion.

Metadata test raw value updated to v2 result format.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-16 09:49:37 +01:00
sanne
6757916c54 worker: Introduce manifest-id-only job
A job intended to run in composer itself, after which a dependant
osbuild job can parse the manifest from it's dynamic arguments.
2021-11-15 16:04:12 +01:00
Ondřej Budai
d3a3dbafed jobqueue: add DequeueByID
We will soon need to dequeue a job using its ID. This commit adds ability
to do that to the Jobqueue interface. As always, the fsjobqueue implementation
is slightly naive but it should fine for the usecases that it's designed for.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-11-14 10:17:03 +01:00
Ondřej Budai
2ecc48727f fsjobqueue: factor out finished deps check
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-11-14 10:17:03 +01:00
Ondřej Budai
5f4db72777 fsjobqueue: do not delete empty channels
Previously, we deleted empty channels when a job was dequeued. This is
completely wrong because there still might be some clients waiting for
a job. This commit removes the cleanup and adds a regression test.

Note that this has the potential to leak memory if we ever use a lot of
job types. Currently, we have just handful of them, so this is fine.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-11-14 10:17:03 +01:00
Martin Sehnoutka
a880c9c019 osbuild2: new stage yum config
This stage was introduced in osbuild 41. Add support into
osbuild-composer and a test using test data from osbuild repo.
2021-11-12 20:27:35 +01:00
Martin Sehnoutka
b159d04af7 osbuild2: new stage pwquality conf
This stage was introduced in osbuild 41. Add support into
osbuild-composer and a test using test data from osbuild repo.
2021-11-12 20:27:35 +01:00
Martin Sehnoutka
59be127daf osbuild2: new stage authconfig
This stage was introduced in osbuild 41. Add support into
osbuild-composer.
2021-11-12 20:27:35 +01:00
Martin Sehnoutka
af9cca1b50 osbuild2: new stage sshd config
This stage was introduced in osbuild 41. Add support into
osbuild-composer and a test using test data from osbuild repo.
2021-11-12 11:40:13 +01:00
Achilleas Koutsou
155a887bd1 distroregistry: disable CentOS Stream 9
CS9 is untested and probably doesn't fully work now. Disabling until it
is ready to be fully verified.
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
d4f801c48e distro/rhel90: remove all mentions of obsolete firmware packages
Removed packages:
- iwl3945-firmware
- iwl4965-firmware
- iwl6000-firmware
- libertas-sd8686-firmware
- libertas-usb8388-firmware
- libertas-usb8388-olpc-firmware

Source: https://issues.redhat.com/browse/ENGCMP-1287
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
82cf71c5a1 distro/rhel90: make nginx log and lib directories world writable
Previously, we only needed the log directory to be writeable.
In newer versions of nginx, it also needs to create directories in
/var/lib/nginx, so we make that directory writeable and traversable as
well.
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
a8eb58bc62 distro/rhel90: disable edge-simplified-installer image type
Critical dependency is not available yet
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
fa18ba0431 distro/rhel90: update unit tests 2021-11-10 14:54:31 +01:00
Achilleas Koutsou
5765d5af9a rhel90: drop -ga suffix and alias from beta
`rhel-90` now refers to the RHEL 9.0 distro (rhel90 package) and the
beta is only referred to by `rhel-90-beta`.
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
6b73dc5a92 distro/rhel90: update to match 8.6 and add centos-9 alias
- Copied distro and image definitions from RHEL 8.6
    - New package set handling
    - Distribution-specific strings
    - New image types: edge-raw and edge-simplified-installer
    - Edge container with nginx
    - Removed greenboot services from edge enabled services (enabled
      automatically)
- Adapted to required changes from RHEL 9.0 Beta
- Added CentOS 9 (centos-9) alias

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
ba4a4541d9 distro/rhel86: remove genisoimage
Not required.
Discovered it's unneeded when it was removed from RHEL 9.0.
Updating RHEL 8.6 to keep clean and consistent.
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
c7cab92e88 distro/rhel86: single osbuild import
osbuild2 was imported twice, once with its own name and once aliased as
plain osbuild.
Use only the plain osbuild alias.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
cad5c3f13f distroregistry: add rhel-90-ga to registry
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
d290ff5923 distro: copy rhel90beta to rhel90
- Start of RHEL 9.0 GA definition
- Initial distro name: rhel-90-ga
- rhel-90 alias remains for rhel-90-beta for now

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-10 14:54:31 +01:00
Gianluca Zuccarelli
c0ceede084 cloudapi/v2: 5xx error metrics
Currently error metrics are being recorded for
errors with the exact error code of 500. This
commit enables recording metrics for all 5xx errors.
2021-11-04 08:08:32 +01:00
Martin Sehnoutka
708d985194 internal/blueprint: allow filesystem size specified with units
Allow users to specify filesystem size with units such as kB, MB, etc.
2021-11-02 18:32:47 +01:00
Martin Sehnoutka
f84beee04d internal/blueprint: introduce custom fs customization parser
The automatically generated parser can only parse integers into the size
field. Introduce a new one, which will be able to handle strings as
well.
2021-11-02 18:32:47 +01:00
Martin Sehnoutka
f2f078acd6 internal/blueprint: introduce new test for parsing blueprints
Test case like this was completely missing. A similar one is present in
the Weldr package, but this one is specific to testing blueprints and
thus easier to understand and extend.
2021-11-02 18:32:47 +01:00
Martin Sehnoutka
7d6dadb598 internal/common: introduce function to convert data sizes
This function will be used to parse filesystem sizes specified as
string.
2021-11-02 18:32:47 +01:00
Gianluca Zuccarelli
297a60d238 cloudapi: record error metrics
Hook up the compose error metric for
the prometheus alerts and grafana dashboard.
2021-10-29 20:36:18 +01:00
Gianluca Zuccarelli
f8199ec41d prometheus: add middleware function
Add middleware function to track request count
and measure the latency of compose requests.
2021-10-29 20:36:18 +01:00
Gianluca Zuccarelli
dfa6a48f5d prometheus: compose latency metric
Add metric to measure the latency
of requests made to the composer
cloud api.
2021-10-29 20:36:18 +01:00
Chloe Kaubisch
f749078b0d prometheus: update metrics
Change the name of total https requests to be more specific.
Add a new counter for failed compose requests.
2021-10-29 17:09:45 +01:00
Christian Kellner
93e54cd872 distro/rhel86: special case root user for ssh keys
Add a special case for the root user to the work-around for ssh
keys in OSTree commits. As a little refresher: OSTree does not
support having any content in home directories; we therefore
include a first-boot stage in the commit that will create the
ssh keys on first boot. However, until now we did not special
case the root user, which has a separate root directory (/root,
as a symlink to /var/roothome). This patch fixes this.
2021-10-27 00:41:27 +02:00
Tom Gundersen
f44acd0974 Revert "Revert "cloudapi/v1: Move depsolving to workers""
Workers now depsolve in parallel to image builds, so we can
again move depsolivng to the workers. This will help us deal
with increases in traffic as we currently only have one
depsolve handler per pod. It would also avoid any issues with
composer running out of disk space due to dnf metadata caches.

This reverts commit c65b1e9b26.
2021-10-26 13:58:22 +01:00
Achilleas Koutsou
30d1183909 distro/rhel86: skip RHSM config stage for non-RHEL
EC2 RHEL images keep the RHSM DNF plugins enabled, but this shouldn't be
added on CentOS since it doesn't have RHSM.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-10-21 15:16:04 +01:00
Achilleas Koutsou
93750dd537 distro/rhel86: distro private method isRHEL()
Returns true if the distribution name starts with "rhel".

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-10-21 15:16:04 +01:00
Achilleas Koutsou
ed0cb5ea24 distro/rhel86: add distro specific package set
A package set that only gets added for some distros.

Now that the rhel86 subpackage defines both RHEL 8.6 and CentOS 8, we
need to be able to separate out packages that are only available on one
of the two distros. Currently, this only includes "insights-client"
which is not available on CentOS.

The packages are added to the OS package sets conditionally based on the
distro name.
2021-10-21 15:16:04 +01:00
Achilleas Koutsou
8f84e46ab8 distro/rhel86: add CentOS Stream 8 as alias to RHEL 8.6
Removed old alias from RHEL 8.4.

To make aliasing distributions simpler, all distro-specific strings were
added to the local distribution type.

These were previously global constants of the distribution package and
alias alternatives were used conditionally. Now the two distributions
are predefined in global map.

CentOS exclusions:
- s390x arch
- ec2 image types: rhui client is not available

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-10-21 15:16:04 +01:00
Achilleas Koutsou
20036e7944 distro/rhel86: remove redundant rhel-86 alias
Accidentally left over from copy from RHEL 8.5
2021-10-21 15:16:04 +01:00