Commit graph

48 commits

Author SHA1 Message Date
Irina Gulina
6f4c2899f8 remove workaround for CLOUDX-994 2025-04-25 13:42:27 +02:00
Tomáš Hozza
2bc27d2d85 Many: replace 'which' with 'type -p' in test cases
Unfortunately, `which` does not seem to be installed by default on our
F41 CI images. Instead of doing the dance with rebuilds, which has been
problematic recently, let's not rely on `which` in scripts any more,
since we can replace it with the Bash built-in `type` command.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-01-30 07:48:44 +01:00
Jakub Rusz
306772aafa tests/CI: additional scheduling and loggin updates
Do not schedule gcp.sh on rhel-10 and centos-stream-10. Also improve
loggin for aws.sh and azure.sh as the cloud-image-val testing is
currently not preformed there.
2024-08-12 08:39:05 +03:00
Alexander Todorov
f1ac9cc7a0 Disable cloud-image-val because of CLOUDX-994 2024-08-12 08:39:05 +03:00
Alexander Todorov
0f2558d72e Use --net=host when running podman, workaround RHEL-32374 2024-08-12 08:39:05 +03:00
Nicolás M
80a782caac Added arch and storage_account, needed by CIV to deploy the resources without having to check for vhd uri regex.
The regex check is now not needed since we create other shared image metadata on the fly. Plus it was not a good solution for an upstream project, as the regex was only affecting our RH teams internally.
2024-07-08 21:48:26 +09: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áš Hozza
9252e2525c Test/azure.sh: don't use dot-notation for image name
Using the DISTRO_CODE with dot to separate major and minor version is
breaking cloud-image-val testing. Specifically, the tool is using
regular expression to search for an uploaded image, but the expression
is not expecting any dot in the version.

This will be fixed in [1], but merging it will take some time due to CIV
CI being currently broken. Due to this, workaround the problem for now
by making sure that the TEST_ID, which is used to construct the
IMAGE_NAME, does not contain any dot in the DISTRO_CODE.

[1] https://github.com/osbuild/cloud-image-val/pull/290

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Nicolás Muñoz
a693928b7a Added hyper_v_generation metadata to the instance used by CIV.
This will allow us to define which HyperV generation to use when
creating the image on the fly.
2023-11-01 11:40:55 +01: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
Alexander Todorov
b6cd24e3c0 Add temporary workaround for CLOUDX-488
https://redhat-internal.slack.com/archives/C0235DZB0DT/p1686812091343739
2023-06-15 20:15:19 +02:00
jabia99
7224c896b6 Pass JIRA_PAT env variable to container 2023-05-15 12:18:40 +03:00
Sanne Raymaekers
c7d2eaa5f7 test: use non-deprecated gitlab CI variables
CI_BUILD_ID was replaced with CI_JOB_ID in gitlab 9+.
2023-05-12 11:02:49 +02:00
Juan Abia
e3594f7234 Start using CIV config file
This way, all CIV parameters can be provided from a file stored in
gitlab secrets without the need to change the script.
2023-03-24 23:10:55 +01:00
Juan Abia
06d83d3c07 Change civ repo name 2023-03-21 11:56:57 +01:00
Juan Abia
a761184725 Modify CIV options
With the previous method of passing options, we encountered some
problems when sending the options via an array.
2023-02-28 10:26:01 +01:00
Juan Abia
197cd47e0b test/cases: move CIV options into a variable
In order to provide different options when running CIV from it's own CI,
move them to the variable CIV_OPTIONS
2023-02-15 17:23:35 +01:00
Sanne Raymaekers
07a8f3d5ea test: adapt to shellcheck v0.9.0 2022-12-13 13:55:53 +01:00
Juan Abia
34b1be2bf4 test: get correct CIV tag in azure.sh
In order to run azure.sh inside CIV CI, we need to use the appropiate
tag. This means getting `prod` tag when running in osbuild-composer and
the pr tag when running in cloud-image-val
2022-10-04 15:54:38 +02:00
Juan Abia
f0b212e18a test: add CIV tool to azure.sh
CIV (Cloud-Image-Val) is an image validation tool with a big test suite.
This are basic tests. By incorporating this tool is osbuild-composer CI,
we can catch bugs in our images and our tools earlier.
2022-09-28 11:49:14 +02: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
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
Achilleas Koutsou
cd49c932a2 test: add prominent message in test script cleanup functions
When a test script fails in CI, it's often difficult to pinpoint the
exact line in the log where the script failed and the cleanup() function
(trapped on EXIT) begins.

