mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
runc: add libpathrs info to --version and features
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
(cherry picked from commit 1e20abef19)
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased 1.4.z]
|
||||
|
||||
### Added ###
|
||||
- `runc version` and `runc features` now provide version information about
|
||||
libpathrs when runc is built with the `libpathrs` build tag. (#5291, #5328)
|
||||
|
||||
### Changed ###
|
||||
- For users making use of the `libpathrs` build tag, runc now depends on
|
||||
[libpathrs v0.2.5] or later, and attempting to build with older versions will
|
||||
|
||||
@@ -93,6 +93,10 @@ var featuresCommand = cli.Command{
|
||||
feat.Annotations[runcfeatures.AnnotationLibseccompVersion] = fmt.Sprintf("%d.%d.%d", major, minor, patch)
|
||||
}
|
||||
|
||||
if v := pathrsVersionString(); v != "" {
|
||||
feat.Annotations[runcfeatures.AnnotationLibpathrsVersion] = v
|
||||
}
|
||||
|
||||
enc := json.NewEncoder(context.App.Writer)
|
||||
enc.SetIndent("", " ")
|
||||
return enc.Encode(feat)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//go:build libpathrs
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"cyphar.com/go-pathrs"
|
||||
)
|
||||
|
||||
func pathrsVersionString() string {
|
||||
info, err := pathrs.LibraryVersion()
|
||||
if err != nil {
|
||||
panic(err) // should never happen
|
||||
}
|
||||
return info.VersionString
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//go:build !libpathrs
|
||||
|
||||
package main
|
||||
|
||||
func pathrsVersionString() string {
|
||||
return ""
|
||||
}
|
||||
@@ -3,6 +3,7 @@ module github.com/opencontainers/runc
|
||||
go 1.24.0
|
||||
|
||||
require (
|
||||
cyphar.com/go-pathrs v0.2.5
|
||||
github.com/checkpoint-restore/go-criu/v7 v7.2.0
|
||||
github.com/containerd/console v1.0.5
|
||||
github.com/coreos/go-systemd/v22 v22.7.0
|
||||
@@ -28,7 +29,6 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
cyphar.com/go-pathrs v0.2.5 // indirect
|
||||
github.com/cilium/ebpf v0.17.3 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
|
||||
@@ -48,6 +48,10 @@ func printVersion(c *cli.Context) {
|
||||
if major+minor+micro > 0 {
|
||||
fmt.Fprintf(w, "libseccomp: %d.%d.%d\n", major, minor, micro)
|
||||
}
|
||||
|
||||
if v := pathrsVersionString(); v != "" {
|
||||
fmt.Fprintf(w, "libpathrs: %s\n", v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -22,4 +22,7 @@ const (
|
||||
// AnnotationLibseccompVersion is the version of libseccomp, e.g., "2.5.1".
|
||||
// Note that the runtime MAY support seccomp even when this annotation is not present.
|
||||
AnnotationLibseccompVersion = "io.github.seccomp.libseccomp.version"
|
||||
|
||||
// AnnotationLibpathrsVersion is the runtime version of libpathrs.
|
||||
AnnotationLibpathrsVersion = "com.cyphar.pathrs.libpathrs.version"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user