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

Support feature subcommand #2395

Closed

Conversation

DarrellTang
Copy link

No description provided.

@YJDoc2 YJDoc2 assigned YJDoc2 and unassigned YJDoc2 Sep 28, 2023
@YJDoc2 YJDoc2 self-requested a review September 28, 2023 06:49
Copy link
Member

@utam0k utam0k left a comment

Choose a reason for hiding this comment

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

May I ask you to add the unit tests?

Copy link
Collaborator

@YJDoc2 YJDoc2 left a comment

Choose a reason for hiding this comment

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

Hey, so I have added some comments. feel free to ask any questions.
As for actually populating the data into the structures, we can take a look at how runc is doing it.

crates/liboci-cli/src/features.rs Outdated Show resolved Hide resolved
crates/liboci-cli/src/features.rs Outdated Show resolved Hide resolved
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Oct 12, 2023

@DarrellTang let me know if any issues!

@DarrellTang
Copy link
Author

@DarrellTang let me know if any issues!

Sorry for the delay, had some life events pop up. I've made some changes but I still can't get it to compile. This is the first error:

error[E0277]: the trait bound `Linux: Clone` is not satisfied
   --> crates/liboci-cli/src/features.rs:25:19
    |
25  |     linux: Option<Linux>,
    |                   ^^^^^ the trait `Clone` is not implemented for `Linux`
    |
note: required by a bound in `ArgMatches::remove_one`
   --> /home/dtang/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.3.0/src/parser/matches/arg_matches.rs:404:32
    |
404 |     pub fn remove_one<T: Any + Clone + Send + Sync + 'static>(&mut self, id: &str) -> Option<T> {
    |                                ^^^^^ required by this bound in `ArgMatches::remove_one`

Not sure what to do with that error? Any suggestions?

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Oct 28, 2023

Hey @DarrellTang as I have mentioned in the comment here, the structure you are using is for commandline arg parsing. It should not be used to store the data. You should keep that structure as-is and create a separate one to store/move around the features data.

@DarrellTang DarrellTang force-pushed the support-feature-subcommand branch from f9bd988 to 646c103 Compare October 30, 2023 04:36
@DarrellTang
Copy link
Author

@YJDoc2 Not sure how I closed this PR but I made some more progress. Sorry about the confusion, it finally clicked what you meant by not using that struct and creating a new one.

Some questions now:

  • I've got it printing out the json for youki features like the runc features but I'm not sure if the organization of the code is best. I've got the struct in the same file as the features invocation. Suggestions on how to structure this?
  • Is there an example unit test I could copy off of for @utam0k's request?

@DarrellTang DarrellTang reopened this Oct 31, 2023
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Nov 6, 2023

Hey @DarrellTang Apologies for the delay. This looks like a step in right direction. One change I'd strongly suggest is to define constants at the top and define structures before they are used rather than after. Also there seems to be some lint warnings, so you can try running just lint (you'll need to install just ) or you can see the justfile and run commands manually.

Now that you have got the structure ready, we can try to set the values dynamically instead of having them hard-coded. For example, you can use the caps library which is already a dependency of youki, to get the list of supported capabilities, and use that list instead of hard-coding them. Similarly you can try for supported namespaces as well, probably using procfs (not sure about this, might need something else) and so on.

Let me know if you have any issues 👍

@DarrellTang DarrellTang force-pushed the support-feature-subcommand branch 2 times, most recently from df480bf to 5e74538 Compare November 8, 2023 03:17
@utam0k
Copy link
Member

utam0k commented Nov 10, 2023

@DarrellTang May I ask you to check the CI?

@DarrellTang
Copy link
Author

DarrellTang commented Nov 13, 2023

@DarrellTang May I ask you to check the CI?

@utam0k I see there are CI runs that require a maintainer to approve but not sure what to do with those? Is there something I should be doing for these? Sorry if these are silly questions. Still learning my way around.

@DarrellTang DarrellTang force-pushed the support-feature-subcommand branch from b152a67 to 44fcf79 Compare November 13, 2023 03:22
@utam0k
Copy link
Member

utam0k commented Nov 14, 2023

@utam0k I see there are CI runs that require a maintainer to approve but not sure what to do with those? Is there something I should be doing for these? Sorry if these are silly questions. Still learning my way around.

@DarrellTang
I have approved it. You should commit with sign-off at least, please refer to this page:
https://github.com/containers/youki/pull/2395/checks?check_run_id=18610534142

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Dec 18, 2023

@DarrellTang Hello! Are you still working on this? It is fine if you got busy with something else, just let us know so we can close this / re-assign to someone else accordingly. Thanks :)

@DarrellTang
Copy link
Author

@DarrellTang Hello! Are you still working on this? It is fine if you got busy with something else, just let us know so we can close this / re-assign to someone else accordingly. Thanks :)

Yes, I'm still planning on working on this. I have to redo my dev setup and got busy but would like to stay assigned unless there's urgency to get it done! Thank you!

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Dec 18, 2023

Hey @DarrellTang no problem. I'll keep this as it is, and feel free to ask questions or help if needed 👍
In case this is needed urgently, I'll message here and we can discuss about re-assigning then.
Thanks!