Adding a prominent line (with greenprint where available) at the start
of the cleanup function will make reading logs of failed jobs a lot
easier.
2022-05-25 22:10:27 +02:00
Juan Abia
4c5de045ff test: add test purpose
Most test scripts don't have any documentation regarding it's purpose,
although it can be guessed by the code. There's value in adding this
small comment.

[skip-ci]
2022-03-09 22:46:25 +01:00
Juan Abia
786fc2719d test: make test more resilient
During manual cleanup of unused resources, the storage account can get
removed. The current storage account is not possible to remove
mannually, but adding this check to make it more resielient in future
scenarios.
2021-12-17 16:05:35 +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
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
aea77ed3de test: timestamp messages in test scripts
The commonly used 'greenprint' function now adds a date + timestamp to
each message for debugging and tracking the duration of segments of each
scripts.
2021-10-24 16:13:53 +01:00
Ondřej Budai
58423c262b ci: rotate secret names
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-10-21 07:28:46 +02:00
Ondřej Budai
4c5d1ae45a test: move env variables into set-env-variables helper
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-09-24 17:03:53 +02:00
Tomas Hozza
8c9045a216 Test: use cloud-tools container in azure.sh
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-02 11:55:25 +02:00
Jakub Rusz
605a4ea80f tests: workaround for terraform installation on RHEL-9
There is currently no hashicorp repository for RHEL-9 so fallback to
using RHEL-8 version instead.
2021-09-02 11:55:25 +02:00
Jakub Rusz
09a576ed07 tests: update azure.sh and aws.sh for use with weldr-client
This enables the tests to run with both original composer-cli and the new
weldr-client.
2021-09-02 11:55:25 +02:00
Ondřej Budai
7a298c838b tests: remove all disabling conditions for RHEL 9.0
RHEL 9.0 isn't yet in .gitlab-ci.yml so this actually doesn't change in test
runs but it should make enabling of the tests easier.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-17 16:54:22 +02:00
Juan Abia
c4fa4e4bb7 test: Replace hard coded ssh keys on some test
Generate a new ssh key each time. Only implemented on bash test scripts,
go tests pending.
2021-07-29 09:38:03 +03:00
Achilleas Koutsou
47ae5de5c0 test/cases: stop the spread of the tet typo
Hoping this is the end of this viral typo.
2021-07-24 15:54:00 +02:00
Jakub Rusz
ab3234260a tests: fix wrong default value in azure.sh test
It's not possible to create vm with the single quotes in the name.
Removing it to enable running locally.
2021-07-16 10:59:15 +02:00
Jakub Rusz
1b5ca0f163 tests: make azure.sh easier to run locally
We've dropped Jenkins already and this change helps by setting
CI variables to a default value in case they're not present.
2021-07-09 19:52:52 +01:00
Alexander Todorov
1eb51b7bab Test Azure images on HyperV Gen1 and Gen2
Related: rhbz#1896264
2021-06-22 13:44:19 +03:00
Ondřej Budai
bc1a7dc30c tests: fix journalctl killing once again
3a8c6c8a introduced a new logic for killing journalctl. Unfortunately, it
doesn't work properly. In ostree tests, multiple journalctls are spawned
but there can be only one trap active at a time. This caused all but the last
journalctls to hang indefinitely. Unfortunately, hanging background processes
is something that causes the GitLab CI to hang indefinitely as well.

This commit modifies the logic a bit: The trap is still set. However, there's
also an explicit kill of journalctl after the compose is finished. After the
process is successfully killed, the trap is removed.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-06-10 07:40:36 +02:00
Alexander Todorov
2cabaa5477 tests: Use CI_BUILD_ID, not CI_PIPELINE_ID. Fixes #1448
PIPELINE_ID is the same across different jobs running in the same
pipeline while BUILD_ID is unique for every job.

Note: In the case where we have 1 test script/runner
CI_BUILD_ID == CI_JOB_ID
2021-06-08 09:07:43 +02:00
Jakub Rusz
3a8c6c8ab8 tests: kill journalctl even if compose fails
This prevents Gitlab CI from getting stuck if something
goes wrong with the compose.
2021-06-04 14:18:11 +03:00
Jakub Rusz
8dcf859473 tests: move some integration tests to gitlab CI
This also includes several modifications to tests scripts to
enable them running in gitlab CI.
2021-05-12 15:38:30 +03:00
Jakub Rusz
e613b2456b tests: modify DISTRO_CODE usage
Set DISTRO_CODE if unset for gitlab CI
2021-05-12 15:38:30 +03:00
Jakub Rusz
06361267d5 Add image boot testing in Azure
This uses an image created and uploaded to Azure using composer-cli
and then terraform to spin up a linux vm from that image, check
if the machine works and then cleans up everything.
2021-05-05 12:05:32 +03:00