Commit graph

723 commits

Author SHA1 Message Date
Tomáš Hozza
9e9aec5b53 test/api: move govc installation to common/vsphere.sh
Move the installation of the VSphere client out of the
`api/common/aws.sh` `installClient()` function into a dedicated
`installClientVSphere()` function in `api/common/vsphere.sh`.

Rename the `installClient()` in `api/common/aws.sh` to
`installAWSClient()`. Introduce `installClient()` in both,
`api/aws.sh` and `api/aws.s3.sh`, which calls `installAWSClient()`.

Call `installClientVSphere()` conditionally when testing VMDK image type
in `api/aws.s3.sh` and `api/generic.s3.sh`.
2022-09-19 10:37:32 +02:00
Tomáš Hozza
2f6c238b7a test/cases/api.sh: fix indentation 2022-09-19 10:37:32 +02:00
Tomáš Hozza
9981a05190 test/cases/api/common/s3.sh: delete duplicate functions
All of the deleted functions were defined in the same file twice.
2022-09-19 10:37:32 +02:00
Tomáš Hozza
9285b7c9fe test/cases/api/aws.s3.sh: delete duplicate functions
The `verifyEdgeCommit()` and `verifyDisk()` functions are already
defined in the `test/cases/api/common/s3.sh` file sourced by
`test/cases/api/aws.s3.sh`.
2022-09-19 10:37:32 +02:00
Tomáš Hozza
ce8cc11739 test/cases/api/common/s3.sh: fix indentation 2022-09-19 10:37:32 +02:00
Jakub Rusz
1050f8a506 tests/upgrade: copy shared_lib.sh to the test vm
shared_lib.sh now contains some more helper functions and the
verification script uses them. Copy it over so that we can source it.
Also install all other dependencies before the actual upgrade.
2022-09-16 08:36:03 +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
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
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
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
yih
f606e4c054 test iot-raw-image on fedora37 2022-09-13 16:06:19 +01:00
Ondřej Budai
e2a298723e ci: enable fedora 37 tests
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-09-13 16:06:19 +01:00
Achilleas Koutsou
c88d0255da test/diff-manifest: fetch base branch from GitHub
Distro version branches aren't synced to GitLab, so we will need to
fetch them from GitHub directly.
This is required for any PR made against any branch other than main.
2022-09-13 10:57:16 +02:00
Xiaofeng Wang
05503c58c2 test: Remove OCP4 test
Since api.ocp.ci.centos.org is going away:
https://lists.centos.org/pipermail/ci-users/2022-June/004547.html.

After discussion, OCP4 test will be removed here, but RHEL for Edge
downstream test will keep OCP4 case
2022-09-12 19:14:13 +02:00
Alexander Todorov
647acfa2f4 Adjust AWS EC2 type in tests depending on CPU arch 2022-09-09 10:49:41 +03:00
Juan Abia
810f3fe0e9 test: change CIV tag
We were using `latest` as tag, this can be dangerous as it's the default
tag, an anyone can accidentally update it. Using `prod` is safer.

Also use dev container image if the test script is running in CIV CI.
2022-09-07 17:59:50 +02:00
Diaa Sami
6b2af037a3 test/cases/api/aws.sh: add support for starting aarch64 instances 2022-08-31 15:41:13 +02:00
Diaa Sami
9635155c88 api/common/aws.sh: support arm64 when installing govc 2022-08-31 15:41:13 +02:00
Sanne Raymaekers
d13347e1ca cloudapi: Add endpoints to clone aws images across regions
Support for creating multiple amis from a single compose. It uses the
AWSEC2* jobs to push images to new regions, and share them with new
accounts.

The compose it depends upon has to have succeeded.
2022-08-30 16:14:52 +02:00
Jakub Rusz
5e9ecd3ae4 test/gcp: Run cleanup function at the end
All EXIT traps are cleared on line 280 so the cleanup trap is never run
and VMs are waiting for 4 hours to get cleaned by
scheduled-cloud-cleaner. Run the cleanup at the end and rely on
scheduled-cloud-cleaner only in case of failures before that.
2022-08-30 16:14:07 +02:00
Juan Abia
b11a493455 test: get latest version of CIV in aws.sh
instead of manually updating CIV version every once in a while. Get
always the latest version.

In CIV CI, this test runs before any change can be introduced into the
container image, so no unexpedted errors should come from the CIV side.
2022-08-30 15:02:25 +02:00
Xiaofeng Wang
dba76a1204 test: Add edge-install BISO installation test back for BZ#2110864 2022-08-25 14:54:56 +01:00
Juan Abia
1873c561cf test: disable non supported tests
some scripts skip the test if it's not supported for that
distro-version. Disable them in gitlab-ci.yml so we don't waste CI
resources.

