mirror of
https://github.com/containers/podman.git
synced 2025-05-21 09:05:56 +08:00
vendor: update containers/common
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
2
go.mod
2
go.mod
@ -12,7 +12,7 @@ require (
|
||||
github.com/containernetworking/cni v1.1.2
|
||||
github.com/containernetworking/plugins v1.1.1
|
||||
github.com/containers/buildah v1.27.0
|
||||
github.com/containers/common v0.49.2-0.20220809074359-b0ea008ba661
|
||||
github.com/containers/common v0.49.2-0.20220817132854-f6679f170eca
|
||||
github.com/containers/conmon v2.0.20+incompatible
|
||||
github.com/containers/image/v5 v5.22.0
|
||||
github.com/containers/ocicrypt v1.1.5
|
||||
|
4
go.sum
4
go.sum
@ -395,8 +395,8 @@ github.com/containernetworking/plugins v1.1.1/go.mod h1:Sr5TH/eBsGLXK/h71HeLfX19
|
||||
github.com/containers/buildah v1.27.0 h1:LJ1ks7vKxwPzJGr5BWVvigbtVL9w7XeHtNEmiIOPJqI=
|
||||
github.com/containers/buildah v1.27.0/go.mod h1:anH3ExvDXRNP9zLQCrOc1vWb5CrhqLF/aYFim4tslvA=
|
||||
github.com/containers/common v0.49.1/go.mod h1:ueM5hT0itKqCQvVJDs+EtjornAQtrHYxQJzP2gxeGIg=
|
||||
github.com/containers/common v0.49.2-0.20220809074359-b0ea008ba661 h1:2Ldzg1st4REr5uUJRhjsye1zCbu0i/89RBh87Xc/cTY=
|
||||
github.com/containers/common v0.49.2-0.20220809074359-b0ea008ba661/go.mod h1:eT2iSsNzjOlF5VFLkyj9OU2SXznURvEYndsioQImuoE=
|
||||
github.com/containers/common v0.49.2-0.20220817132854-f6679f170eca h1:OjhEBVpFskIJ6Vq9nikYW7M6YXfkTxOBu+EQBoCyhuM=
|
||||
github.com/containers/common v0.49.2-0.20220817132854-f6679f170eca/go.mod h1:eT2iSsNzjOlF5VFLkyj9OU2SXznURvEYndsioQImuoE=
|
||||
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
|
||||
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
|
||||
github.com/containers/image/v5 v5.22.0 h1:KemxPmD4D2YYOFZN2SgoTk7nBFcnwPiPW0MqjYtknSE=
|
||||
|
23
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
23
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
@ -234,6 +234,10 @@ type EngineConfig struct {
|
||||
// The first path pointing to a valid file will be used.
|
||||
ConmonPath []string `toml:"conmon_path,omitempty"`
|
||||
|
||||
// ConmonRsPath is the path to the Conmon-rs binary used for managing containers.
|
||||
// The first path pointing to a valid file will be used.
|
||||
ConmonRsPath []string `toml:"conmonrs_path,omitempty"`
|
||||
|
||||
// CompatAPIEnforceDockerHub enforces using docker.io for completing
|
||||
// short names in Podman's compatibility REST API. Note that this will
|
||||
// ignore unqualified-search-registries and short-name aliases defined
|
||||
@ -915,8 +919,12 @@ func (c *NetworkConfig) Validate() error {
|
||||
// to first (version) matching conmon binary. If non is found, we try
|
||||
// to do a path lookup of "conmon".
|
||||
func (c *Config) FindConmon() (string, error) {
|
||||
return findConmonPath(c.Engine.ConmonPath, "conmon", _conmonMinMajorVersion, _conmonMinMinorVersion, _conmonMinPatchVersion)
|
||||
}
|
||||
|
||||
func findConmonPath(paths []string, binaryName string, major int, minor int, patch int) (string, error) {
|
||||
foundOutdatedConmon := false
|
||||
for _, path := range c.Engine.ConmonPath {
|
||||
for _, path := range paths {
|
||||
stat, err := os.Stat(path)
|
||||
if err != nil {
|
||||
continue
|
||||
@ -934,7 +942,7 @@ func (c *Config) FindConmon() (string, error) {
|
||||
}
|
||||
|
||||
// Search the $PATH as last fallback
|
||||
if path, err := exec.LookPath("conmon"); err == nil {
|
||||
if path, err := exec.LookPath(binaryName); err == nil {
|
||||
if err := probeConmon(path); err != nil {
|
||||
logrus.Warnf("Conmon at %s is invalid: %v", path, err)
|
||||
foundOutdatedConmon = true
|
||||
@ -946,11 +954,18 @@ func (c *Config) FindConmon() (string, error) {
|
||||
|
||||
if foundOutdatedConmon {
|
||||
return "", fmt.Errorf("please update to v%d.%d.%d or later: %w",
|
||||
_conmonMinMajorVersion, _conmonMinMinorVersion, _conmonMinPatchVersion, ErrConmonOutdated)
|
||||
major, minor, patch, ErrConmonOutdated)
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("could not find a working conmon binary (configured options: %v: %w)",
|
||||
c.Engine.ConmonPath, ErrInvalidArg)
|
||||
paths, ErrInvalidArg)
|
||||
}
|
||||
|
||||
// FindConmonRs iterates over (*Config).ConmonRsPath and returns the path
|
||||
// to first (version) matching conmonrs binary. If non is found, we try
|
||||
// to do a path lookup of "conmonrs".
|
||||
func (c *Config) FindConmonRs() (string, error) {
|
||||
return findConmonPath(c.Engine.ConmonRsPath, "conmonrs", _conmonrsMinMajorVersion, _conmonrsMinMinorVersion, _conmonrsMinPatchVersion)
|
||||
}
|
||||
|
||||
// GetDefaultEnv returns the environment variables for the container.
|
||||
|
60
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
60
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
@ -33,6 +33,15 @@ const (
|
||||
// _conmonMinPatchVersion is the sub-minor version required for conmon.
|
||||
_conmonMinPatchVersion = 1
|
||||
|
||||
// _conmonrsMinMajorVersion is the major version required for conmonrs.
|
||||
_conmonrsMinMajorVersion = 0
|
||||
|
||||
// _conmonrsMinMinorVersion is the minor version required for conmonrs.
|
||||
_conmonrsMinMinorVersion = 1
|
||||
|
||||
// _conmonrsMinPatchVersion is the sub-minor version required for conmonrs.
|
||||
_conmonrsMinPatchVersion = 0
|
||||
|
||||
// _conmonVersionFormatErr is used when the expected versio-format of conmon
|
||||
// has changed.
|
||||
_conmonVersionFormatErr = "conmon version changed format: %w"
|
||||
@ -276,7 +285,9 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
|
||||
c.CompatAPIEnforceDockerHub = true
|
||||
|
||||
if path, ok := os.LookupEnv("CONTAINERS_STORAGE_CONF"); ok {
|
||||
types.SetDefaultConfigFilePath(path)
|
||||
if err := types.SetDefaultConfigFilePath(path); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
storeOpts, err := types.DefaultStoreOptions(unshare.IsRootless(), unshare.GetRootlessUID())
|
||||
if err != nil {
|
||||
@ -372,6 +383,16 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
|
||||
"/usr/local/sbin/conmon",
|
||||
"/run/current-system/sw/bin/conmon",
|
||||
}
|
||||
c.ConmonRsPath = []string{
|
||||
"/usr/libexec/podman/conmonrs",
|
||||
"/usr/local/libexec/podman/conmonrs",
|
||||
"/usr/local/lib/podman/conmonrs",
|
||||
"/usr/bin/conmonrs",
|
||||
"/usr/sbin/conmonrs",
|
||||
"/usr/local/bin/conmonrs",
|
||||
"/usr/local/sbin/conmonrs",
|
||||
"/run/current-system/sw/bin/conmonrs",
|
||||
}
|
||||
c.PullPolicy = DefaultPullPolicy
|
||||
c.RuntimeSupportsJSON = []string{
|
||||
"crun",
|
||||
@ -434,42 +455,55 @@ func probeConmon(conmonBinary string) error {
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
r := regexp.MustCompile(`^conmon version (?P<Major>\d+).(?P<Minor>\d+).(?P<Patch>\d+)`)
|
||||
r := regexp.MustCompile(`^(version:|conmon version)? (?P<Major>\d+).(?P<Minor>\d+).(?P<Patch>\d+)`)
|
||||
|
||||
matches := r.FindStringSubmatch(out.String())
|
||||
if len(matches) != 4 {
|
||||
return errors.New(_conmonVersionFormatErr)
|
||||
if len(matches) != 5 {
|
||||
return fmt.Errorf(_conmonVersionFormatErr, errors.New("invalid version format"))
|
||||
}
|
||||
major, err := strconv.Atoi(matches[1])
|
||||
major, err := strconv.Atoi(matches[2])
|
||||
|
||||
var minMajor, minMinor, minPatch int
|
||||
// conmon-rs returns "^version:"
|
||||
if matches[1] == "version:" {
|
||||
minMajor = _conmonrsMinMajorVersion
|
||||
minMinor = _conmonrsMinMinorVersion
|
||||
minPatch = _conmonrsMinPatchVersion
|
||||
} else {
|
||||
minMajor = _conmonMinMajorVersion
|
||||
minMinor = _conmonMinMinorVersion
|
||||
minPatch = _conmonMinPatchVersion
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf(_conmonVersionFormatErr, err)
|
||||
}
|
||||
if major < _conmonMinMajorVersion {
|
||||
if major < minMajor {
|
||||
return ErrConmonOutdated
|
||||
}
|
||||
if major > _conmonMinMajorVersion {
|
||||
if major > minMajor {
|
||||
return nil
|
||||
}
|
||||
|
||||
minor, err := strconv.Atoi(matches[2])
|
||||
minor, err := strconv.Atoi(matches[3])
|
||||
if err != nil {
|
||||
return fmt.Errorf(_conmonVersionFormatErr, err)
|
||||
}
|
||||
if minor < _conmonMinMinorVersion {
|
||||
if minor < minMinor {
|
||||
return ErrConmonOutdated
|
||||
}
|
||||
if minor > _conmonMinMinorVersion {
|
||||
if minor > minMinor {
|
||||
return nil
|
||||
}
|
||||
|
||||
patch, err := strconv.Atoi(matches[3])
|
||||
patch, err := strconv.Atoi(matches[4])
|
||||
if err != nil {
|
||||
return fmt.Errorf(_conmonVersionFormatErr, err)
|
||||
}
|
||||
if patch < _conmonMinPatchVersion {
|
||||
if patch < minPatch {
|
||||
return ErrConmonOutdated
|
||||
}
|
||||
if patch > _conmonMinPatchVersion {
|
||||
if patch > minPatch {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -114,7 +114,7 @@ github.com/containers/buildah/pkg/rusage
|
||||
github.com/containers/buildah/pkg/sshagent
|
||||
github.com/containers/buildah/pkg/util
|
||||
github.com/containers/buildah/util
|
||||
# github.com/containers/common v0.49.2-0.20220809074359-b0ea008ba661
|
||||
# github.com/containers/common v0.49.2-0.20220817132854-f6679f170eca
|
||||
## explicit
|
||||
github.com/containers/common/libimage
|
||||
github.com/containers/common/libimage/define
|
||||
|
Reference in New Issue
Block a user