This builds on top of commit 0465d78fd9034ce9.
The toolboxImage type has been renamed to Image and moved into the
podman package.
There is nothing Toolbx specific about the type - it represents any
image returned by 'podman images'. The images are only later filtered
for Toolbx images.
Secondly, having the Image type inside the podman package makes it
possible to encapsulate the unmarshalling of the JSON within the package
without exposing the raw JSON to outside consumers. This is desirable
because the unmarshalling involves tracking changes in the JSON output
by different Podman versions, and it's better to limit such details to
the podman package.
https://github.com/containers/toolbox/pull/1190
This builds on top of commit e772207831.
Currently, the JSON from 'podman images --format json' gets unmarshalled
into a []map[string]interface{} in podman.GetImages, where the maps in
the slice represent images. Each map is then marshalled back into JSON
and then again unmarshalled into a toolboxImage type.
This is wasteful. The toolboxImage type already implements the
json.Unmarshaler interface [1], since commit e772207831. Hence,
the entire JSON from 'podman images --format json' can be directly
unmarshalled into a slice of toolboxImages without involving the
[]map[string]interface{}.
A subsequent commit will move the toolboxImage type into the podman
package to more tightly encapsulate the unmarshalling of the JSON. So,
as an intermediate step in that direction, the podman.GetImages function
has been temporarily changed to return the entire JSON.
[1] https://pkg.go.dev/encoding/json#Unmarshalerhttps://github.com/containers/toolbox/pull/1190
The com.github.debarshiray.toolbox label was introduced in commit
0ab6eb7401 to replace the com.redhat.component label for
filtering toolbox containers and images. This happened right before
the release of Fedora 30, which hasn't been supported for a while [1].
Therefore, it's time to stop using the old label.
It's also time to start using the newer com.github.containers.toolbox
label that was introduced in commit de5e5df9b7 to reflect the
project's new home under the Containers organization on GitHub.
[1] https://fedoraproject.org/wiki/Releases/30/Schedulehttps://github.com/containers/toolbox/pull/665
The 'removeImage' function should go into 'pkg/podman' because it wraps
around Podman's command. Because it no longer has access to the commands
- toolbox rmi - parameters it has a new forceDelete parameter.
https://github.com/containers/toolbox/pull/519
The 'removeContainer' function should go into 'pkg/podman' because it
wraps around Podman's command. Because it no longer has access to the
commands - 'toolbox rm' - parameters it has a new forceDelete parameter.
https://github.com/containers/toolbox/pull/519
We call `podman version` every time we want to check Podman's version.
This slows Toolbox down considerably. It's more efficient if we call
`podman version` just once and remember the output during runtime and
use the cached value.
https://github.com/containers/toolbox/pull/481
The subsequent commit will introduce a global variable called
podmanVersion, so this will prevent the local variable from colliding
with the global.
https://github.com/containers/toolbox/pull/481
This is in the same style as GLib's GLIB_CHECK_VERSION [1].
Note that the github.com/HarryMichal/go-version package is a fork of
github.com/mcuadros/go-version. The latter is now marked as read-only
and archived by its owner.
The fork was necessary to fix the documentation of the CompareSimple
function. The function is supposed to conform to the strcmp
convention. ie., return 0 if both versions are equal, 1 if the left
side is bigger, and -1 if the right side is bigger. However, the
documentation had it the other way round.
[1] https://developer.gnome.org/glib/stable/glib-Version-Information.html#GLIB-CHECK-VERSION:CAPShttps://github.com/containers/toolbox/pull/318