@DarrellTang DarrellTang force-pushed the support-feature-subcommand branch from 070a86a to c2d8d53 Compare January 14, 2024 19:09
@DarrellTang
Copy link
Author

@utam0k Just figured out the sign off. sorry about the delay.

@YJDoc2 I managed to get capabilities and namespaces pulling dynamically but i'm stuck on what other sections i can do that for. any suggestions for some easy, low hanging fruit?

I looked at cgroups, mount_options, and hooks and couldn't figure out where to pull those from the operating system

@utam0k
Copy link
Member

utam0k commented Jan 19, 2024

@DarrellTang It seems that it is still missing

@utam0k Just figured out the sign off. sorry about the delay.

@adrianalin
Copy link
Contributor

A rebase is also needed here.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Jan 21, 2024

I looked at cgroups, mount_options, and hooks and couldn't figure out where to pull those from the operating system

Hey @DarrellTang , apologies for the delay in response. I think you can take a look at runc's implementation . They also seem to have hardcoded several values such as mount options, we should just validate which of them are applicable for youki.

@DarrellTang DarrellTang force-pushed the support-feature-subcommand branch 2 times, most recently from f03c7ee to fc12184 Compare January 28, 2024 00:04
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
Signed-off-by: Darrell Tang <darrelltang@gmail.com>
@utam0k
Copy link
Member

utam0k commented Feb 4, 2024

@DarrellTang Hi 👋 May I ask you to check the lint errors? You can check them using just lint

@codecov-commenter
Copy link

Codecov Report

Merging #2395 (fc12184) into main (04f8f2d) will decrease coverage by 0.72%.
Report is 18 commits behind head on main.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2395      +/-   ##
==========================================
- Coverage   65.50%   64.78%   -0.72%     
==========================================
  Files         133      133              
  Lines       16916    17105     +189     
==========================================
+ Hits        11081    11082       +1     
- Misses       5835     6023     +188     

);
annotations_map.insert(
ANNOTATION_RUNC_COMMIT.to_string(),
String::from("v1.1.9-0-gccaecfc"),

Choose a reason for hiding this comment

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

This is specific to runc.

youki is not intended to use this annotation.

Copy link
Author

Choose a reason for hiding this comment

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

Should there be a similar annotation for youki, i.e. ANNOTATION_YOUKI_COMMIT ?

let mut annotations_map = HashMap::new();
annotations_map.insert(
ANNOTATION_LIBSECCOMP_VERSION.to_string(),
String::from("2.5.3"),

Choose a reason for hiding this comment

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

This should be fetched from libseccomp (if youki uses libseccomp)

Copy link
Author

Choose a reason for hiding this comment

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

it definitely does. what's the best way for me to grab this version number? I apologize, I'm pretty new to rust.


let features = HardFeatures {
oci_version_min: Some(String::from("1.0.0")),
oci_version_max: Some(String::from("1.0.2-dev")),

Choose a reason for hiding this comment

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

Why not 1.1.0 ?

Copy link
Author

Choose a reason for hiding this comment

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

I hardcoded it when i started so I assume it's progressed since then. I don't have any objection to using 1.1.0 but it seems like runc pulls this from the https://github.com/opencontainers/runtime-spec/blob/main/specs-go/version.go . Should I just hardcode for 1.2.0 (which is the latest) or is there a rust runtime-spec equivalent?

Thank you for reviewing this!

@utam0k
Copy link
Member

utam0k commented Feb 25, 2024

@DarrellTang Do you have any trouble? I can help you ;)

@DarrellTang
Copy link
Author

@DarrellTang Do you have any trouble? I can help you ;)

Thank you. I know it has taken a long time on this. It seems like my commits are signed now. I also just removed an extra blank line that was causing the linting to fail.

I am still puzzling over what else I can pull programatically. Not sure of a direction so if you have suggestions for what I should look at next, I'd be very happy to take your guidance! 🙏

Signed-off-by: Darrell Tang <darrelltang@gmail.com>
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Mar 6, 2024

I am still puzzling over what else I can pull programatically. Not sure of a direction so if you have suggestions for what I should look at next, I'd be very happy to take your guidance!

Hey, so what you can do is to check what things are we hardcoding here, and runc is fetching dynamically, and try to do the same. There are some things which even runc hard-codes, so maybe we can deal with them separately.

@utam0k
Copy link
Member

utam0k commented Jun 7, 2024

@DarrellTang Friendly reminder 🙏 👀
#2395 (comment)

@utam0k
Copy link
Member

utam0k commented Jun 28, 2024

@musaprg Are you interested in taking over this PR?

@DarrellTang
Copy link
Author

@DarrellTang Friendly reminder 🙏 👀

#2395 (comment)

I'm sorry for the delay, please feel free to reassign this. My schedule has changed and I haven't had time to continue working on this.

@musaprg
Copy link
Contributor

musaprg commented Jun 29, 2024

@utam0k Hi! I'd love to take over the PR, but I need some time to catch things up. I'll submit another PR with cherry-picking the existing commits after that.

@musaprg musaprg mentioned this pull request Jun 29, 2024
2 tasks
@utam0k
Copy link
Member

utam0k commented Jul 11, 2024

Dup #2837

@utam0k utam0k closed this Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants