Merge pull request #6061 from thaJeztah/bump_engine

vendor: github.com/docker/docker cb38cc0fdd55 (master, v28.x dev)
This commit is contained in:
Paweł Gronowski 2025-05-13 07:51:58 +00:00 committed by GitHub
commit 518ba2b4d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 98 additions and 50 deletions

View File

@ -14,7 +14,7 @@ require (
github.com/distribution/reference v0.6.0 github.com/distribution/reference v0.6.0
github.com/docker/cli-docs-tool v0.9.0 github.com/docker/cli-docs-tool v0.9.0
github.com/docker/distribution v2.8.3+incompatible github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v28.1.1+incompatible github.com/docker/docker v28.1.2-0.20250512131816-cb38cc0fdd55+incompatible // master, v28.x dev
github.com/docker/docker-credential-helpers v0.9.3 github.com/docker/docker-credential-helpers v0.9.3
github.com/docker/go-connections v0.5.0 github.com/docker/go-connections v0.5.0
github.com/docker/go-units v0.5.0 github.com/docker/go-units v0.5.0

View File

@ -53,8 +53,8 @@ github.com/docker/cli-docs-tool v0.9.0/go.mod h1:ClrwlNW+UioiRyH9GiAOe1o3J/TsY3T
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v28.1.1+incompatible h1:49M11BFLsVO1gxY9UX9p/zwkE/rswggs8AdFmXQw51I= github.com/docker/docker v28.1.2-0.20250512131816-cb38cc0fdd55+incompatible h1:O65IbOqdNmZ8B9YyHAzKscG9XuQkzPFD2SX/JhCHkBk=
github.com/docker/docker v28.1.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v28.1.2-0.20250512131816-cb38cc0fdd55+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8=
github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo=
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=

View File

@ -1,18 +1,27 @@
package container package container
import "time" import (
"fmt"
"strings"
"time"
)
// HealthStatus is a string representation of the container's health.
//
// It currently is an alias for string, but may become a distinct type in future.
type HealthStatus = string
// Health states // Health states
const ( const (
NoHealthcheck = "none" // Indicates there is no healthcheck NoHealthcheck HealthStatus = "none" // Indicates there is no healthcheck
Starting = "starting" // Starting indicates that the container is not yet ready Starting HealthStatus = "starting" // Starting indicates that the container is not yet ready
Healthy = "healthy" // Healthy indicates that the container is running correctly Healthy HealthStatus = "healthy" // Healthy indicates that the container is running correctly
Unhealthy = "unhealthy" // Unhealthy indicates that the container has a problem Unhealthy HealthStatus = "unhealthy" // Unhealthy indicates that the container has a problem
) )
// Health stores information about the container's healthcheck results // Health stores information about the container's healthcheck results
type Health struct { type Health struct {
Status string // Status is one of [Starting], [Healthy] or [Unhealthy]. Status HealthStatus // Status is one of [Starting], [Healthy] or [Unhealthy].
FailingStreak int // FailingStreak is the number of consecutive failures FailingStreak int // FailingStreak is the number of consecutive failures
Log []*HealthcheckResult // Log contains the last few results (oldest first) Log []*HealthcheckResult // Log contains the last few results (oldest first)
} }
@ -24,3 +33,18 @@ type HealthcheckResult struct {
ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe
Output string // Output from last check Output string // Output from last check
} }
var validHealths = []string{
NoHealthcheck, Starting, Healthy, Unhealthy,
}
// ValidateHealthStatus checks if the provided string is a valid
// container [HealthStatus].
func ValidateHealthStatus(s HealthStatus) error {
switch s {
case NoHealthcheck, Starting, Healthy, Unhealthy:
return nil
default:
return errInvalidParameter{error: fmt.Errorf("invalid value for health (%s): must be one of %s", s, strings.Join(validHealths, ", "))}
}
}

View File

