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

main: add support for CLI extensions via external binaries #2500

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

lucab
Copy link
Member

@lucab lucab commented Dec 20, 2021

This adds some logic to detect and dispatch unknown subcommands to
extensions available in $PATH. Additional commands can be
implemented by adding relevant ostree-$verb binaries to the system.

As an example, if a /usr/bin/ostree-extcommand extension is provided,
the execution of ostree extcommand --help will be dispatched to that
as ostree-extcommand extcommand --help.

Closes: #2480

This adds some logic to detect and dispatch unknown subcommands to
extensions available in `$PATH`. Additional commands can be
implemented by adding relevant `ostree-$verb` binaries to the system.

As an example, if a `/usr/bin/ostree-extcommand` extension is provided,
the execution of `ostree extcommand --help` will be dispatched to that
as `ostree-extcommand extcommand --help`.
Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Cool, this is nice and straightforward.

Comment on lines +15 to +16
${CMD_PREFIX} ostree env --help >out.txt
assert_file_has_content out.txt "with an empty environment"
Copy link
Member

Choose a reason for hiding this comment

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

How about e.g.:

Suggested change
${CMD_PREFIX} ostree env --help >out.txt
assert_file_has_content out.txt "with an empty environment"
${CMD_PREFIX} env sometestenv=foo ostree env >out.txt
assert_file_has_content out.txt '^sometestenv=foo`

or so?

Copy link
Member Author

Choose a reason for hiding this comment

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

I also realized there were some leftovers in the environment. #2501 takes care of all that.

@cgwalters
Copy link
Member

Eh rather than re-roll CI for a nit, just going to merge; we can do the above as a followup.

@cgwalters cgwalters merged commit 7c67199 into ostreedev:main Dec 20, 2021
@lucab lucab deleted the ups/cli-extensions branch December 21, 2021 10:11
cgwalters added a commit to cgwalters/coreos-assembler that referenced this pull request Jan 8, 2022
We can do this now that ostree 2022.1 is out with
ostreedev/ostree#2500

There are two notable aspects to this:

 - Previously the code here was a mix of `ostree` and `rpm-ostree`;
   but it's all "pure ostree stuff", and now it is all much more
   consistent.  This also helps us eventually put more functionality
   in `ostree` that was formerly in `rpm-ostree`.
 - We're kind of implicitly saying the container bits aren't experimental
   anymore, which...they probably shouldn't be in rpm-ostree side
   either.
cgwalters added a commit to cgwalters/coreos-assembler that referenced this pull request Jan 12, 2022
We can do this now that ostree 2022.1 is out with
ostreedev/ostree#2500

There are two notable aspects to this:

 - Previously the code here was a mix of `ostree` and `rpm-ostree`;
   but it's all "pure ostree stuff", and now it is all much more
   consistent.  This also helps us eventually put more functionality
   in `ostree` that was formerly in `rpm-ostree`.
 - We're kind of implicitly saying the container bits aren't experimental
   anymore, which...they probably shouldn't be in rpm-ostree side
   either.
cgwalters added a commit to coreos/coreos-assembler that referenced this pull request Jan 12, 2022
We can do this now that ostree 2022.1 is out with
ostreedev/ostree#2500

There are two notable aspects to this:

 - Previously the code here was a mix of `ostree` and `rpm-ostree`;
   but it's all "pure ostree stuff", and now it is all much more
   consistent.  This also helps us eventually put more functionality
   in `ostree` that was formerly in `rpm-ostree`.
 - We're kind of implicitly saying the container bits aren't experimental
   anymore, which...they probably shouldn't be in rpm-ostree side
   either.
cgwalters added a commit to cgwalters/coreos-assembler that referenced this pull request Jan 14, 2022
We can do this now that ostree 2022.1 is out with
ostreedev/ostree#2500

There are two notable aspects to this:

 - Previously the code here was a mix of `ostree` and `rpm-ostree`;
   but it's all "pure ostree stuff", and now it is all much more
   consistent.  This also helps us eventually put more functionality
   in `ostree` that was formerly in `rpm-ostree`.
 - We're kind of implicitly saying the container bits aren't experimental
   anymore, which...they probably shouldn't be in rpm-ostree side
   either.
cgwalters added a commit to cgwalters/coreos-assembler that referenced this pull request Feb 2, 2022
We can do this now that ostree 2022.1 is out with
ostreedev/ostree#2500

There are two notable aspects to this:

 - Previously the code here was a mix of `ostree` and `rpm-ostree`;
   but it's all "pure ostree stuff", and now it is all much more
   consistent.  This also helps us eventually put more functionality
   in `ostree` that was formerly in `rpm-ostree`.
 - We're kind of implicitly saying the container bits aren't experimental
   anymore, which...they probably shouldn't be in rpm-ostree side
   either.
cgwalters added a commit to coreos/coreos-assembler that referenced this pull request Feb 3, 2022
We can do this now that ostree 2022.1 is out with
ostreedev/ostree#2500

There are two notable aspects to this:

 - Previously the code here was a mix of `ostree` and `rpm-ostree`;
   but it's all "pure ostree stuff", and now it is all much more
   consistent.  This also helps us eventually put more functionality
   in `ostree` that was formerly in `rpm-ostree`.
 - We're kind of implicitly saying the container bits aren't experimental
   anymore, which...they probably shouldn't be in rpm-ostree side
   either.
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.

Support CLI integration of ostree-rs-ext
2 participants