summaryrefslogtreecommitdiff
path: root/version/version.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-03-03 10:47:02 -0700
committerJhon Honce <jhonce@redhat.com>2021-03-03 17:03:19 -0700
commitf86d64130838fbeb75ea2776a2f2b6c4a49e58b3 (patch)
tree232fa1410600b9ed11f66d81d6d13f97e16c35c4 /version/version.go
parent87e20560ac885c541784af1341098ce8e1e7a940 (diff)
downloadpodman-f86d64130838fbeb75ea2776a2f2b6c4a49e58b3.tar.gz
podman-f86d64130838fbeb75ea2776a2f2b6c4a49e58b3.tar.bz2
podman-f86d64130838fbeb75ea2776a2f2b6c4a49e58b3.zip
Use version package to track all versions
* Server, bindings, and CLI all now pull version information from version package. * Current /libpod API version slaved to podman/libpod Version * Bindings validate against libpod API Minimal version * Remove pkg/bindings/bindings.go and updated tests Fixes: #9207 Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'version/version.go')
-rw-r--r--version/version.go39
1 files changed, 35 insertions, 4 deletions
diff --git a/version/version.go b/version/version.go
index 520014bb7..6b93ed8ea 100644
--- a/version/version.go
+++ b/version/version.go
@@ -4,13 +4,44 @@ import (
"github.com/blang/semver"
)
+type (
+ // Tree determines which API endpoint tree for version
+ Tree int
+ // Level determines which API level, current or something from the past
+ Level int
+)
+
+const (
+ // Libpod supports Libpod endpoints
+ Libpod = Tree(iota)
+ // Compat supports Libpod endpoints
+ Compat
+
+ // CurrentAPI announces what is the current API level
+ CurrentAPI = Level(iota)
+ // MinimalAPI announces what is the oldest API level supported
+ MinimalAPI
+)
+
// Version is the version of the build.
// NOTE: remember to bump the version at the top
// of the top-level README.md file when this is
// bumped.
var Version = semver.MustParse("3.1.0-dev")
-// APIVersion is the version for the remote
-// client API. It is used to determine compatibility
-// between a remote podman client and its backend
-var APIVersion = semver.MustParse("3.0.0")
+// See https://docs.docker.com/engine/api/v1.40/
+// libpod compat handlers are expected to honor docker API versions
+
+// APIVersion provides the current and minimal API versions for compat and libpod endpoint trees
+// Note: GET|HEAD /_ping is never versioned and provides the API-Version and Libpod-API-Version headers to allow
+// clients to shop for the Version they wish to support
+var APIVersion = map[Tree]map[Level]semver.Version{
+ Libpod: {
+ CurrentAPI: Version,
+ MinimalAPI: semver.MustParse("3.0.0"),
+ },
+ Compat: {
+ CurrentAPI: semver.MustParse("1.40.0"),
+ MinimalAPI: semver.MustParse("1.24.0"),
+ },
+}