Commit graph

3615 commits

Author SHA1 Message Date
Ondřej Budai
37181eb995 templates/composer: add tenant_provider_fields
account_id is for https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token

rh-org-id is for https://identity.api.openshift.com/auth/realms/rhoas/protocol/openid-connect/token

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
d2d70c1e95 cloudapi: add multi-tenancy test
This commit adds a very in-depth test for multi-tenancy. It queues several
composes and then runs all jobs belonging to them while checking that
they are run by the correct tenant.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
ad5a135b56 internal/test: add small library for tests
Yeah, we have TestRoute. It has one issue though: It doesn't have support
for passing a custom context. One option is to extend the method with yet
argument but since it already has 9 (!!!), this seems like a huge mess.

Therefore, I decided to invent a new small library for writing API tests.
It uses structs heavily which means that adding features to it doesn't
mean changing 100 lines of code (like adding another arg to TestRoute does).

I hope that we can start using this library more in our tests as it was
designed to be very flexible and powerfule.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
ffbbd022e3 cloudapi/test: make newV2Server return also the queue
We will need this for the multi-tenancy test.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
bafb613a43 cloudapi/test: add option to enable JWT
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
4a9812be2e cloudapi/test: add option to specify depsolve channels to test server
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
2d16aeb467 tests: add an E2E test for multi-tenancy
See the comment. It's imho still very important to have this test
but its powers are limited.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
299264f178 test/koji: install podman-plugins everywhere
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
cfb756b9ba api/{cloud,worker}: used channel name based on JWT claims for new jobs
This commit implements multi-tenancy. A tenant is defined based on a value
from JWT claims. The key of this value must be specified in the configuration
file. This allows us to pick different values when using multiple SSOs.

Let me explain more in depth how this works:

Cloud API gets a new compose request. Firstly, it extracts a tenant name from
JWT claims. The considered claims are configured as an array in
cloud_api.jwt.tenant_provider_fields in composer's config file. The channel
name for all jobs belonging to this compose is created by `"org-" + tenant`.

Why is the channel prefixed by "org-"? To give us options in the future. I can
imagine the request having a channel override. This basically means that
multiple tenants can share a channel. A real use-case for this is multiple
Fedora projects sharing one pool of workers.

Why this commit adds a whole new cloud_api section to the config? Because the
current config is a mess and we should stop adding new stuff into the koji
section. As the Koji API is basically deprecated, we will need to remove it
soon nevertheless.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
33a310e4e1 osbuild-mock-openid-provider: use offline token as org id
This is quite a hack. Basically, the mock provider copies the offline token
into rh-org-id JWT claim. This allows us to test multi-tenancy.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
c1dc58eba4 worker: NewServer: move config parameters to a new Config struct
We will have more parameters soon so let's make this prettier sooner rather
than later.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
9feb7b59d6 clouadpi: NewServer: move awsBucket parameter to a new ServerConfig struct
We will have more parameters soon so let's make this prettier sooner rather
than later.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
2765d2d9a8 jobqueuetest: add a test for multiple channels
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
32080e6202 jobqueuetest: modify testArgs to test also channels
jobqueue.Job must return the channel specified in jobqueue.Enqueue during
the whole lifecycle of the given job.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
4c31b04a65 jobqueuetest: add channel arg to the pushTestJob helper
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Ondřej Budai
7bfcee36f8 jobqueue: introduce the concept of channels
Channels are a concept similar to job types. Callers must specify a channel
name when queueing a new job. A list of channels is also specified when
dequeueing a job. The dequeued job's channel will always be from one of the
specified channel. Of course, the job types are also respected. The dequeued
job will also always be from one of the specified type.

Currently, all calls to jobqueue were changed so all queue operations use
an empty channel name and all dequeue operations use a list containing
an empty channel.

