Commit graph

59 commits

Author SHA1 Message Date
Mario Cattamo
9164c9a8dd test: update osname for edge deployments 2024-05-14 21:12:36 +02:00
Alexander Todorov
85ce42570d Refactor how the 'trap' command is used to avoid double calls
in many files there was a secondary call to `trap` for the sole purpose
of killing jornalctl (watching worker logs) so that GitLab CI doesn't
hang.

The issue with this is that sometimes the cleared the trap which invokes
the cleanup() function without reinstating it again (not everywhere).

Instead of doing this back-and-forth just make sure we don't leave any
journalctl processes dangling in the background!

NOTES:

- for some scripts, mainly ostree- ones there was no cleanup trap
  present, but instead `trap` was configured inside the build_image() function.
  The trouble is that this function is executed multiple times and
  $WORKER_JOURNAL_PID changes value between these multiple executions.
  That's why these scripts introduce the cleanup_on_exit() function where
  we make sure to kill any possible dangling journalctl processes.
- The name `cleanup_on_exit()` is chosed because these same scripts
  often have a helper function named clean_up() which is sometimes used to remove
  virtual machines and other artifacts between calls of build_image().
2024-04-19 13:16:11 +03:00
Tom Koscielniak
b4dcfc4480 Remove libvirt workaround 2024-03-04 15:39:08 +01:00
Miguel Martín
38f9687cc1 Clean up libvirt network
Clean up libvirt network once the script has
finished successfully.
2023-12-13 10:19:47 +01:00
Miguel Martín
53955af7ca Do not run set-env-variables.sh
Do not run `set-env-variables.sh` to set ARCH and OS variables
to avoid the CI failing because of shellcheck lint problems.

Signed-off-by: Miguel Martín <mmartinv@redhat.com>
2023-12-13 10:19:47 +01:00
Miguel Martín
20c8892ec9 Do not harcode user's password hash in scripts
Generate user's password hash based on `EDGE_USER_PASSWORD`
variable instead of hardcoding it

Signed-off-by: Miguel Martín <mmartinv@redhat.com>
2023-12-13 10:19:47 +01:00
Miguel Martín
a0d357c66b Enable FIPS tests
Make it possible to test if system FIPS mode has been enabled
in the resulting images by running the scripts with a FIPS="true"
environment variable

Signed-off-by: Miguel Martín <mmartinv@redhat.com>
2023-12-13 10:19:47 +01:00
Alexander Todorov
f2f1c8d0f0 Remove deprecated --os-type cli argument
test logs print:

[2023-08-22T10:18:14-04:00] 💿 Install image via installer(ISO) on VM
WARNING  --os-type is deprecated and does nothing. Please stop using it.
2023-09-01 13:22:30 +02:00
Xiaofeng Wang
37faf0d929 test: run greenboot rollback test on ostree.sh, ami and vsphere
Do not need to run greenboot rollback test on all tests to save
some time
2023-08-14 11:12:14 +02:00
Brian C. Lane
4c7b3dd25a test: Make log errors easier to find
We were using greenprint for failures, which makes it hard to quickly
find where the tests failed. This switches errors to use redprint, and
adds it to places that were simply using echo before doing an exit 1.
2023-08-02 14:46:35 +02:00
Xiaofeng Wang
967570a2a6 test: Add workaround for BZ#2213660 and #2225667 2023-07-26 22:23:41 +08:00
Xiaofeng Wang
2baaa20859 test: Four fixes for RHEL for Edge tests
1. Remove ansible-blocking-io.py workaround. It's not required.
2. Variable should be PROD_REPO_URL, not STAGE_REPO_URL in
ostree-raw-image.sh
3. Use --reboot in rpm-ostree install to reboot VM instead of
a reboot ansible task
4. Wait until config file serviceinfo_api_server.yml exists, to
avoid file not available to use flaky issue
2023-06-30 09:07:39 +08:00
Xiaofeng Wang
dda50003cb test: Remove ostree-rebase-bios/uefi.sh and add rebase test into
ostree-raw-image.sh and ostree-simplified-installer.sh

Don't need dedicated rebase test workflow, move rebase test into
other test script. That will save runner and reduce running time

Add BIOS rebase test in ostree-raw-image.sh
Add UEFI rebase test in ostree-simplified-installer.sh
2023-06-26 12:33:36 +02:00
Xiaofeng Wang
cf27954a0d test: Move ignition test out of simplified installer test
1. Remove ignition test from simplified installer and raw image
2. Use a new test job for ignition test
3. Add ignition test for raw image
2023-06-20 17:12:14 +08:00
Alexander Todorov
1f28e50d21 Adjust tests for new distros
References:
- https://redhat-internal.slack.com/archives/C0235DZB0DT/p1685528139831589
- 1fbd9d975f
2023-06-15 08:54:57 +02:00
Xiaofeng Wang
49bad21c45 CI: Move RHEL for Edge CI into osbuild/rhel-edge-ci repo
1. Run RHEL for Edge CI on osbuild/rhel-edge-ci repo
2. Use released RHEL 8.8 and 9.2 boot ISO
3. Extend VM memory to 3072 on ostree.sh to fix error
"Overriding memory to 3072 MiB needed for centos-stream9 network install."
4. Install and start firewalld, configure VM network as trusted zone
2023-06-12 10:00:23 +02:00
Tomáš Hozza
bf377d81c1 Test/ostree-raw-image: test dirs and files customizations
Extend the `ostree-raw-image.sh` to use the directories and files
customizations for the raw image and test their effect using the ansible
playbook.

