Commit graph

2941 commits

Author SHA1 Message Date
Martin Sehnoutka
ea97adfdf8 spec: bump osbuild version to 41
This will be needed for new stages which are available only in osbuild
41.
2021-11-16 10:13:06 +01:00
sanne
3101046d44 composer: Add metrics endpoint to auth excludes again
Mistakenly removed in 4577ac0717. Composer
itself does the authentication, not the gateway, therefore we do need
the auth exclude.

Added a comment to explain why it's attached to the api socket and not a
separate listener.
2021-11-16 10:05:52 +01:00
Achilleas Koutsou
778b2de3c0 worker: test mixed new and old jobs in jobqueue
Two new tests, one for OSBuild and one for Koji jobs. Both follow the
same flow:
- Enqueue a job that doesn't specify PipelineNames (oldJob)
- Enqueue a job that does specify PipelineNames (newJob)
- Read the job data for the oldJob and check that the default
  PipelineNames were added
- Read the job data for the newJob and check that it's unchanged
- Finish oldJob and add results without specifying PipelineNames
- Finish newJob and add results with PipelineNames
- Read the oldJob result and check that the default PipelineNames were
  added
- Read the newJob result and check that it's unchanged

This is meant to test several scenarios that can occur when upgrading
the service:
1. The existing jobqueue has old jobs in it that were queued before the
   PipelineNames were part of the data structure. The worker should be
   able to read these and add the fallback data.
2. New jobs are added while old jobs still exist in the queue and the
   worker can read both types.
3. The existing jobqueue has old finished jobs in it that were finished
   and had results written before the PipelineNames were part of the
   result data structure. The worker should be able to read these and
   add the fallback data.
4. New jobs are finished and results are written while old jobs still
   exist in the queue and the worker can read both result types.
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
51870676cc worker/json: add fallback pipeline names when reading data
When worker reading data into the job and result types, check if the
PipelineNames are populated and, if not, add the fallback values from
distro.

This makes it simpler to work with job queues that contain old data
before the introduction of the PipelineNames. In any situation where the
job or result data are read, the reader can assume that the
PipelineNames are non-nil and that if they belong to an old job, they
have the fallback names.

This assumption goes hand-in-hand with the change in v2 format for
osbuild results, since old jobs that don't have PipelineNames set *must*
contain results in the old format for the names to be valid.
2021-11-16 09:49:37 +01:00
Achilleas Koutsou
38b8bfbd66 rpmmd: test rpm list deduplication 2021-11-16 09:49:37 +01:00
Achilleas Koutsou
9aef7bfc47 osbuild-worker: attach pipeline names to jobs
Pipeline names are added to each job before adding to the queue. When a
job is finished, the names are copied to the Result object as well. This
is done for both OSBuild and Koji jobs.

The pipeline names in the result are primarily used to separate package
lists into build and payload/image packages in two cases:
1. Koji builds: for reporting the build root and image package lists to
   Koji (in Koji finalize).
2. Cloud API (v1 and v2): for reporting the payload packages in the
   metadata request.

The pipeline names are also used to print the system log output in the
order in which pipelines are executed. This still isn't used when
printing the OSBuild Result (osbuild2.Result.Write()) and we still rely
on sorting by pipeline name
(see https://github.com/osbuild/osbuild-composer/pull/1330).
2021-11-16 09:49:37 +01:00
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
8dce5aa688 osbuild-worker: use v2 Result struct
- koji-finalize:
Use v2 result type to collect RPM metadata.

The separation between the "build" pipeline and the rest is based on the
pipeline name, which isn't completely reliable since pipeline names can
be arbitrary.

Koji will fail a build if it specifies duplicate packages, so the RPM
lists are deduplicated. The "build" pipeline package list is also
deduplicated in case there are multiple build stages in the same
pipeline.

- osbuild:
Use v2 result type for printing build result to log.

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
Xiaofeng Wang
85df63ce52 test: Use YAML as Ansible output format 2021-11-12 14:43:55 +01:00
Alexander Todorov
87b4a95e09 ci: Send results to Coverity Scan daily
https://scan.coverity.com/projects/osbuild-osbuild-composer
2021-11-12 14:20:15 +01:00
Gianluca Zuccarelli
44017890ca containers: mock oauth container
Add a mock oauth container to simulate
the openshift SSO offline_token
2021-11-12 14:07:13 +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
Simon Steinbeiss
f9e2924e00 packit: Use upstream github release description
Setting this option enables packit to use the Github upstream release
description for the specfile instead of just using all commit messages.
2021-11-12 08:48:47 +01:00
Juan Abia
0bc6ea1172 schuzbot: clean aws unused resources
list all unused resources on ec2 and remove them.

each resource originated by test scripts should be tagged with
"gitlab-ci-test"
2021-11-11 15:42:32 +01:00
Juan Abia
4c4e26d996 test/cases: use the same naming pattern on every test
make api.sh and was.sh use the same naming pattern, TEST_ID.
2021-11-11 15:42:32 +01:00
Xiaofeng Wang
ab3712fd92 test: Update ostree test scripts to support different ostree refs 2021-11-11 12:11:01 +01:00
diaasami
bb190f1280 Post release version bump
[skip ci]
2021-11-10 16:37:05 +00:00
Sanne Raymaekers
1fdc18856a Revert "templates: Add prometheus scrape annotations to composer-api"
This reverts commit 7f86dae69b.
2021-11-10 15:24:24 +01:00
sanne
7f86dae69b templates: Add prometheus scrape annotations to composer-api 2021-11-10 15:13:53 +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
89f0613f3d test/cases: rm ostree-ng-og.sh
Obsolete test script
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
e02911bc45 test/data: update manifests for edge-container images 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
9f4c5b08e3 Schutzfile: remove osbuild version pin for RHEL 9.0 2021-11-10 14:54:31 +01:00
Achilleas Koutsou
5786db9caa tools: update distro-arch-imagetype-map for RHEL 9.0 types
`rhel-90-ga` no longer valid.  Now called `rhel-90`.
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
0c185eca7a tools: update RHEL 9.0 repos for test case generators
No more `rhel-90-ga`.
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
2cd3c71370 test/data: update RHEL 9.0 and beta manifests
Distro name is now `rhel-90` (was `rhel-90-ga`)
Beta distro name is `rhel-90-beta` (was `rhel-90`)
2021-11-10 14:54:31 +01:00