@ -145,7 +145,7 @@ func (n NetworkMode) IsDefault() bool {
// IsPrivate indicates whether container uses its private network stack. // IsPrivate indicates whether container uses its private network stack.
func (n NetworkMode) IsPrivate() bool { func (n NetworkMode) IsPrivate() bool {
return !(n.IsHost() || n.IsContainer()) return !n.IsHost() && !n.IsContainer()
} }
// IsContainer indicates whether container uses a container network stack. // IsContainer indicates whether container uses a container network stack.
@ -230,7 +230,7 @@ type PidMode string
// IsPrivate indicates whether the container uses its own new pid namespace. // IsPrivate indicates whether the container uses its own new pid namespace.
func (n PidMode) IsPrivate() bool { func (n PidMode) IsPrivate() bool {
return !(n.IsHost() || n.IsContainer()) return !n.IsHost() && !n.IsContainer()
} }
// IsHost indicates whether the container uses the host's pid namespace. // IsHost indicates whether the container uses the host's pid namespace.

View File

@ -0,0 +1,29 @@
package container
// StateStatus is used to return container wait results.
// Implements exec.ExitCode interface.
// This type is needed as State include a sync.Mutex field which make
// copying it unsafe.
type StateStatus struct {
exitCode int
err error
}
// ExitCode returns current exitcode for the state.
func (s StateStatus) ExitCode() int {
return s.exitCode
}
// Err returns current error for the state. Returns nil if the container had
// exited on its own.
func (s StateStatus) Err() error {
return s.err
}
// NewStateStatus returns a new StateStatus with the given exit code and error.
func NewStateStatus(exitCode int, err error) StateStatus {
return StateStatus{
exitCode: exitCode,
err: err,
}
}

View File

@ -30,7 +30,7 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
var format string var format string
// if the string has a Z or a + or three dashes use parse otherwise use parseinlocation // if the string has a Z or a + or three dashes use parse otherwise use parseinlocation
parseInLocation := !(strings.ContainsAny(value, "zZ+") || strings.Count(value, "-") == 3) parseInLocation := !strings.ContainsAny(value, "zZ+") && strings.Count(value, "-") != 3
if strings.Contains(value, ".") { if strings.Contains(value, ".") {
if parseInLocation { if parseInLocation {
@ -105,23 +105,23 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
// since := time.Unix(seconds, nanoseconds) // since := time.Unix(seconds, nanoseconds)
// //
// returns seconds as defaultSeconds if value == "" // returns seconds as defaultSeconds if value == ""
func ParseTimestamps(value string, defaultSeconds int64) (seconds int64, nanoseconds int64, err error) { func ParseTimestamps(value string, defaultSeconds int64) (seconds int64, nanoseconds int64, _ error) {
if value == "" { if value == "" {
return defaultSeconds, 0, nil return defaultSeconds, 0, nil
} }
return parseTimestamp(value) return parseTimestamp(value)
} }
func parseTimestamp(value string) (sec int64, nsec int64, err error) { func parseTimestamp(value string) (seconds int64, nanoseconds int64, _ error) {
s, n, ok := strings.Cut(value, ".") s, n, ok := strings.Cut(value, ".")
sec, err = strconv.ParseInt(s, 10, 64) sec, err := strconv.ParseInt(s, 10, 64)
if err != nil { if err != nil {
return sec, 0, err return sec, 0, err
} }
if !ok { if !ok {
return sec, 0, nil return sec, 0, nil
} }
nsec, err = strconv.ParseInt(n, 10, 64) nsec, err := strconv.ParseInt(n, 10, 64)
if err != nil { if err != nil {
return sec, nsec, err return sec, nsec, err
} }

View File

@ -46,7 +46,7 @@ func Clone(remoteURL string, opts ...CloneOption) (string, error) {
return repo.clone() return repo.clone()
} }
func (repo gitRepo) clone() (checkoutDir string, err error) { func (repo gitRepo) clone() (checkoutDir string, retErr error) {
fetch := fetchArgs(repo.remote, repo.ref) fetch := fetchArgs(repo.remote, repo.ref)
root, err := os.MkdirTemp("", "docker-build-git") root, err := os.MkdirTemp("", "docker-build-git")
@ -55,8 +55,8 @@ func (repo gitRepo) clone() (checkoutDir string, err error) {
} }
defer func() { defer func() {
if err != nil { if retErr != nil {
os.RemoveAll(root) _ = os.RemoveAll(root)
} }
}() }()

View File

@ -15,7 +15,7 @@ import (
) )
// PluginInstall installs a plugin // PluginInstall installs a plugin
func (cli *Client) PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (rc io.ReadCloser, err error) { func (cli *Client) PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (_ io.ReadCloser, retErr error) {
query := url.Values{} query := url.Values{}
if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil { if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil {
return nil, errors.Wrap(err, "invalid remote reference") return nil, errors.Wrap(err, "invalid remote reference")
@ -45,7 +45,7 @@ func (cli *Client) PluginInstall(ctx context.Context, name string, options types
return return
} }
defer func() { defer func() {
if err != nil { if retErr != nil {
delResp, _ := cli.delete(ctx, "/plugins/"+name, nil, nil) delResp, _ := cli.delete(ctx, "/plugins/"+name, nil, nil)
ensureReaderClosed(delResp) ensureReaderClosed(delResp)
} }

View File

@ -36,7 +36,7 @@ func (e *joinError) Error() string {
} }
stringErrs := make([]string, 0, len(e.errs)) stringErrs := make([]string, 0, len(e.errs))
for _, subErr := range e.errs { for _, subErr := range e.errs {
stringErrs = append(stringErrs, strings.Replace(subErr.Error(), "\n", "\n\t", -1)) stringErrs = append(stringErrs, strings.ReplaceAll(subErr.Error(), "\n", "\n\t"))
} }
return "* " + strings.Join(stringErrs, "\n* ") return "* " + strings.Join(stringErrs, "\n* ")
} }

View File

@ -88,14 +88,14 @@ func NewCancelReadCloser(ctx context.Context, in io.ReadCloser) io.ReadCloser {
// Read wraps the Read method of the pipe that provides data from the wrapped // Read wraps the Read method of the pipe that provides data from the wrapped
// ReadCloser. // ReadCloser.
func (p *cancelReadCloser) Read(buf []byte) (n int, err error) { func (p *cancelReadCloser) Read(buf []byte) (int, error) {
return p.pR.Read(buf) return p.pR.Read(buf)
} }
// closeWithError closes the wrapper and its underlying reader. It will // closeWithError closes the wrapper and its underlying reader. It will
// cause future calls to Read to return err. // cause future calls to Read to return err.
func (p *cancelReadCloser) closeWithError(err error) { func (p *cancelReadCloser) closeWithError(err error) {
p.pW.CloseWithError(err) _ = p.pW.CloseWithError(err)
p.cancel() p.cancel()
} }

View File

@ -21,14 +21,14 @@ type flusher interface {
Flush() Flush()
} }
func (wf *WriteFlusher) Write(b []byte) (n int, err error) { func (wf *WriteFlusher) Write(b []byte) (int, error) {
select { select {
case <-wf.closed: case <-wf.closed:
return 0, io.EOF return 0, io.EOF
default: default:
} }
n, err = wf.w.Write(b) n, err := wf.w.Write(b)
wf.Flush() // every write is a flush. wf.Flush() // every write is a flush.
return n, err return n, err
} }

View File

@ -31,7 +31,7 @@ func NewProgressReader(in io.ReadCloser, out Output, size int64, id, action stri
} }
} }
func (p *Reader) Read(buf []byte) (n int, err error) { func (p *Reader) Read(buf []byte) (int, error) {
read, err := p.in.Read(buf) read, err := p.in.Read(buf)
p.current += int64(read) p.current += int64(read)
updateEvery := int64(1024 * 512) // 512kB updateEvery := int64(1024 * 512) // 512kB

View File

@ -91,12 +91,12 @@ func NewStdWriter(w io.Writer, t StdType) io.Writer {
// In other words: if `err` is non nil, it indicates a real underlying error. // In other words: if `err` is non nil, it indicates a real underlying error.
// //
// `written` will hold the total number of bytes written to `dstout` and `dsterr`. // `written` will hold the total number of bytes written to `dstout` and `dsterr`.
func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error) { func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) {
var ( var (
buf = make([]byte, startingBufLen) buf = make([]byte, startingBufLen)
bufLen = len(buf) bufLen = len(buf)
nr, nw int nr, nw int
er, ew error err error
out io.Writer out io.Writer
frameSize int frameSize int
) )
@ -105,16 +105,16 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
// Make sure we have at least a full header // Make sure we have at least a full header
for nr < stdWriterPrefixLen { for nr < stdWriterPrefixLen {
var nr2 int var nr2 int
nr2, er = src.Read(buf[nr:]) nr2, err = src.Read(buf[nr:])
nr += nr2 nr += nr2
if er == io.EOF { if err == io.EOF {
if nr < stdWriterPrefixLen { if nr < stdWriterPrefixLen {
return written, nil return written, nil
} }
break break
} }
if er != nil { if err != nil {
return 0, er return 0, err
} }
} }
@ -151,16 +151,16 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
// While the amount of bytes read is less than the size of the frame + header, we keep reading // While the amount of bytes read is less than the size of the frame + header, we keep reading
for nr < frameSize+stdWriterPrefixLen { for nr < frameSize+stdWriterPrefixLen {
var nr2 int var nr2 int
nr2, er = src.Read(buf[nr:]) nr2, err = src.Read(buf[nr:])
nr += nr2 nr += nr2
if er == io.EOF { if err == io.EOF {
if nr < frameSize+stdWriterPrefixLen { if nr < frameSize+stdWriterPrefixLen {
return written, nil return written, nil
} }
break break
} }
if er != nil { if err != nil {
return 0, er return 0, err
} }
} }
@ -171,9 +171,9 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
} }
// Write the retrieved frame (without header) // Write the retrieved frame (without header)
nw, ew = out.Write(buf[stdWriterPrefixLen : frameSize+stdWriterPrefixLen]) nw, err = out.Write(buf[stdWriterPrefixLen : frameSize+stdWriterPrefixLen])
if ew != nil { if err != nil {
return 0, ew return 0, err
} }
// If the frame has not been fully written: error // If the frame has not been fully written: error

View File

@ -163,14 +163,9 @@ func ParseSearchIndexInfo(reposName string) (*registry.IndexInfo, error) {
}, nil }, nil
} }
insecure := false
if isInsecure(indexName) {
insecure = true
}
return &registry.IndexInfo{ return &registry.IndexInfo{
Name: indexName, Name: indexName,
Mirrors: []string{}, Mirrors: []string{},
Secure: !insecure, Secure: !isInsecure(indexName),
}, nil }, nil
} }

View File

@ -40,7 +40,7 @@ func (s *Service) ServiceConfig() *registry.ServiceConfig {
// ReplaceConfig prepares a transaction which will atomically replace the // ReplaceConfig prepares a transaction which will atomically replace the
// registry service's configuration when the returned commit function is called. // registry service's configuration when the returned commit function is called.
func (s *Service) ReplaceConfig(options ServiceOptions) (commit func(), err error) { func (s *Service) ReplaceConfig(options ServiceOptions) (commit func(), _ error) {
config, err := newServiceConfig(options) config, err := newServiceConfig(options)
if err != nil { if err != nil {
return nil, err return nil, err
@ -148,7 +148,7 @@ type APIEndpoint struct {
// LookupPullEndpoints creates a list of v2 endpoints to try to pull from, in order of preference. // LookupPullEndpoints creates a list of v2 endpoints to try to pull from, in order of preference.
// It gives preference to mirrors over the actual registry, and HTTPS over plain HTTP. // It gives preference to mirrors over the actual registry, and HTTPS over plain HTTP.
func (s *Service) LookupPullEndpoints(hostname string) (endpoints []APIEndpoint, err error) { func (s *Service) LookupPullEndpoints(hostname string) ([]APIEndpoint, error) {
s.mu.RLock() s.mu.RLock()
defer s.mu.RUnlock() defer s.mu.RUnlock()
@ -157,7 +157,7 @@ func (s *Service) LookupPullEndpoints(hostname string) (endpoints []APIEndpoint,
// LookupPushEndpoints creates a list of v2 endpoints to try to push to, in order of preference. // LookupPushEndpoints creates a list of v2 endpoints to try to push to, in order of preference.
// It gives preference to HTTPS over plain HTTP. Mirrors are not included. // It gives preference to HTTPS over plain HTTP. Mirrors are not included.
func (s *Service) LookupPushEndpoints(hostname string) (endpoints []APIEndpoint, err error) { func (s *Service) LookupPushEndpoints(hostname string) ([]APIEndpoint, error) {
s.mu.RLock() s.mu.RLock()
defer s.mu.RUnlock() defer s.mu.RUnlock()

2
vendor/modules.txt vendored
View File

@ -58,7 +58,7 @@ github.com/docker/distribution/registry/client/transport
github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache
github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/registry/storage/cache/memory
github.com/docker/distribution/uuid github.com/docker/distribution/uuid
# github.com/docker/docker v28.1.1+incompatible # github.com/docker/docker v28.1.2-0.20250512131816-cb38cc0fdd55+incompatible
## explicit ## explicit
github.com/docker/docker/api github.com/docker/docker/api
github.com/docker/docker/api/types github.com/docker/docker/api/types