Custom files and directories are currently tested only on Fedora,
because they are allowed by policy only there.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
Tomáš Hozza
34c1594216 Test: reformat parts of ostree-raw-image.sh
Break the execution of `ansible-playbook` into multiple lines to make it
easier to read.

Add a comment on top of the second `ansible-playbook` execution if
Ignitions is availble, explaining what differs. Otherwise this is hard
to spot.

There are 3 places in the script, where there are always 2 executions of
the `ansible-playbook`. First the user from the BP is used. On the
second run, the user created by Ignition is used. This was not the case
for the last 2 executions of `ansible-playbook` at the end of the
script. Adjust the order for consistency with the rest of the script.

The changes should have no effect on the test case.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-22 16:30:14 +02:00
yih
d7e2e5d740 add sysroot permission test 2023-03-09 18:54:06 +08:00
yih
266cfdcc44 fix ansible error on centos9 2023-03-02 16:03:11 +01:00
Antonio Murdaca
5ab00987cd test/cases: add ignition test to edge-raw-image
Signed-off-by: Antonio Murdaca <antoniomurdaca@gmail.com>
2023-02-07 13:30:22 +01:00
Achilleas Koutsou
c049499322 test: use kernel-rt-core in ostree tests for CS8 2023-01-18 11:50:35 +01:00
Alexander Todorov
a8df4879ac Adjust tests for 8.8 and 9.2 2023-01-10 00:28:23 +01:00
Antonio Murdaca
6d15dc144c distro/rhel: make edge images properly sysroot.readonly=true
Make edge raw images (both the raw image type and the same in the edge
simplified installer) mount the /sysroot as read-only.  This was already
done in Fedora 37+ (547f7a66b3).

Copied commit message from 6f89e9d499 to a
comment in all places where the accompanying "rw" kernel option is set
explaining the requirement, since the option is counter-intuitive.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Signed-off-by: Antonio Murdaca <antoniomurdaca@gmail.com>
Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-12-13 13:24:20 +01:00
Xiaofeng Wang
f732af9e8b test: Do not enable UEFI secure boot on CS9 2022-11-25 03:47:30 +01:00
Achilleas Koutsou
55b1e2b6ee test: only set boot args in virt-install version condition
Make it clearer that the only difference between the two cases are the
arguments for --boot.
2022-10-11 10:00:22 +02:00
Achilleas Koutsou
58eeb74c98 test: update raw image script to skip BIOS boot on Fedora 2022-10-11 10:00:22 +02:00
Achilleas Koutsou
1d121126b0 test: use new canonical image type names in tests 2022-09-20 18:29:28 +02:00
Xiaofeng Wang
434362e81e test: User in commit will not be support after osbuild-composer 64
After osbuild-composer 64, user should be configured in raw-image
blueprint
2022-09-20 12:54:55 +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
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
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
Jakub Rusz
efbd5ebd7b ci/tests: Change the way artifacts are collected
We want to be able to safely gather any artifacts without worrying about
any possible secrets leaking. Every artifacts that we want to upload
will now have to be placed in /tmp/artifacts which will then be uploaded
to S3 by the executor and link to the artifacts will be provided in the
logs. Only people with access to our AWS account can see them.
2022-07-18 11:33:57 +03:00
Xiaofeng Wang
9a66ffa78b test: Install package sssd in all edge images for BZ#2088459 2022-07-16 16:14:56 +02:00
Jakub Rusz
5fcf0b1d53 tests/ostree: Update to support new RHEL nightlies 2022-06-21 10:40:58 +02:00
Achilleas Koutsou
a087fc5c86 test/cases: use correct OS_VARIANT for CentOS Stream 9
Correct name is 'centos-stream9'
See 'osinfo-query os'
2022-02-18 10:39:08 +00:00
Christian Kellner
b18b4e80a0 distro/{rhel86,rhel90}: specify a remote for deployments
When deploying an ostree commit, specify a remote, currently hard-
coded to `rhel-edge`, so that updates work automatically, if they
are served from the same location as the initial commit is pulled
from.

NB: now that the remote is specified in the raw image, remove the
corresponding bits form the tests.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-11 12:30:44 +01:00
Sanne Raymaekers
1a6f6fdc4b test: Drop ANSIBLE_STDOUT_CALLBACK
There's conflicting ansible versions in the 86 nightlies and epel. There
should be a correct combination of plugins which fixes the callback on
86. But let's drop it to unblock for now.
2022-02-03 00:24:59 +01:00
Jakub Rusz
5eb8709a18 tests: add sudo to get_metadata function
With new weldr-client package the metadata tar archive created has
permissions set to 600 instead of 644 which causes permission failures
when interacting with it. Adding sudo to resolve that.
2021-12-08 12:12:53 +01:00
Xiaofeng Wang
85df63ce52 test: Use YAML as Ansible output format 2021-11-12 14:43:55 +01:00
Xiaofeng Wang
ab3712fd92 test: Update ostree test scripts to support different ostree refs 2021-11-11 12:11:01 +01:00
Achilleas Koutsou
8ef0cfe618 test/cases: support weldr-client output structure
Using get_build_info() function in all scripts where both composer-cli
and weldr-client need to be supported for consistency.
2021-11-10 14:54:31 +01:00
Achilleas Koutsou
2f30823b41 test/ostree: install python3 instead of specific version
Better cross-distro compatibility

Same as bdc428fbb7 but for all the tests.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-11-10 14:54:31 +01:00