To disable them, we are using the `rules` on each job with a regex
pattern. Using `=~` (pattern matches) as a  WHITELIST and `!~` (pattern
does not match) as a BLACKLIST.
2022-08-24 19:37:43 +02:00
Gianluca Zuccarelli
c264ce53cd distro: add oscap packages to image
Since the oscap remediation stage in osbuild runs
the oscap package in `chroot`, it is necessary to
install the `openscap-scanner` package to the image
itself rather than the build root.
2022-08-23 18:06:15 +02:00
Alexander Todorov
65ef1b2e78 Don't special case nightly repository names for Satellite regression tests
this is no longer needed b/c the nightly CI jobs are now using the same
json definitions as the regular CI jobs, just changing baseurl. See
previous commit.
2022-08-18 14:00:16 +03:00
Xiaofeng Wang
53d4d7f284 test: Improvements for container embedding Edge test 2022-08-12 10:18:29 +03:00
Juan Abia
6e771c97fc test/cases: update cloud-image-val in aws.sh
update CIV to latests realease: v0.2.2
2022-08-11 18:17:28 +02:00
Alexander Todorov
8ae8ba9fae tests: Add comment to make it more obvious what's happening 2022-08-11 13:12:55 +02:00
Alexander Todorov
d3dde77a6f tests: Make Satellite regression tests to use the SUT 2022-08-10 16:33:34 +03:00
Alexander Todorov
860b122f2c tests: Remove useless JSON file overrides
See comment
https://github.com/osbuild/osbuild-composer/pull/2881/files#r940065803

