Commit graph

156 commits

Author SHA1 Message Date
Tom Koscielniak
93684fcef9 tests: Improve logging in api.sh test
Add compose request output print in case of failure.
2025-06-03 17:06:52 +02:00
Tomáš Hozza
7036e2bcb9 Many: expose rhsm.subscription_manager.rhsm.auto_enable_yum_plugins
Expose the ${SUBJ} customization in Cloud API. Weldr API inherited it
automatically with the update of `osbuild/blueprint` to v1.6.0.

Adjust relevant test cases and unit tests to use this new customization.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-04-29 18:22:40 +03:00
Sanne Raymaekers
d08cedf73b test/cases/api: add modules 2025-03-20 14:07:52 +01: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
Lukas Zapletal
d531f62488 blueprint: add cacert customization 2025-01-10 10:26:54 +01:00
Achilleas Koutsou
c9e412f320 test: enable ignore_missing_repos in service configs 2024-11-05 08:21:42 +01:00
Jakub Rusz
ec4aff7e58 test/cases: Use openscap customization on RHEL-10 2024-09-25 08:30:45 +02:00
Sanne Raymaekers
a6b87b58f2 test/api: check openscap facts when appropriate 2024-09-06 11:39:35 +02:00
Tomáš Hozza
725c5cdb25 test/api.sh: disable rpm customization on el10/c10s
The reason is that the key that we use to test the customization uses
SHA-1 in its signature. And this algorithm is no longer allowed by
default on el10 / c10s.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-13 15:52:44 +02:00
Tomáš Hozza
768537dba3 Add support for RHSM customizations
Add support for RHSM customizations, which currently allow various
aspects of RHSM. Specifically enabling / disabling DNF plugins shipped
by subscription-manager package and setting a subset of options in the
rhsm.conf.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-13 15:52:44 +02:00
Tomáš Hozza
26dd54a4d7 Add support for RPM customizations
Add support for RPM customizations, which currently allow to import RPM
GPG key from a file installed in the image. This is e.g. done for the
Azure RHUI image type.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-08-13 15:52:44 +02:00
Jakub Rusz
b3fc3919ca tests/api: add --net=host for podman command
Otherwise there are issues on el-10.
2024-08-12 08:39:05 +03:00
Jakub Rusz
ce9b75ac87 tests/api: Remove openscap profile for el-10
Currently there are no openscap profiles for el-10.
2024-08-12 08:39:05 +03:00
Achilleas Koutsou
769b04b862 test/api: silent dump_db()
When cleaning up api tests, the build job results are dumped from the
database to store in build-result.txt and are printed to the runner log
at the same time.  This makes it very difficult to read results as the
database dump prints very long lines that flood the job log.  The result
isn't really readable (or useful) unless the file is downloaded
separately.

Silence the `tee` command so that the file is created but no output is
printed from the db dump.
2024-07-29 15:05:15 +02:00
Sanne Raymaekers
899360f200 test/cases/api: fix nginx url
This snapshot got deleted as well.
2024-06-28 12:02:24 +02:00
Simon Steinbeiss
bdc973d085 test/api.sh: Drop distro aliases and dot-notation
This reverts commit 2fe5e01d4d with the
exception of the changes in tools/provision.sh.
This functionality is covered by unit tests in osbuild/images:
aaa53adc3c/pkg/distrofactory/distrofactory_test.go (L9)
2024-03-06 13:28:30 +01:00
Achilleas Koutsou
76a699653a test: add iot-bootable-container to api tests
The image type supports uploading to both s3 and container registries.
Right now we only care about getting it in Koji, so let's just add it to
the s3 upload section.

The container registry test also embeds containers in the image, which
the iot-bootable-container doesn't support (yet).
2024-02-02 10:34:41 +01:00
Tomáš Hozza
2fe5e01d4d Test/api.sh: test distro aliases and names without dot-notation
Extend the `api.sh` to allow testing compose requests with distro name
which does not use dot-notation (specifically when the dot is removed
from the distro name as it used to be in the past). In addition to that,
allow also testing the distro alias using distro name without the minor
version in compose requests.

Enable these two new test variants in the CI.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
66571784d1 Use dot-notation for repo configs and in test cases.
Where applicable, modify all repo config filenames to use a dot
to separate the release major and minor version. Modify test cases
to not remove dot from the distro version any more.

Existing tests will be extended (or new tests added) to explicitly test
backward compatibility and ensure that using old distro names without a
dot still works.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
c82c0ae6b5 Test/api.sh: pass TEST_MODULE_HOTFIXES as an env variable
While I was the one to push for TEST_MODULE_HOTFIXES to be passed as an
argument to `api.sh`, when it was implemented, this is turning our to be
impractical. I would like to extend `api.sh` to test distro names with
and without the dot to separate major and minor version and also to test
the ability to specify distro name explicitly (e.g. a distro alias).
Passing all of these new options and their combinations would make the
CLI go wild.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Ondrej Ezr
d5483ccfb0 test: Add nginx to the image request 2023-12-20 09:02:06 +01:00
Achilleas Koutsou
901393d791 test/api: add some greenprints 2023-11-17 16:48:16 +01:00
Achilleas Koutsou
894c7046d9 test: compare upload_statuses[0] with upload_status
Check that the first element of the upload_statuses array matches the
top-level upload_status.
We only test one upload target for now.
2023-11-17 16:48:16 +01:00
Sanne Raymaekers
0a255df1ca cloudapi/v2: add all existing customizations to openapi spec 2023-10-11 17:29:56 +02:00
Sanne Raymaekers
1e7e1308ab test/cases/api: don't print command traces
Causes some secrets to be dumped into the logs.
2023-09-19 22:57:06 +02:00
Sanne Raymaekers
522a54188a test/api: add oci test 2023-09-19 22:57:06 +02:00
Gianluca Zuccarelli
0311ef449d test/cases: OpenSCAP cloudapi tests
Run a basic check to see that the tailoring file has been created when
adding tailoring rules to the OpenSCAP config. Since the OpenSCAP scan
requires more memory and breaks some of the API tests, a full scan is
not run in the cloudapi tests.
2023-09-18 20:46:49 +02:00
Diaa Sami
cb0734145d remove old prometheus listener 2023-07-19 10:56:36 +02:00
Sanne Raymaekers
ebe43bd680 test/cases/api: use the request_count metric
In future it will be possible to drop the total_compose_requests metric
in favour of the request_count metric.
2023-06-28 15:08:37 +02:00
Diaa Sami
8398f27742 internal/cloudapi: additional prometheus listener
Listening on another port, while keeping the existing endpoint until
transition is complete
2023-06-07 17:05:32 +02: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
Gianluca Zuccarelli
1c25d2792c tests/api: custom repository tests
- remove `custom-repos.sh` integratoin test
- add custom repositories check to `api` tests for supported
  images
- verify custom repositores are added to /etc/yum.repos.d
- verify gpg key is saved to /etc/pki/rpm-gpg (for inline keys)
2023-04-26 14:16:16 +01:00
Tomáš Hozza
c528948b71 Test/API: use directories and files customization for supported images
Use directories and files customization in the compose request for image
types that support this customization (only ostree installer and raw
image do not support it).

Extend the instance verification to check for the custom directories and
files.

Extend the ostree commit verification to check for the custom
directories and files.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-02-22 12:17:36 +01:00
Sanne Raymaekers
07a8f3d5ea test: adapt to shellcheck v0.9.0 2022-12-13 13:55:53 +01:00
Brian C. Lane
d73171fdde Use go install instead of deprecated go get
In go 1.18 'go install' needs to be used to install an executable. See
https://go.dev/doc/go-get-install-deprecation and
https://go.dev/doc/manage-install
2022-11-09 12:08:43 +01:00
Tom Gundersen
626530818d worker/server: requeue unresponsive jobs
If a job is unresponsive the worker has most likely crashed or been shut
down and the in-progress job been lost.

