-
Notifications
You must be signed in to change notification settings - Fork 197
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
rust/src/client: Use microdnf when installing pkgs on a container #3280
Conversation
Skipping CI for Draft Pull Request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
rust/src/client.rs
Outdated
packages = packages.replace(" ", ""); | ||
} | ||
let microdnf_status = Command::new("microdnf") | ||
.args(&["install", &packages, "-y"]).status().expect("No package matches"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use ?
here instead of .expect()
.
A failure in this path would happen when we can't even execute the binary (e.g. it's missing) - not that it fails at runtime.
Either way, we shouldn't abort the process, but just return a regular error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On another topic, the use of -y
here is of course interesting...this relates heavily to #2883 (comment)
The thing is, because we are mutating the running root live (even if in a container) it is kind of tempting to me to say we should add rpm-ostree install -y
, and pass through that option down into microdnf
if present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the behavior of -y for non container systems? Do we ignore it or we change rpm-ostree to be interactive without it and need user ack before proceeding?
I see your comment on using it with -A
but if we wanted 1:1 mapping i.e. microdnf install -y
= rpmostree install -y
since we already don't have user interaction after rpm-ostree install pkg1
not sure what we accomplish for the user experience. If I want to call rpm-ostree
on my build like I do on my system then not requiring -y and just adding it in the background seems to be a consistent experience for the user.
I plan to set this up to run as part of our Prow builds to help test coreos#3280
I'm setting up some CI scaffolding for this here #3282 Once that lands and I do the PR for openshift/release, then this PR can adjust that code to do basically: (Hmm, and I guess we'll need to deal with the microdnf dependency too which actually breaks the hack of reusing coreos-assembler for this...) |
14f5f8c
to
90d94bd
Compare
90d94bd
to
f3c6e3f
Compare
You mean creating the fake path only for CI? We can't just add a buildconfig for testing this flow? The current checks seem to work now. I might be seeing the full picture of why we need that fake path created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, this is looking pretty good to me. Let's just do that prep PR split for the ostree-ext bump.
rust/src/client.rs
Outdated
@@ -235,6 +235,15 @@ pub(crate) fn client_render_download_progress( | |||
} | |||
} | |||
|
|||
pub(crate) fn microdnf_install(args: Vec<String>) -> Result<()> { | |||
let microdnf_status = Command::new("microdnf") | |||
.arg("install").args(&args).arg("-y").status()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit, let's put -y
before the package list. I don't think it matters, but it's a bit more normal.
Cargo.toml
Outdated
@@ -40,7 +40,7 @@ envsubst = "0.2.0" | |||
env_logger = "0.9.0" | |||
fail = { version = "0.5", features = ["failpoints"] } | |||
fn-error-context = "0.2.0" | |||
futures = "0.3.18" | |||
futures = "0.3.17" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a result of a merge conflict? I think downgrading should have a strong rationale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just made it build, not trying to propose this as the final push. But I made ostree-ext point to git and called: cargo update
which started complaining about 0.3.18
. Moving it down to 0.3.17 made it build.
Right, but (unless I'm missing something) we aren't testing the new code here, right? EDIT: To be clear, I don't think we need to block this PR on testing the new code, but we should have it as a priority soon after merging at least. |
Huh, from CI:
That's...interesting. I'm suspecting it's fallout from ostreedev/ostree-rs-ext#186 Looking |
/test all |
Yep reproduced locally with:
|
I can add the tests today on this PR, that is no issue. I was just giving an update on that the current code worked to me locally. I can also expect the microdnf bin to be on /usr/lib/rpm-ostree like it was suggested here: coreos/fedora-coreos-tracker#1050 (comment) |
f3c6e3f
to
2fe22a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for this!
Not a blocker (I'm going to click auto-merge) but let's try to get in the habit of adding at least brief documentation comments.
Looks like this needs a |
Co-authored-by: Colin Walters <[email protected]>
6c75f25
to
f2f529d
Compare
sorry, forgot to run it. Should be set now. |
Thank you for all the help and mentoring with thru this @cgwalters |
This will be used for an integration test once we rebuild our current container image. But also, this will help out cases like coreos/rpm-ostree#3280 As well as supporting finalization inside a container.
This will be used for an integration test once we rebuild our current container image. But also, this will help out cases like coreos/rpm-ostree#3280 As well as supporting finalization inside a container.
This will be used for an integration test once we rebuild our current container image. But also, this will help out cases like coreos/rpm-ostree#3280 As well as supporting finalization inside a container.
proof of concept, current version works. Example Dockerfile: