Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bib: run "dnf" inside the container again #670

Merged
merged 7 commits into from
Oct 25, 2024

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Oct 9, 2024

In 17d3b56 osbuild-dnf-json was changed to run outside the
container. This lead to a regression in accessing subscribed
content. This commit partially reverts this commit to run
dnf again inside the container so that we have access to
the /run/secrets and RHEL repos.

This also adds a bunch of extra tests that needs to run
on a fedora/rhel/centos machine to test dnfjson and
subscriptions inside the container environment. Those
will only run in testingfarm (or locally) not in GH actions.

Closes: https://issues.redhat.com/browse/BIFROST-429

P.S. We should probably also look into how to inject osbuild-dnf-json into
the container, this way is not ideal, we maybe need to reconsider
putting it all into a single file again or think about other ways to make
this slightly easier. The tests/refactor hopefully makes this slightly easier
now.

@mvo5 mvo5 requested a review from ondrejbudai October 9, 2024 18:46
@mvo5 mvo5 marked this pull request as draft October 10, 2024 08:05
achilleas-k
achilleas-k previously approved these changes Oct 10, 2024
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

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

LGTM.

Couple of questions.

bib/internal/container/container_test.go Outdated Show resolved Hide resolved
bib/internal/container/container.go Outdated Show resolved Hide resolved
In 17d3b56 osbuild-dnf-json was changed to run outside the
container. This lead to a regression in accessing subscribed
content. This commit partially reverts this commit to run
dnf again inside the container so that we have access to
the /run/secrets and RHEL repos.
This commit adds a test that ensures that InitDNF() results in
triggering the dnf plugin that updates the subscriptions.
This commit adds a test for the DNF solver inside a subscribed RHEL
container.
This commit moves the logic of dealing with `osbuild-json-dnf` for
containers into a new container dnf `cntdnf` go module. Also move
the integration test for dnfjson with subscribed/normal content
there.
This commit wires up the needed credentials and scaffolding to
run the integration tests about subscribed content in containers
via tmt. For this it passes in the `RHSM_{ORG,ACTIVATION_KEY}`
secrets and runs the go tests as root.

This splits the go unit tests into a new github action to avoid
having to wait for both to finish.
For unknown and inexplicable reasons the progressbar does not
generate output when run with testingfarm. This is not observed
on a normal fedora40 or the GH runners, the reason is unknown
and should be investigated but to unblock us the test is currently
disabled in this specific environment.
@mvo5 mvo5 marked this pull request as ready for review October 10, 2024 11:51
bib/internal/cntdnf/cntdnf.go Outdated Show resolved Hide resolved
Ondrej suggested to remove the `cntdnf` package again and move
the code back into container. My original thinking was to have
a separate package because it a "container" should not need to
have knowledge about dnf and we could have a `cnfapt` later but
then YAGNI and we can always split it out later.
@achilleas-k achilleas-k self-requested a review October 17, 2024 14:32
Copy link
Member

@ondrejbudai ondrejbudai left a comment

Choose a reason for hiding this comment

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

Looks good. @achilleas-k wanna take one last look? :)

@achilleas-k
Copy link
Member

achilleas-k commented Oct 24, 2024

Should we merge this now to fix the immediate issue and then follow up with a switch back to using root_dir with the /run/secrets mount?

Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

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

Good to merge from my end. Feel free to resolve the root_dir conversation if you think it's done for now. We can pick it up again elsewhere.

@achilleas-k achilleas-k added this pull request to the merge queue Oct 25, 2024
Merged via the queue into osbuild:main with commit b772e2b Oct 25, 2024
8 of 10 checks passed
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.

4 participants