Thus, this is a non-functional change.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-08 12:07:00 +01:00
Jakub Rusz
ba4f49078a ci: skip CI for draft and WIP PRs
Let only the init stage run so that we have a link on PRs to the CI and
can trigger it manually if desired. PR template updated with this info.
Also use yaml anchors for rules to reduce duplication.
2022-03-08 11:53:09 +01:00
Jakub Rusz
ae07093404 tests/image-tests: filter out cases with ostree URL
These tests depend on external dependencies which are difficult to setup
during image-test like http ostree repository. See
https://github.com/osbuild/osbuild-composer/pull/2389#issuecomment-1060338127
for more details.
2022-03-08 09:23:05 +01:00
Xiaofeng Wang
e147e41879 test: Fix COMPOSE_URL issue and add set-env-variables.sh 2022-03-08 09:23:05 +01:00
Jakub Rusz
485fc68a98 tests/upgrade: add user choice for vdo devices check
This is a user choice that has to be picked before the upgrade or it
acts as an inhibitor.
2022-03-08 09:23:05 +01:00
Jakub Rusz
ec93130a30 schutzbot/prepare-rhel-internal: update repository gpgkey
SHA-1 key is no longer supported, update it with a new one from
redhat-release. Related rhbz#2058497
2022-03-08 09:23:05 +01:00
Sanne Raymaekers
55b78bbd36 templates/packer: Remove -u flag from creds mapping script
We test if specific variables are set, and -u interferes with that.
2022-03-07 17:11:54 +01:00
Diaa Sami
e15998ced7 koji: add HTTP retries for uploads & init/finalize
and log number of retries for trackability
Fixes #2335
2022-03-06 11:04:37 +01:00
Christian Kellner
8c8f6f2cd5 spec: bump osbuild requirement to version 52
Needed due to the new `gpgkeys.fromtree` option in `org.osbuild.rpm`.
Pin osbuild version 52 in Schutzfile as well.
2022-03-05 21:04:24 +01:00
Christian Kellner
923a627de4 distro/rhel86: set GPGKeyFiles for azure-rhui
Import the appropriate GPG keys for Red Hat contained in the package
`redhat-release` and Microsoft contained in `rhui-azure-rhel8`.
2022-03-05 21:04:24 +01:00
Christian Kellner
5b802f699a distro/rhel86: sync packages for azure-rhui
Sync the list of packages with the existing market place images.
2022-03-05 21:04:24 +01:00
Christian Kellner
320dcb0f9d distro/rhel86: update sysconfig options
Set `kernel-core` to be the defaul kernel instead of `kernel`.
2022-03-05 21:04:24 +01:00
Christian Kellner
e60517f0af distro/rhel86: remove authconfig call from azure-rhui
authconfig is actually a RHEL 7 thing and we should not call it for
RHEL 8.
2022-03-05 21:04:24 +01:00
Christian Kellner
dbd6f1f48c distro: add GPGKeyFiles option to ImageConfig
Add a new option `GPGKeyFiles` to ImageConfig that indicates which files
containing GPG keys should be imported into rpm. For now it will be used
by the osPipeline in rhel{86,90} to set the corresponding option in the
`org.osbuild.rpm` stage.
2022-03-05 21:04:24 +01:00
Christian Kellner
92d32e697d osbuild2: expose new gpgkeys.fromtree osbuild option
The `org.osbuild.rpm` stage gained a new option `gpgkeys.fromtree`
which is a list of paths with files containing gpgkeys that will
be imported after the package installation phase is done.
2022-03-05 21:04:24 +01:00
Christian Kellner
4b53312b7c test/data/repositories: bump snapshots to 20220301
Use the latest snapshot for the not yet released versions of RHEL and
their CentOS counterparts.
2022-03-05 11:37:12 +01:00
schutzbot
54eb8e41ff schutzfile: Update snapshots to 20220301 2022-03-05 11:37:12 +01:00
Jakub Rusz
5f28e0b7f6 schutzbot: update terraform SHA
CentOS-stream-9 image update in AWS. Resolves current koji.sh failures.
2022-03-04 09:34:46 +01:00
Antonio Murdaca
c79f51942b test/cases/simpl installer: bump to use fdo 0.4.0
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-03-03 16:27:57 +01:00
Jakub Rusz
a351a17f5e schutzbot: fix jrusz ssh key 2022-03-03 15:02:13 +01:00
Jakub Rusz
71f9355c87 schutzbot: add jrusz ssh-key 2022-03-03 13:29:55 +01:00
Ondřej Budai
5e291bd98f cloudapi/test: remove dependency on rpmmd_mock
rpmmd_mock fixture are complex and unneeded in the context of cloudapi, let's
just copy 3 lines from them and drop the dependency.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-02 16:20:11 +01:00
Ondřej Budai
c29a1fa9da cloudapi: drop unused rpmmdMetadata parameter & struct member
cloudapi no longer calls dnf-json directly so we can clean some code, yay!

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-03-02 16:20:11 +01:00
Sanne Raymaekers
0f26672e45 cmd/osbuild-service-maintenance: Log aws error 2022-03-02 12:36:09 +01:00
Sanne Raymaekers
413a013b91 templates/composer: Parametrize bucket name 2022-03-02 09:56:32 +01:00
ondrejbudai
309aca51f1 Post release version bump
[skip ci]
2022-02-28 23:35:13 +00:00
yih
f0522e758b test: fix ansible mount point check issue when encrypted
The device file is not `/dev/vda` anymore since we are no using a LUKS2
container, so we now have to look for `/dev/mapper/luks-`.
2022-02-28 23:05:45 +00:00
Antonio Murdaca
c1a896dd1d rhel{86,90}: define simplified installer build packages set
The edge installer and edge simplified installer build roots have
diverged, i.e. the latter need clevis/luks, so define a new pkg
set for the simplified installer extending the edge installer one.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-28 23:05:45 +00:00
Antonio Murdaca
39db7653b5 test/data/respositories: bump snapshots to 0227
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-28 23:05:45 +00:00
Antonio Murdaca
3b45a13ba2 Schutzfile: pin osbuild 50
CentOS Stream 8 is lagging behind, so let's pin osbuild v50,
under the assumption that things land in CS8 in the same order
they landed in RHEL8, so we don't run the risk of an old osbuild
with a new composer.

Fedora 35 is also stuck on an old osbuild, we will have to take
care to release osbuild 50 into F35 before the next composer.

Usually we would not want to pin like this, but we would
otherwise block the next composer release in RHEL.
2022-02-28 23:05:45 +00:00
Tom Gundersen
973b5141b3 ditro/rhel86: set volid like in rhel9.0
This is only required in RHEL9.0, but best practice is to always pin these things
down. Also increases uniformity between distros.

Simplify a bit the volid generator by making it require `rand.Rand` rather than
`io.Reader`, and hence eliminating the need for error handling.
2022-02-28 23:05:45 +00:00
Achilleas Koutsou
154e966cda test: update manifests and image info
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-28 23:05:45 +00:00
Antonio Murdaca
1a11176a22 spec: require osbuild >= 49 for luks/clevis stages
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-28 23:05:45 +00:00
Antonio Murdaca
3be67ad965 Simplified installer: add support for encrypted raw images
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-28 23:05:45 +00:00
Achilleas Koutsou
437dd397cd disk: test for duplicate Entities when cloning PartitionTables
Collect all entities and compare pointers.
2022-02-28 23:05:45 +00:00