-
Notifications
You must be signed in to change notification settings - Fork 50
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
cmd: add new image-builder binary and initial list-distros
#997
base: main
Are you sure you want to change the base?
Conversation
e727cd2
to
e130485
Compare
cmd/image-builder/manifest.go
Outdated
// XXX: what/how much do we expose here? | ||
var options distro.ImageOptions |
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.
For on-prem, we use ImageOptions
for the stuff that is passed on the CLI and is not part of the BP. E.g. image size.
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.
This is something we need to think about. The image options, like Tomáš said, is (mostly) for things that come from the command line. This includes:
- image size
- ostree options (url, ref, and parent, when using
composer-cli compose start-ostree
).
But it's also used for other things that get set automatically (or semi-automatically):
- Facts: this shouldn't be exposed at all. It adds a value to the RHSM facts so we can see how the image was built when it registers back with subscription manager (hosted service vs on-prem). Perhaps we could add a new value for this now for the daemonless builder.
- Subscription: Used only by the service (I think, https://github.com/osbuild/osbuild-composer/blob/a7cd521325504a43d3708f8f91ab63999862b279/internal/cloudapi/v2/compose.go#L1194). But might be useful to expose for on-prem builders.
- PartitioningMode: This is a funny one. In osbuild-composer, it's set in the blueprint (https://github.com/osbuild/osbuild-composer/blob/a7cd521325504a43d3708f8f91ab63999862b279/internal/blueprint/customizations.go#L23), but it's passed down to images through the image options (https://github.com/osbuild/osbuild-composer/blob/a7cd521325504a43d3708f8f91ab63999862b279/internal/weldr/api.go#L2552). Not sure what we want to do there. Since it's in the BP in composer already, I think we should move it there in images too.
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.
I really like this PR (what it's starting, in particular). I realise there are many reasons why it's a draft, but it makes me worry that it will be forgotten if we don't move towards something more concrete and start merging soon.
I think we might get the ball rolling if we start small. A PR that only implements list-images for example would be very quick to merge, and after that we'd have the image-builder
command ready to expand on and start using in testing (replacing the existing cmd/list-images
).
// XXX: this will list 802 images right now, we need a sensible | ||
// default here, maybe without --filter just list all available | ||
// distro names? |
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.
I think it's fine to list everything if it's unfiltered. Perhaps in the human-readable version we can have a count on the last line with a suggestion to look into --filter
, so it's clear that the user is getting too much output.
For the machine readable case, listing all is definitely ok as far as I'm concerned.
43fd9e4
to
2aebe55
Compare
This commit creates a new `imagefilter` package that can be used to create a filter for the available images that can be build by the images library. Support for prefixes and fnmatch style globbing is available. This will eventually allows us to do: ``` $ image-builder --list-images --filter src:aarch64 --filter type:qcow* or $ image-builder --list-images --filter ami ``` The filtering can be both with or without a prefix, i.e. when doing a "simple" search all common fields (disro,arch,imageType) are checked but with a prefix search things can be narrowed down more. Initially the following prefixes filters are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid" (Split out from the spike in osbuild#997)
This commit creates a new `imagefilter` package that can be used to create a filter for the available images that can be build by the images library. Support for prefixes and fnmatch style globbing is available. This will eventually allows us to do: ``` $ image-builder --list-images --filter src:aarch64 --filter type:qcow* or $ image-builder --list-images --filter ami ``` The filtering can be both with or without a prefix, i.e. when doing a "simple" search all common fields (disro,arch,imageType) are checked but with a prefix search things can be narrowed down more. Initially the following prefixes filters are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid" (Split out from the spike in osbuild#997)
eca4753
to
08ff6df
Compare
This commit creates a new `imagefilter` package that can be used to create a filter for the available images that can be build by the images library. Support for prefixes and fnmatch style globbing is available. This will eventually allows us to do: ``` $ image-builder --list-images --filter arch:aarch64 --filter type:qcow* or $ image-builder --list-images --filter ami ``` The filtering can be both with or without a prefix, i.e. when doing a "simple" search all common fields (disro,arch,imageType) are checked but with a prefix search things can be narrowed down more. Initially the following prefixes filters are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid" (Split out from the spike in osbuild#997)
This commit creates a new `imagefilter` package that can be used to create a filter for the available images that can be build by the images library. Support for prefixes and fnmatch style globbing is available. This will eventually allows us to do: ``` $ image-builder --list-images --filter arch:aarch64 --filter type:qcow* or $ image-builder --list-images --filter ami ``` The filtering can be both with or without a prefix, i.e. when doing a "simple" search all common fields (disro,arch,imageType) are checked but with a prefix search things can be narrowed down more. Initially the following prefixes filters are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid" (Split out from the spike in osbuild#997)
This commit creates a new `imagefilter` package that can be used to create a filter for the available images that can be build by the images library. Support for prefixes and fnmatch style globbing is available. This will eventually allows us to do: ``` $ image-builder --list-images --filter arch:aarch64 --filter type:qcow* or $ image-builder --list-images --filter ami ``` The filtering can be both with or without a prefix, i.e. when doing a "simple" search all common fields (disro,arch,imageType) are checked but with a prefix search things can be narrowed down more. Initially the following prefixes filters are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid" (Split out from the spike in osbuild#997)
This commit creates a new `imagefilter` package that can be used to create a filter for the available images that can be build by the images library. Support for prefixes and fnmatch style globbing is available. This will eventually allows us to do: ``` $ image-builder --list-images --filter src:aarch64 --filter type:qcow* or $ image-builder --list-images --filter ami ``` The filtering can be both with or without a prefix, i.e. when doing a "simple" search all common fields (disro,arch,imageType) are checked but with a prefix search things can be narrowed down more. Initially the following prefixes filters are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid" (Split out from the spike in osbuild#997)
08ff6df
to
8c2dfa4
Compare
This commit creates a new `imagefilter` package that can be used to create a filter for the available images that can be build by the images library. Support for prefixes and fnmatch style globbing is available. This will eventually allows us to do: ``` $ image-builder --list-images --filter arch:aarch64 --filter type:qcow* or $ image-builder --list-images --filter ami ``` The filtering can be both with or without a prefix, i.e. when doing a "simple" search all common fields (disro,arch,imageType) are checked but with a prefix search things can be narrowed down more. Initially the following prefixes filters are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid" (Split out from the spike in #997)
8c2dfa4
to
6890d8e
Compare
Just FTR - this will be transferred to https://github.com/osbuild/image-builder-cli (unless someone has concerns) |
f6194f3
to
b8cb4e8
Compare
bd762f4
to
f232368
Compare
This commit contains an abreviated version of an osbuild jsonseq output log. Most of the repetitive data from the curl and rpm stages got removed as they don't add (much) to the understanding. The data was generated via: ``` $ sudo python3 -m osbuild --libdir . --monitor JSONSeqMonitor \ --export image --output-directory /tmp/out \ ./test/data/manifests/fedora-boot.json > osbuild-status-output.json ```
This commit adds support for the jsonseq based monitoring that osbuild provides. This is useful for machine readable status reporting.
This commit adds a `Status.Trace` string in the osbuildmonitor. Trace contains a single log line, usually very low-level or stage output bug useful for e.g. bug reporting. Should in general not be displayed to the user but the concatenation of all "trace" lines should give the same information as running osbuild on a terminal.
This commit adds `Status.Timestamp` so that it's easier to correlate what took how long when reconstructing the log (e.g. for bugreporting). See also: https://github.com/osbuild/images/compare/main...mvo5:osbuildmonitor-testdata?expand=1 for the full log.
This commit adds support cabilities to filter the list of distros based on a given search expression. Those are: ``` foo name:foo arch:i386 type:ami bootmode:uefi ``` and they will filter the list of distros.
This commit adds a new `image-builder` binary that will (eventually) be capable to build images standalone (daemonless). There are various use-cases for this, the most important one is CI/CD pipelines but also providing a common abstraction over the "images" library (and potentially later "otk"). This commit implements basic a `list-images` command with filtering and text and json output, e.g. ``` $ image-builder list-images --filter bootmode:none --filter name:fedora-39 --filter arch:s390x fedora-39 --arch s390x --type container $ ./image-builder list-images --filter bootmode:none --filter name:fedora-39 --filter arch:s390x --format=json {"distro":{"name":"fedora-39"},"arch":{"name":"s390x"},"image_type":{"name":"container"}} ```
…opy/paste friendly
This commit adds support to filter image based on (unresolved) packages. E.g.: ``` $ ./image-builder list-images --filter pkg:gdisk ... rhel-9.6 type:vhd arch:x86_64 ``` Based on an idea from Achilleas-k, many thanks.
This commit allows to change the filename when creating a manifest from an image type. This is useful when doing a UI for users, e.g. this will allow us to support: ``` $ image-builder build rhel-9 type:qcow2 --output foo.img ``` (this will also be useful for bootc-image-builder). Well, osbuild itself will still put it under a directory when doing main_cli.py:exports() but that is something orthogonal.
313e543
to
eba44b4
Compare
eba44b4
to
aaa2938
Compare
[draft as this is sill WIP and questions like where to get the authorative list of distros/repos and if we should embed them via "embed:" to have a simpler distribution mechanism etc]
This commit adds a new
image-builder
binary that will be capableto build images standalone (daemonless). There are various use-cases
for this, the most important one is CI/CD pipelines.
This binary should eventually also replace the existing "cmd/list-images" and
"cmd/build" binaries (and potentially more) and it will cherry pick a lot of the
functionality from there. I decided against starting from one of the exiting binaries
because it allows a slightly cleaner start but this work is early so we could still
reconsider if people feel strongly it should be done the other way around.