Skip to content

test: add test for subscribed content#391

Merged
mvo5 merged 2 commits intoosbuild:mainfrom
mvo5:add-subscription-manager-test
Dec 3, 2025
Merged

test: add test for subscribed content#391
mvo5 merged 2 commits intoosbuild:mainfrom
mvo5:add-subscription-manager-test

Conversation

@mvo5
Copy link
Contributor

@mvo5 mvo5 commented Dec 1, 2025

This is a followup for #390 - it adds a test that ensures that ibcli can access subscribed content in its container from a subscribed system.

This needs a SUBSCRIPTION_{ORG,ACTIVATIONKEY} secret and because of the way that secrets are handled in forks the test will not be run on forks but it will be run in the merge queue.

Note that just running image-builder manifest is not enough,
even when this works the librepo/curl download can still fail
if osbuild does not find the right secrets.

Thanks to lzap for reporting this.

@mvo5 mvo5 force-pushed the add-subscription-manager-test branch 12 times, most recently from d1f9e64 to 5a972a1 Compare December 1, 2025 14:32
@mvo5 mvo5 marked this pull request as ready for review December 1, 2025 14:34
@mvo5 mvo5 requested a review from a team as a code owner December 1, 2025 14:34
@mvo5 mvo5 requested review from achilleas-k, croissanne, ondrejbudai and supakeen and removed request for a team December 1, 2025 14:34
supakeen
supakeen previously approved these changes Dec 2, 2025
"manifest",
"qcow2",
"--distro", "rhel-10.0",
], text=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will pass, but if we start testing a full build then osbuild fails to download RPM packages. The fastest "image" type is tar which only takes few moments to build.

@mvo5 mvo5 marked this pull request as draft December 2, 2025 15:37
@lzap
Copy link
Contributor

lzap commented Dec 2, 2025

Would you mind unregistering the host as well? This uses prod environment let's be nice.

@mvo5 mvo5 force-pushed the add-subscription-manager-test branch 2 times, most recently from d9e627e to 77740e1 Compare December 2, 2025 16:18
@mvo5 mvo5 marked this pull request as ready for review December 2, 2025 16:18

# those tests give us testing of the subscription-manager too
manifest-in-osbuild-container:
name: "RHEL manifest in container"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this now a RHEL build :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks. Updated.

mvo5 added 2 commits December 2, 2025 17:49
We need a way to test if image-builder can work with subscribed
content when run via a container. This requires a pair of secrets
SUBSCRIPTION_{ORG,ACTIVATION_KEY} and a host environment that
has `subscription-manager` installed.

Note that just running `image-builder manifest` is not enough,
even when this works the librepo/curl download can still fail
if osbuild does not find the right secrets.

Thanks to lzap for reporting this.
In oder to test if we can get subscribed content inside
a ibcli container we need a subscribed host. This is tricky
with github because:
a) there are no `runs-on: {fedora,centos,rhel}` systems
b) creating a fedora/centos chroot and running podman in it
   is tricky because podman really dislikes chroots

So this commit runs it inside the osbuild test container that
is fedora based and relies on podman-in-podman container
execution (for this we need to run with `--privileged`).
@mvo5 mvo5 force-pushed the add-subscription-manager-test branch from 77740e1 to 4dfaabd Compare December 2, 2025 16:51
@supakeen supakeen requested a review from lzap December 2, 2025 19:52
])
yield
finally:
subprocess.check_call(["subscription-manager", "unregister"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@lzap
Copy link
Contributor

lzap commented Dec 3, 2025

Why this is working tho? Isn't the test supposed to fail?

@mvo5
Copy link
Contributor Author

mvo5 commented Dec 3, 2025

Why this is working tho? Isn't the test supposed to fail?

See the text in the PR description:

This needs a SUBSCRIPTION_{ORG,ACTIVATIONKEY} secret and because of the way that secrets are handled in forks the test will not be run on forks but it will be run in the merge queue.

@lzap
Copy link
Contributor

lzap commented Dec 3, 2025

Ah so it cannot be merged until it is fixed I assume, thanks.

@mvo5
Copy link
Contributor Author

mvo5 commented Dec 3, 2025

Ah so it cannot be merged until it is fixed I assume, thanks.

I will put it into the merge-queue, it should get kicked out again because osbuild is not ready. But if its not kicked out something else is wrong :( (or there is a miracle cure ;)

@mvo5 mvo5 added this pull request to the merge queue Dec 3, 2025
Merged via the queue into osbuild:main with commit f9aa743 Dec 3, 2025
39 checks passed
@mvo5 mvo5 deleted the add-subscription-manager-test branch December 3, 2025 16:01
@mvo5
Copy link
Contributor Author

mvo5 commented Dec 3, 2025

meh :( and it even in the merge-queue skipped the subscribed content test because it did not have access to the secrets, that is quite disappointing :( GH action make developing/debugging this sort of thing (secrets accross forks) unfortunately quite fiddly. I will look into this again and fix it :(

@achilleas-k
Copy link
Member

meh :( and it even in the merge-queue skipped the subscribed content test because it did not have access to the secrets, that is quite disappointing :( GH action make developing/debugging this sort of thing (secrets accross forks) unfortunately quite fiddly. I will look into this again and fix it :(

I think in these cases, I prefer having pytest markers rather than skipif rules. The marker should, by default, replicate skipif, but there should be a way to force it to run, ignoring the skip rule, so that in CI we can always force the test to run and fail if the configuration is lacking.

@thozza
Copy link
Member

thozza commented Dec 5, 2025

Thinking about this more lately, we need test case like this in osbuild repository, where RHSM secrets discovery is happening for builds and once osbuild/images#2055 is resolved, it would also for depsolving.

Having an integration test in ibcli is good, but it is too late to test this kind of functionality here.

@mvo5
Copy link
Contributor Author

mvo5 commented Dec 5, 2025

Thinking about this more lately, we need test case like this in osbuild repository, where RHSM secrets discovery is happening for builds and once osbuild/images#2055 is resolved, it would also for depsolving.

Having an integration test in ibcli is good, but it is too late to test this kind of functionality here.

Yeah, given that the merge queue is also not applying the secrets (which I don't know why) this is all not working anyway, I'm inclined to just revert it, I (still) think the idea is not bad as a smoke test but its impractical (especially at this layer).

@thozza
Copy link
Member

thozza commented Dec 5, 2025

Yeah, given that the merge queue is also not applying the secrets (which I don't know why) this is all not working anyway, I'm inclined to just revert it, I (still) think the idea is not bad as a smoke test but its impractical (especially at this layer).

Yeah, I like the approach. I'll shamelessly use it in osbuild for the depsolver test (while giving you the credit) 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants