Commit graph

4758 commits

Author SHA1 Message Date
dependabot[bot]
d40dbd6f0b build(deps): bump cloud.google.com/go/compute from 1.7.0 to 1.9.0
Bumps [cloud.google.com/go/compute](https://github.com/googleapis/google-cloud-go) from 1.7.0 to 1.9.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/video/v1.7.0...pubsub/v1.9.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/compute
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-16 01:42:14 +02:00
Tomáš Hozza
fd1850de40 distro: use storage capacity multiple constants in partition tables 2022-09-15 20:39:40 +02:00
Sanne Raymaekers
183e10e466 templates/packer: append distro and arch to the ami name
Because the rhel-8 images share the same name, and `force_deregister` is
true, packer will always deregister one of them.
2022-09-15 20:27:59 +02:00
Brian C. Lane
561bbbbdf3 azure: storageErr is already azblob.StorageError type 2022-09-15 03:57:40 -07:00
Brian C. Lane
7bae91eb9a gcp: Placeholder credential string is not a hardcoded credential 2022-09-15 03:57:40 -07:00
Brian C. Lane
0298dc85ab azure: Add note that azure-sdk-for-go module is deprecated 2022-09-15 03:57:40 -07:00
Brian C. Lane
cf18e2990a distro: Fix bug found by linting
Using new() to create a new struct assigns an empty struct to the
variable, meaning it can never be tested for nil. This means this code
would never detect a missing kernel package.
2022-09-15 03:57:40 -07:00
Brian C. Lane
826e9d8cc6 osbuild-composer: Set ReadHeaderTimeout to 5s
This satisfies the linter complaint about potential Slowloris attack
where headers are read slowly in an attempt to DoS the server.

The uses of ListenAndServe are only for testing purposes and are not run
in the production server so ignore the lint errors in
osbuild-mock-openid-provider.
2022-09-15 03:57:40 -07:00
Brian C. Lane
dfb69dc8e7 golangci-lint: The parameters passed to exec.Command are safe
None of these parameters are user controlled, they are either
constructed from paths or are constants.
2022-09-15 03:57:40 -07:00
Brian C. Lane
29fb97f3d6 workflow: Use latest golangci-lint workflow action 2022-09-15 03:57:40 -07:00
Brian C. Lane
9827126d30 dnfjson: Add dnf-json result cache to BaseSolver
This is used to cache the results of dump and search requests for 60s.
Once the timeout has passed the request is repeated and the timeout
reset. The timeout is *not* reset on every cache hit which prevents, for
example, a request every 59 seconds from keeping the cache from
updating.

When the existing CleanCache() function is called to check the on-disk
metadata cache it will also delete any expired entries from the
resultCache in order to keep it from eventually consuming all memory.
2022-09-15 11:34:39 +01:00
Brian C. Lane
e307a8174a dnfjson: Add Hash functions to repoConfig and Request
These will be used to generate a unique hash to be used with the cache
of dnf-json results.
2022-09-15 11:34:39 +01:00
Brian C. Lane
35059ca60e dnfjson: Add a cache of dnf-json results
This adds a cache structure with timeout handling and cache cleanup.
Also adds some testing of the new functions.
2022-09-15 11:34:39 +01:00
Tomas Hozza
f4aed3e6e2 distro/rhel8: use azure-rhui pkg set and image config for vhd
Extract the non-RHUI specific package set and image configuration into a
common definitions, which will be used by both image types.

Redefine the package sets and default image configuration used by both
image types to inherit from a common definition.

Regenerate image manifests for RHEL-8 / c8s `vhd` and `azure-rhui`
images.

There is no change in the resulting manifest for the `azure-rhui` image
type. However there are substantial changes to the `vhd` image
definition, which is now almost identical to the `azure-rhui` image
type, to provide consistent experience regardless if using RHUI or not.

The default partition table used by the `vhd` image type has been kept
as it was before, since there is yet no consensus on what size to
standardize for both image types.
2022-09-15 08:50:33 +02:00
Tomas Hozza
b4abacbaa2 distro/rhel9: use azure-rhui pkg set and image config for vhd
Extract the non-RHUI specific package set and image configuration into a
common definitions, which will be used by both image types.

Redefine the package sets and default image configuration used by both
image types to inherit from a common definition.

Regenerate image manifests for RHEL-9 / c9s `vhd` and `azure-rhui`
images.

There is no change in the resulting manifest for the `azure-rhui` image
type. However there are substantial changes to the `vhd` image
definition, which is now almost identical to the `azure-rhui` image
type, to provide consistent experience regardless if using RHUI or not.

The default partition table used by the `vhd` image type has been kept
as it was before, since there is yet no consensus on what size to
standardize for both image types.
2022-09-15 08:50:33 +02:00
Tomas Hozza
117f5a48f9 format-request-map.json: fix azure-rhui definition
There was a missing `overrides` property in the `azure-rhui` request
definition, which resulted in:

```
$ ./tools/test-case-generators/generate-test-cases --distro rhel-90
--arch x86_64 --image-types azure-rhui --store /dev/null --output
/home/thozza/devel/osbuild-composer/test/data/manifests
--keep-image-info
Traceback (most recent call last):
  File "/home/thozza/devel/osbuild-composer/./tools/test-case-generators/generate-test-cases", line 176, in <module>
    main(args.distro, args.arch, args.image_types, args.keep_image_info, args.store, args.output)
  File "/home/thozza/devel/osbuild-composer/./tools/test-case-generators/generate-test-cases", line 153, in main
    if distro in test_case_request["overrides"]:
KeyError: 'overrides'
```
2022-09-15 08:50:33 +02:00
Tomas Hozza
b15def6c02 distro/rhel8: move all Azure / VHD code to a separate file
Move all code related to Azure / VHD images to a separate file,
similarly as it is done in rhel7 distro. This approach makes it easier
to find all the code related to a specific image type family.
2022-09-15 08:50:33 +02:00
Tomas Hozza
14868fe942 distro/rhel9: move all Azure / VHD code to a separate file
Move all code related to Azure / VHD images to a separate file,
similarly as it is done in rhel7 distro. This approach makes it easier
to find all the code related to a specific image type family.
2022-09-15 08:50:33 +02:00
Tomas Hozza
4b25fa73bc distro: use storage unit constants from the common package
Don't redefine the storage unit multiples in each distro, but use the
constants defined in the `common` package. This will make it easier to
split related image type definitions into separate files.
2022-09-15 08:50:33 +02:00
Tomas Hozza
ff28b0f5d3 common: define storage units as constants
Define all used storage units as constants. Use them in
`DataSizeToUint64()`, instead of literal multiples.
2022-09-15 08:50:33 +02:00
Sanne Raymaekers
b5d1c8866a templates/dashboards: Bump worker dashboard version 2022-09-14 19:43:47 +02:00
Sanne Raymaekers
db978c32bd templates/dashboards: Fix tenant name to org id mapping
The crc stage tenant and fedora stage tenant were mixed up.
2022-09-14 19:43:47 +02:00
Sanne Raymaekers
cb38a92a39 templates/dashboards: Expand job wait duration panels 2022-09-14 19:43:47 +02:00
Gianluca Zuccarelli
5a4d22cc6d pkg/dbjobqueue: fix enqueue/dequeue race condition
Currently there is a race condition that occurs between the
dbjobqueue enqueue and dequeue functions. Both queries make
use of the postgres `now()` timestamp function which returns
the timestamp of when the transaction started and not when
the statement is executed. The result of this is a timestamp
for a job's `started_at` field to be earlier than its
`queued_at` field causing a constraint violation.

Since the dequeue query will never be executed before the
enqueue query, changing the postgres timestamp function to
`statement_timestamp()` resolves this issue.
2022-09-14 12:44:46 +02:00
Alexander Todorov
3d6256a89d Specify additional package in blueprint for tests
Related RHBZ#2065734
2022-09-13 18:56:00 +02:00
Achilleas Koutsou
eba29c9007 test/ostree-raw: replace default ostree remote URL
The Fedora IoT Raw image sets the default remote URL to the official
Fedora IoT source at build time.  We need to replace it in our tests
with our local test repo.
2022-09-13 16:06:19 +01:00
Ondřej Budai
966049ec3c test: use firmware auto-detection with virt-install >= 4
3013889727

changed the behaviour of --boot uefi. Now, it doesn't pass the loader options
but uses firmware="efi" that uses libvirt's ability to auto-detect the correct
loader.

Therefore, for distributions that ship the new virt-install, we have to change
the --boot argument. --boot uefi should now be able to automatically set the
uefi loader correctly without passing any extra loader options. The only issue
is that CS9 has issues with secure boot and edge, so we need to disable
secure boot using a new (and arcane) syntax (the old loader arguments no
longer work):

firmware.feature0.name=secure-boot,firmware.feature0.enabled=no
(https://libvirt.org/formatdomain.html#bios-bootloader)

See the CS9 bug for secure boot issues on edge:

https://bugzilla.redhat.com/show_bug.cgi?id=2108646

Also, since --os-type is deprecated in libvirt >= 4, let's remove it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
c373d9971d test: add --import to virt-install for UEFI
The option was already there for the BIOS case and now it (or any other
install method) is required in newer versions of virt-manager.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
7072432b0f test/ostree-raw: separate osname variable in playbook
The image_type variable in the playbook is used for the name of the
deployment, which is 'redhat' by default for RHEL and 'fedora-iot' for
Fedora.
This affects the deployment path checks, for example:
    {{ device_name  }}[/ostree/deploy/{{ image_type  }}/var]
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
b38cfc2ad6 ansible: update boot-complete.target check
In Fedora 37, the message for reaching the boot-complete.target changed
from
    Reached target Boot Completion Check
to
    Reached target boot-complete.target - Boot Completion Check
which is making the string matching test fail.

Instead of looking for message strings, check that the target's status
is good.
2022-09-13 16:06:19 +01:00
yih
9ea694ef0a test: update ansible checks for ostree mount points 2022-09-13 16:06:19 +01:00
Achilleas Koutsou
44cd7cbc76 test: update ansible checks for ostree to match F36+ packages
Update greenboot package checks to match the new rules.

Co-Authored-By: Xiaofeng Wang <henrywangxf@me.com>
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
1d3b0a653e test: update manifests 2022-09-13 16:06:19 +01:00
Achilleas Koutsou
2001b23610 fedora: conditional greenboot package names
Greenboot for Fedora 35 and older has several optional subpackages.
Starting with v36, there is only the 'greenboot-default-health-checks'
subpackage.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
91e581462b common: move VersionLessThan() util function
Move VersionLessThan() utility function to the common package to be
reused.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
c513f08719 test/ostree-raw: move user from commit to deployment
Instead of defining users in the ostree commits, create them during the
deployment and creation of the raw image.
Defining users in commits locks them into the base system: they can't be
removed and their password can't be changed without creating an upgrade
commit and they will always be part of the initial system.

Also, in Fedora 37, password authentication for users in commits is not
working.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
54dc7c7141 test/ostree-raw: remove mentions of installer
Leftover mentions of 'installer' from when this script was copied from
installer tests.  Replaced all mentions with raw-image.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
6cd3a34099 image: add users and groups to edge/iot raw images 2022-09-13 16:06:19 +01:00
Achilleas Koutsou
5bc66f0665 manifest: add Users and Groups to OSTreeDeployment
Support creating users and groups during deployment of the commit to a
live image.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
40c91d7285 manifest: drop blueprint User and Group types from OS
Use the new internal types for setting users and groups in images.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
820d3d0277 users: convenience functions for converting from BP
The types currently map directly, so it's simple to convert from one to
the other.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
86d9611f98 osbuild: generator functions for UsersStage and GroupsStage
Generators for creating UsersStage and GroupsStage from the new internal
types.
These are almost identical to the existing stage option creation
functions.  Those will be removed once every use is replaced with the
new generators.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
e8c242db81 users: new package for internal User and Group types
New types that represent a User or Group for internal representation.
These are meant to be used as intermediate representations between API
or Blueprint user customizations and the final OSBuild stage options.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
6dafa36fc7 image-info: remove base loop device before analysing partitions
Instead of keeping the loop device of the base image and then opening
each partition as a loop device, remove the original loop device of the
base image and then create a loop device for each partition from the
file itself using the partition offsets.

The open_image() function is renamed to convert_image() and now only
handles converting qcow2 files to raw files if necessary.
The loop_open() context is done in analyse_image() instead, so that the
base loop device can be closed without removing the converted image.

This fixes the following issue with LVM partitions:
When the same lvm partition UUID is on two devices (e.g., /dev/loop0p4
and /dev/loop1), the 'vgchange -ay' command fails with the following
error:

  Cannot activate LVs in VG rootvg while PVs appear on duplicate
  devices.

This happens when we open the LVM partition as a separate loop device,
which we do for all partitions that we want to inspect.

NB: It's possible to restrict the vgchange command to a specific device
with --devices, but this isn't available in older versions of lvm2 (it
was introduced in 2.03.11).
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
81e11c7946 test: override hashicorp repo releasever for F37
Set $releasever to 36 when running on Fedora 37 because there is no
hashicorp repo for it yet.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
35f74027a9 Schutzfile: pin osbuild version
Requires fix in https://github.com/osbuild/osbuild/pull/1100
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
bf83bbea38 test: move greenprint and redprint functions to shared_lib.sh
Since we're sharing functions between test scripts, move greenprint(),
the most rewritten function in the history of the project, to
shared_lib.sh and source it everywhere.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
3b14828669 test: new weldr client compatibility for test scripts
- Handle the array responses from the new weldr-client (>= 35.6).
- Move the `get_build_info` function to shared_libs.sh to source and
  reuse in multiple places.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
8e24f5720d osbuild-composer-cli-tests: new weldr-client compatibility
The newest weldr-client (35.6) changed its responses to always be
arrays/lists of json objects.  The tests have been updated to parse this
structure as well.

The current workflow for parsing responses from the weldr-client is as
follows:
- If weldr-client is installed on the system:
    - Try to parse the newest structure version: array of objects, each
      with a body field.
    - If that fails, initialise the first element of the array and parse
      the response into it.
- If the weldr-client is not installed, initialise the array with one
  element and parse the response into the body field of the first
  element of the array.
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
fb4309acf4 test: add repos and test manifests for Fedora 38 2022-09-13 16:06:19 +01:00