for explanation why
2022-08-10 16:33:34 +03:00
Christian Kellner
b562d144ca distro/*: allow /boot to be customized
Since the LVM support was added to all distros, our disk
related code is adaptive, i.e. we will set the correct BLS
and grub2 prefix if there a `boot` partiton is present in
the layout after all customizations happen, which includes
LVMification.
One thing that was not yet fully working was layouts that
do not yet have a `/boot` partition but allow LVMification.
In that case `NewPartitionTable` and if `/boot` was the
first (or only) customization, would LVMify the partition
which in turn would create the `/boot` partition; but after
`newPT.ensureLVM()` the call to `newPT.createFilesystem`
with `/boot` would try to create another `/boot` mountpoint.
In order to deal with this situation correctly we are now
using a two phase approach: 1) enlarge existing mountpoints
and collect new ones. 2) if there are new ones and LMVify
was allowed, switch to LVM layout. Do a second pass and now
create or enlarge existing partitions, handling `/boot` in
the process.
2022-08-08 18:05:05 +02:00
Jakub Rusz
13e287733a tests/ostree-ng: use /var/tmp/ as TMPDIR for mkkiso
Fedora is using 'tmpfs' as /tmp and that is based on the size of RAM.
That is not enough in case of medium Openstack machines. Changin to use
/var/tmp which is backed by a drive resolves this.
2022-08-08 11:32:03 +02:00
Jakub Rusz
738e6877e0 tests/ostree-rebase: split to uefi and bios
This test used to spawn two VMs at the same time which requires more
memory than the Openstack ci medium runner can provide. We want to be
using only medium runners so this change is necesasry to allow that.
2022-08-08 11:32:03 +02:00
Tomas Hozza
2d13050ba8 test/oscap.sh: provision SUT for the on-premise scenario
The PR#2695 [1] was not rebased on top of PR#2853 [2]. As a result, the
`oscap.sh` test case is provisioning the SUT in a wrong way, which makes
it fail all the time.

Provision the SUT in the test case for the on-premise scenario, since it
uses Weldr API to interact with osbuild-composer.

[1] https://github.com/osbuild/osbuild-composer/pull/2695
[2] https://github.com/osbuild/osbuild-composer/pull/2853
2022-08-05 16:15:24 +02:00
Tomas Hozza
24c52c8d69 osbuild-mock-openid-provider: support client_credentials grant type
Extend the implementation of mock openid server to take the `grant_type`
into consideration for the `/token` endpoint.

In addition to the previously supported `refresh_topen`, the
implementation now supports also `client_credentials`.

This is necessary to make it possible to use the mock server in
the `koji-osbuild` CI, because the builder plugin uses
`client_credentials` to get access token.

The implementation behaves in the following way:
 - For `refresh_token` grant type, it takes the `refresh_token` value
   from the request and adds it to the `rh-org-id` field in the custom
   claim, which is part of the returned token.
 - For `client_credentials` grant type, it takes the `client_secret`
   value from the request and adds it to the `rh-org-id` field in the
   custom claim, which is part of the returned token.

Requests without the supported `grant_type` set are rejected.

Modify affected test cases to specify `grant_type` when fetching a new
access token.
2022-08-05 16:15:24 +02:00
Gianluca Zuccarelli
53c56de88c test: add oscap tests
Add integration tests for oscap customizations.
This tests only the most basic case of oscap remediation.
Mountpoints and additional packages are not added since
this varies between distros and OpenSCAP profiles
i.e. additional blueprints customizations would need
to be specified for each oscap profile to ensure
best results.
2022-08-04 18:19:06 +02:00
Christian Kellner
7767f16e31 test/api: embed containers into the edge container
To check embedding containers via the cloud API works, embed a
known test container from our gitlab CI and check that it is
indeed embedded in the image by pulling the commit and poking
into the container storage.
2022-08-04 14:37:12 +02:00
Tomas Hozza
45850639a0 provision.sh: don't start local worker and Weldr with TLS auth
Do not start local worker (mask the unit) and Weldr API socket when
provisioning the SUT with TLS client cert authentication method. This
method is used only in the Service scenario, therefore starting these
units / sockets was not reflecting the intended deployment.

Modify `api.sh` to not rely on local worker.

Modify `base_tests.sh` to provision SUT with TLS for
`osbuild-auth-tests`, while provisioning SUT with no authentication
method for the rest of test cases.
2022-08-04 11:55:43 +02:00
Tomas Hozza
a4b0efb278 provision.sh: add none authentication method for on-premise scenario
`tools/provision.sh` is provisioning SUT always in the same way for
both, the Service scenario and the on-premise scenario. While this is
not causing any issues, it does not realistically represent how we
expect osbuild-composer and worker to be used in these scenarios.

The script currently supports the following authentication options:
- `none`
  - Intended for the on-premise scenario with Weldr API.
  - NO certificates are generated.
  - NO osbuild-composer configuration file is created.
  - NO osbuild-worker configuration file is created. This means that no
    cloud provider credentials are configured directly in the worker.
  - Only the local worker is started and used.
  - Only the Weldr API socker is started.
  - Appropriate repository definitions are copied to
    `/etc/osbuild-composer/repositories/`.
- `jwt`
  - Intended for the Service scenario with Cloud API.
  - Should be the only method supported in the Service scenario in the
    future.
  - Certificates are generated and copied to `/etc/osbuild-composer`.
  - osbuild-composer configuration file is created and configured for
    JWT authentication.
  - osbuild-worker configuration file is created, configured for JWT
    authentication and with appropriate cloud provider credentials.
  - Local worker unit is masked. Only the remote worker is used (the
    socket is started and one remote-worker instance is created).
  - Only the Cloud API socket is started (Weldr API socket is stopped).
  - NO repository definitions are copied to
    `/etc/osbuild-composer/repositories/`.
- `tls`
  - Intended for the Service scenario with Cloud API.
  - Should eventually go away.
  - Certificates are generated and copied to `/etc/osbuild-composer`.
  - osbuild-composer configuration file is created and configured for
    TLS client cert authentication.
  - osbuild-worker configuration file is created, configured for TLS
    authentication and with appropriate cloud provider credentials.
  - Services and sockets are started as they used to be originally:
    - Both local and remote worker sockets are started.
    - Both Weldr and Cloud API sockets are started.
    - Only the local worker unit will be started automatically.
  - NO repository definitions are copied to
    `/etc/osbuild-composer/repositories/`.
2022-08-04 11:55:43 +02:00
Tomas Hozza
7c73861c22 test/koji.sh: use JWT authentication method
Modify the `koji.sh` test case and `tools/koji-compose.py` to use JWT
authentication method. This better mimics the production deployment.
2022-08-04 11:55:43 +02:00
Tomas Hozza
0891b6b3d7 test/koji.sh: don't copy keytab to /etc/osbuild-composer
There is no need to copy the client kerberos keytab to the
`/etc/osbuild-composer` directory. Composer does not need nor use this
file at all.
2022-08-04 11:55:43 +02:00
Tomas Hozza
4b96a79935 test: add functions variant usable with JWT without providing ORG ID
Common integration tests should not need to care about specific ORG ID
configured in the worker, but they should be able to get access token
and check compose status without providing a specific ORG ID. The only
integration test that should care about ORG ID is the
`multi-tenancy.sh`.

Modify the `access_token` and `compose_status` functions to hide the
existence of ORG ID from the user and instead read it from the worker's
configuration, specifically `/etc/osbuild-worker/token`.

The original implementations of the functions mentioned above are now
available under `access_token_with_org_id` and
`compose_status_with_org_id` names.

Modify the `multi-tenancy.sh` to use the new function names.
2022-08-04 11:55:43 +02:00
Tomas Hozza
765d218b6f test: extract common JTW code from the multi-tenancy.sh test
Move some code related to using JWT tokens from the `multi-tenancy.sh`
test case to `test/cases/api/common/common.sh`, `tools/provision.sh`
and `tools/run-mock-auth-servers.sh`. Move the composer and worker
configuration from the test to new testing configuration files.

The `tools/provision.sh` now accepts an optional argument specifying the
authentication method to use with the provisioned composer and workers.
Valid values are `tls` and `jwt`. If no argument is specified, the `tls`
option is used and the script defaults to its previous behavior.
2022-08-04 11:55:43 +02:00
Alexander Todorov
d176df2ca5 Update test/cases/ostree-ng.sh
Co-authored-by: Jakub Rusz <55534579+jrusz@users.noreply.github.com>
2022-08-04 10:37:16 +02:00