Instead of failing these jobs, requeue them up to two times. Once a job is lost
a third time it fails. This avoids infinite loops.

This is implemented by extending FinishJob to RequeuOrFinish job. It takes a
max number of requeues as an argument, and if that is 0, it has the same
behavior as FinishJob used to have.

If the maximum number of requeues has not yet been reached, then the running
job is returned to pending state to be picked up again.
2022-11-02 15:26:00 +01:00
Sanne Raymaekers
8fdd158799 cloudapi/v2: use the ostree resolve job to resolve ostree refs 2022-10-19 18:14:10 +02:00
Achilleas Koutsou
632f371a08 test: add iot-commit to api tests by name 2022-09-20 18:29:28 +02:00
Tomáš Hozza
2f6c238b7a test/cases/api.sh: fix indentation 2022-09-19 10:37:32 +02: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
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
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
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
Ygal Blum
1847a6ae05 tests/api: add container related test
Add a new cloud API test that will build an edge-container,
upload it to the gitlab CI registry, fetch it from there,
run it and compare that the OSTree commit contained in it
is indeed the one we expect.

Co-Developed-By: Christian Kellner <christian@kellner.me>
2022-08-01 21:50:03 +01: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
Sanne Raymaekers
339d69d2da test/api: Add gcloud and generic s3 changes to split api tests
- Fixed shellcheck errors
- Moved checkEnv from common to individual tests
- Fixed package install section in spec file:
Globs which include a directory fail on el-like distros.
- Use gcloud cli to ssh
- (re)Introduce generic s3 tests
2022-07-05 12:15:31 +02:00
Ondřej Budai
cb7c0283a5 test/api: split into smaller files
Each cloud now has its own file that's sourced on-demand by the main api.sh
script. The main goal of this commit is to reduce the amount of clutter in
api.sh. I, personally, find 1300 lines of bash overwhelming and I think that
this is a reasonable beginning to start cleaning things up.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-05 12:15:31 +02:00
Juan Abia
8f9bb1bc01 tag azure resources with gitlab-ci-test
cloud cleaner removes old enough resources with 'gitlab-ci-test' tag.
2022-06-30 13:46:15 +02:00
Tomas Hozza
09f57b6c2f api.sh: fix requesting of JWT token
`osbuild-mock-openid-provider`'s `/token` endpoint expects URL-encoded
values in the POST request body. Use the same values as those that would
be used by the worker when refreshing a token.
2022-06-10 14:48:18 +01:00
Ygal Blum
feb357e538 Support Generic S3 upload in Composer API
Use case
--------
If Endpoint is not set and Region is - upload to AWS S3
If both the Endpoint and Region are set - upload the Generic S3 via Weldr API
If neither the Endpoint and Region are set - upload the Generic S3 via Composer API (use configuration)

jobimpl-osbuild
---------------
Add configuration fields for Generic S3 upload
Support S3 upload requests coming from Weldr or Composer API to either AWS or Generic S3
Weldr API for Generic S3 requires that all connection parameters but the credentials be passed in the API call
Composer API for Generic S3 requires that all conneciton parameters are taken from the configuration
Adjust to the consolidation in Target and UploadOptions

Target and UploadOptions
------------------------
Add the fields that were specific to the Generic S3 structures to the AWS S3 one
Remove the structures for Generic S3 and always use the AWS S3 ones

Worker Main
-----------
Add Endpoint, Region, Bucket, CABundle and SkipSSLVerification to the configuration structure
Pass the values to the Server

Weldr API
---------
Keep the generic.s3 provider name to maintain the API, but unmarshel into awsS3UploadSettings

tests - api.sh
--------------
Allow the caller to specifiy either AWS or Generic S3 upload targets for specific image types
Implement the pieces required for testing upload to a Generic S3 service
In some cases generalize the AWS S3 functions for reuse

GitLab CI
---------
Add test case for api.sh tests with edge-commit and generic S3
2022-06-02 16:12:53 +03:00