fix(deps): update module github.com/fsouza/go-dockerclient to v1.12.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
parent
48ac5410cb
commit
dcb6da0970
2
go.mod
2
go.mod
|
@ -14,7 +14,7 @@ require (
|
|||
github.com/docker/docker v28.3.3+incompatible
|
||||
github.com/docker/go-connections v0.6.0
|
||||
github.com/docker/go-units v0.5.0
|
||||
github.com/fsouza/go-dockerclient v1.12.1
|
||||
github.com/fsouza/go-dockerclient v1.12.2
|
||||
github.com/hashicorp/go-multierror v1.1.1
|
||||
github.com/mattn/go-shellwords v1.0.12
|
||||
github.com/moby/buildkit v0.23.2
|
||||
|
|
4
go.sum
4
go.sum
|
@ -90,8 +90,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2
|
|||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
|
||||
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/fsouza/go-dockerclient v1.12.1 h1:FMoLq+Zhv9Oz/rFmu6JWkImfr6CBgZOPcL+bHW4gS0o=
|
||||
github.com/fsouza/go-dockerclient v1.12.1/go.mod h1:OqsgJJcpCwqyM3JED7TdfM9QVWS5O7jSYwXxYKmOooY=
|
||||
github.com/fsouza/go-dockerclient v1.12.2 h1:+pbP/SacoHfqaVZuiudvcdYGd9jzU7y9EcgoBOHivEI=
|
||||
github.com/fsouza/go-dockerclient v1.12.2/go.mod h1:ZGCkAsnBGjnTRG9wV6QaICPJ5ig2KlaxTccDQy5WQ38=
|
||||
github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE=
|
||||
github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA=
|
||||
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
||||
|
|
|
@ -1,259 +0,0 @@
|
|||
// Package archive provides helper functions for dealing with archive files.
|
||||
package archive
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/go-archive/tarheader"
|
||||
)
|
||||
|
||||
// ImpliedDirectoryMode represents the mode (Unix permissions) applied to directories that are implied by files in a
|
||||
// tar, but that do not have their own header entry.
|
||||
//
|
||||
// Deprecated: use [archive.ImpliedDirectoryMode] instead.
|
||||
const ImpliedDirectoryMode = archive.ImpliedDirectoryMode
|
||||
|
||||
type (
|
||||
// Compression is the state represents if compressed or not.
|
||||
//
|
||||
// Deprecated: use [compression.Compression] instead.
|
||||
Compression = compression.Compression
|
||||
// WhiteoutFormat is the format of whiteouts unpacked
|
||||
//
|
||||
// Deprecated: use [archive.WhiteoutFormat] instead.
|
||||
WhiteoutFormat = archive.WhiteoutFormat
|
||||
|
||||
// TarOptions wraps the tar options.
|
||||
//
|
||||
// Deprecated: use [archive.TarOptions] instead.
|
||||
TarOptions struct {
|
||||
IncludeFiles []string
|
||||
ExcludePatterns []string
|
||||
Compression compression.Compression
|
||||
NoLchown bool
|
||||
IDMap idtools.IdentityMapping
|
||||
ChownOpts *idtools.Identity
|
||||
IncludeSourceDir bool
|
||||
// WhiteoutFormat is the expected on disk format for whiteout files.
|
||||
// This format will be converted to the standard format on pack
|
||||
// and from the standard format on unpack.
|
||||
WhiteoutFormat archive.WhiteoutFormat
|
||||
// When unpacking, specifies whether overwriting a directory with a
|
||||
// non-directory is allowed and vice versa.
|
||||
NoOverwriteDirNonDir bool
|
||||
// For each include when creating an archive, the included name will be
|
||||
// replaced with the matching name from this map.
|
||||
RebaseNames map[string]string
|
||||
InUserNS bool
|
||||
// Allow unpacking to succeed in spite of failures to set extended
|
||||
// attributes on the unpacked files due to the destination filesystem
|
||||
// not supporting them or a lack of permissions. Extended attributes
|
||||
// were probably in the archive for a reason, so set this option at
|
||||
// your own peril.
|
||||
BestEffortXattrs bool
|
||||
}
|
||||
)
|
||||
|
||||
// Archiver implements the Archiver interface and allows the reuse of most utility functions of
|
||||
// this package with a pluggable Untar function. Also, to facilitate the passing of specific id
|
||||
// mappings for untar, an Archiver can be created with maps which will then be passed to Untar operations.
|
||||
//
|
||||
// Deprecated: use [archive.Archiver] instead.
|
||||
type Archiver struct {
|
||||
Untar func(io.Reader, string, *TarOptions) error
|
||||
IDMapping idtools.IdentityMapping
|
||||
}
|
||||
|
||||
// NewDefaultArchiver returns a new Archiver without any IdentityMapping
|
||||
//
|
||||
// Deprecated: use [archive.NewDefaultArchiver] instead.
|
||||
func NewDefaultArchiver() *Archiver {
|
||||
return &Archiver{Untar: Untar}
|
||||
}
|
||||
|
||||
const (
|
||||
Uncompressed = compression.None // Deprecated: use [compression.None] instead.
|
||||
Bzip2 = compression.Bzip2 // Deprecated: use [compression.Bzip2] instead.
|
||||
Gzip = compression.Gzip // Deprecated: use [compression.Gzip] instead.
|
||||
Xz = compression.Xz // Deprecated: use [compression.Xz] instead.
|
||||
Zstd = compression.Zstd // Deprecated: use [compression.Zstd] instead.
|
||||
)
|
||||
|
||||
const (
|
||||
AUFSWhiteoutFormat = archive.AUFSWhiteoutFormat // Deprecated: use [archive.AUFSWhiteoutFormat] instead.
|
||||
OverlayWhiteoutFormat = archive.OverlayWhiteoutFormat // Deprecated: use [archive.OverlayWhiteoutFormat] instead.
|
||||
)
|
||||
|
||||
// IsArchivePath checks if the (possibly compressed) file at the given path
|
||||
// starts with a tar file header.
|
||||
//
|
||||
// Deprecated: use [archive.IsArchivePath] instead.
|
||||
func IsArchivePath(path string) bool {
|
||||
return archive.IsArchivePath(path)
|
||||
}
|
||||
|
||||
// DetectCompression detects the compression algorithm of the source.
|
||||
//
|
||||
// Deprecated: use [compression.Detect] instead.
|
||||
func DetectCompression(source []byte) archive.Compression {
|
||||
return compression.Detect(source)
|
||||
}
|
||||
|
||||
// DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive.
|
||||
//
|
||||
// Deprecated: use [compression.DecompressStream] instead.
|
||||
func DecompressStream(arch io.Reader) (io.ReadCloser, error) {
|
||||
return compression.DecompressStream(arch)
|
||||
}
|
||||
|
||||
// CompressStream compresses the dest with specified compression algorithm.
|
||||
//
|
||||
// Deprecated: use [compression.CompressStream] instead.
|
||||
func CompressStream(dest io.Writer, comp compression.Compression) (io.WriteCloser, error) {
|
||||
return compression.CompressStream(dest, comp)
|
||||
}
|
||||
|
||||
// TarModifierFunc is a function that can be passed to ReplaceFileTarWrapper.
|
||||
//
|
||||
// Deprecated: use [archive.TarModifierFunc] instead.
|
||||
type TarModifierFunc = archive.TarModifierFunc
|
||||
|
||||
// ReplaceFileTarWrapper converts inputTarStream to a new tar stream.
|
||||
//
|
||||
// Deprecated: use [archive.ReplaceFileTarWrapper] instead.
|
||||
func ReplaceFileTarWrapper(inputTarStream io.ReadCloser, mods map[string]archive.TarModifierFunc) io.ReadCloser {
|
||||
return archive.ReplaceFileTarWrapper(inputTarStream, mods)
|
||||
}
|
||||
|
||||
// FileInfoHeaderNoLookups creates a partially-populated tar.Header from fi.
|
||||
//
|
||||
// Deprecated: use [tarheader.FileInfoHeaderNoLookups] instead.
|
||||
func FileInfoHeaderNoLookups(fi os.FileInfo, link string) (*tar.Header, error) {
|
||||
return tarheader.FileInfoHeaderNoLookups(fi, link)
|
||||
}
|
||||
|
||||
// FileInfoHeader creates a populated Header from fi.
|
||||
//
|
||||
// Deprecated: use [archive.FileInfoHeader] instead.
|
||||
func FileInfoHeader(name string, fi os.FileInfo, link string) (*tar.Header, error) {
|
||||
return archive.FileInfoHeader(name, fi, link)
|
||||
}
|
||||
|
||||
// ReadSecurityXattrToTarHeader reads security.capability xattr from filesystem
|
||||
// to a tar header
|
||||
//
|
||||
// Deprecated: use [archive.ReadSecurityXattrToTarHeader] instead.
|
||||
func ReadSecurityXattrToTarHeader(path string, hdr *tar.Header) error {
|
||||
return archive.ReadSecurityXattrToTarHeader(path, hdr)
|
||||
}
|
||||
|
||||
// Tar creates an archive from the directory at `path`, and returns it as a
|
||||
// stream of bytes.
|
||||
//
|
||||
// Deprecated: use [archive.Tar] instead.
|
||||
func Tar(path string, compression archive.Compression) (io.ReadCloser, error) {
|
||||
return archive.TarWithOptions(path, &archive.TarOptions{Compression: compression})
|
||||
}
|
||||
|
||||
// TarWithOptions creates an archive with the given options.
|
||||
//
|
||||
// Deprecated: use [archive.TarWithOptions] instead.
|
||||
func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) {
|
||||
return archive.TarWithOptions(srcPath, toArchiveOpt(options))
|
||||
}
|
||||
|
||||
// Tarballer is a lower-level interface to TarWithOptions.
|
||||
//
|
||||
// Deprecated: use [archive.Tarballer] instead.
|
||||
type Tarballer = archive.Tarballer
|
||||
|
||||
// NewTarballer constructs a new tarballer using TarWithOptions.
|
||||
//
|
||||
// Deprecated: use [archive.Tarballer] instead.
|
||||
func NewTarballer(srcPath string, options *TarOptions) (*archive.Tarballer, error) {
|
||||
return archive.NewTarballer(srcPath, toArchiveOpt(options))
|
||||
}
|
||||
|
||||
// Unpack unpacks the decompressedArchive to dest with options.
|
||||
//
|
||||
// Deprecated: use [archive.Unpack] instead.
|
||||
func Unpack(decompressedArchive io.Reader, dest string, options *TarOptions) error {
|
||||
return archive.Unpack(decompressedArchive, dest, toArchiveOpt(options))
|
||||
}
|
||||
|
||||
// Untar reads a stream of bytes from `archive`, parses it as a tar archive,
|
||||
// and unpacks it into the directory at `dest`.
|
||||
//
|
||||
// Deprecated: use [archive.Untar] instead.
|
||||
func Untar(tarArchive io.Reader, dest string, options *TarOptions) error {
|
||||
return archive.Untar(tarArchive, dest, toArchiveOpt(options))
|
||||
}
|
||||
|
||||
// UntarUncompressed reads a stream of bytes from `tarArchive`, parses it as a tar archive,
|
||||
// and unpacks it into the directory at `dest`.
|
||||
// The archive must be an uncompressed stream.
|
||||
//
|
||||
// Deprecated: use [archive.UntarUncompressed] instead.
|
||||
func UntarUncompressed(tarArchive io.Reader, dest string, options *TarOptions) error {
|
||||
return archive.UntarUncompressed(tarArchive, dest, toArchiveOpt(options))
|
||||
}
|
||||
|
||||
// TarUntar is a convenience function which calls Tar and Untar, with the output of one piped into the other.
|
||||
// If either Tar or Untar fails, TarUntar aborts and returns the error.
|
||||
func (archiver *Archiver) TarUntar(src, dst string) error {
|
||||
return (&archive.Archiver{
|
||||
Untar: func(reader io.Reader, s string, options *archive.TarOptions) error {
|
||||
return archiver.Untar(reader, s, &TarOptions{
|
||||
IDMap: archiver.IDMapping,
|
||||
})
|
||||
},
|
||||
IDMapping: idtools.ToUserIdentityMapping(archiver.IDMapping),
|
||||
}).TarUntar(src, dst)
|
||||
}
|
||||
|
||||
// UntarPath untar a file from path to a destination, src is the source tar file path.
|
||||
func (archiver *Archiver) UntarPath(src, dst string) error {
|
||||
return (&archive.Archiver{
|
||||
Untar: func(reader io.Reader, s string, options *archive.TarOptions) error {
|
||||
return archiver.Untar(reader, s, &TarOptions{
|
||||
IDMap: archiver.IDMapping,
|
||||
})
|
||||
},
|
||||
IDMapping: idtools.ToUserIdentityMapping(archiver.IDMapping),
|
||||
}).UntarPath(src, dst)
|
||||
}
|
||||
|
||||
// CopyWithTar creates a tar archive of filesystem path `src`, and
|
||||
// unpacks it at filesystem path `dst`.
|
||||
// The archive is streamed directly with fixed buffering and no
|
||||
// intermediary disk IO.
|
||||
func (archiver *Archiver) CopyWithTar(src, dst string) error {
|
||||
return (&archive.Archiver{
|
||||
Untar: func(reader io.Reader, s string, options *archive.TarOptions) error {
|
||||
return archiver.Untar(reader, s, nil)
|
||||
},
|
||||
IDMapping: idtools.ToUserIdentityMapping(archiver.IDMapping),
|
||||
}).CopyWithTar(src, dst)
|
||||
}
|
||||
|
||||
// CopyFileWithTar emulates the behavior of the 'cp' command-line
|
||||
// for a single file. It copies a regular file from path `src` to
|
||||
// path `dst`, and preserves all its metadata.
|
||||
func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
|
||||
return (&archive.Archiver{
|
||||
Untar: func(reader io.Reader, s string, options *archive.TarOptions) error {
|
||||
return archiver.Untar(reader, s, nil)
|
||||
},
|
||||
IDMapping: idtools.ToUserIdentityMapping(archiver.IDMapping),
|
||||
}).CopyFileWithTar(src, dst)
|
||||
}
|
||||
|
||||
// IdentityMapping returns the IdentityMapping of the archiver.
|
||||
func (archiver *Archiver) IdentityMapping() idtools.IdentityMapping {
|
||||
return archiver.IDMapping
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package archive
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/moby/go-archive"
|
||||
)
|
||||
|
||||
// ChangeType represents the change
|
||||
//
|
||||
// Deprecated: use [archive.ChangeType] instead.
|
||||
type ChangeType = archive.ChangeType
|
||||
|
||||
const (
|
||||
ChangeModify = archive.ChangeModify // Deprecated: use [archive.ChangeModify] instead.
|
||||
ChangeAdd = archive.ChangeAdd // Deprecated: use [archive.ChangeAdd] instead.
|
||||
ChangeDelete = archive.ChangeDelete // Deprecated: use [archive.ChangeDelete] instead.
|
||||
)
|
||||
|
||||
// Change represents a change.
|
||||
//
|
||||
// Deprecated: use [archive.Change] instead.
|
||||
type Change = archive.Change
|
||||
|
||||
// Changes walks the path rw and determines changes for the files in the path,
|
||||
// with respect to the parent layers
|
||||
//
|
||||
// Deprecated: use [archive.Changes] instead.
|
||||
func Changes(layers []string, rw string) ([]archive.Change, error) {
|
||||
return archive.Changes(layers, rw)
|
||||
}
|
||||
|
||||
// FileInfo describes the information of a file.
|
||||
//
|
||||
// Deprecated: use [archive.FileInfo] instead.
|
||||
type FileInfo = archive.FileInfo
|
||||
|
||||
// ChangesDirs compares two directories and generates an array of Change objects describing the changes.
|
||||
//
|
||||
// Deprecated: use [archive.ChangesDirs] instead.
|
||||
func ChangesDirs(newDir, oldDir string) ([]archive.Change, error) {
|
||||
return archive.ChangesDirs(newDir, oldDir)
|
||||
}
|
||||
|
||||
// ChangesSize calculates the size in bytes of the provided changes, based on newDir.
|
||||
//
|
||||
// Deprecated: use [archive.ChangesSize] instead.
|
||||
func ChangesSize(newDir string, changes []archive.Change) int64 {
|
||||
return archive.ChangesSize(newDir, changes)
|
||||
}
|
||||
|
||||
// ExportChanges produces an Archive from the provided changes, relative to dir.
|
||||
func ExportChanges(dir string, changes []archive.Change, idMap idtools.IdentityMapping) (io.ReadCloser, error) {
|
||||
return archive.ExportChanges(dir, changes, idtools.ToUserIdentityMapping(idMap))
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package archive
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotDirectory = archive.ErrNotDirectory // Deprecated: use [archive.ErrNotDirectory] instead.
|
||||
ErrDirNotExists = archive.ErrDirNotExists // Deprecated: use [archive.ErrDirNotExists] instead.
|
||||
ErrCannotCopyDir = archive.ErrCannotCopyDir // Deprecated: use [archive.ErrCannotCopyDir] instead.
|
||||
ErrInvalidCopySource = archive.ErrInvalidCopySource // Deprecated: use [archive.ErrInvalidCopySource] instead.
|
||||
)
|
||||
|
||||
// PreserveTrailingDotOrSeparator returns the given cleaned path.
|
||||
//
|
||||
// Deprecated: use [archive.PreserveTrailingDotOrSeparator] instead.
|
||||
func PreserveTrailingDotOrSeparator(cleanedPath string, originalPath string) string {
|
||||
return archive.PreserveTrailingDotOrSeparator(cleanedPath, originalPath)
|
||||
}
|
||||
|
||||
// SplitPathDirEntry splits the given path between its directory name and its
|
||||
// basename.
|
||||
//
|
||||
// Deprecated: use [archive.SplitPathDirEntry] instead.
|
||||
func SplitPathDirEntry(path string) (dir, base string) {
|
||||
return archive.SplitPathDirEntry(path)
|
||||
}
|
||||
|
||||
// TarResource archives the resource described by the given CopyInfo to a Tar
|
||||
// archive.
|
||||
//
|
||||
// Deprecated: use [archive.TarResource] instead.
|
||||
func TarResource(sourceInfo archive.CopyInfo) (content io.ReadCloser, err error) {
|
||||
return archive.TarResource(sourceInfo)
|
||||
}
|
||||
|
||||
// TarResourceRebase is like TarResource but renames the first path element of
|
||||
// items in the resulting tar archive to match the given rebaseName if not "".
|
||||
//
|
||||
// Deprecated: use [archive.TarResourceRebase] instead.
|
||||
func TarResourceRebase(sourcePath, rebaseName string) (content io.ReadCloser, _ error) {
|
||||
return archive.TarResourceRebase(sourcePath, rebaseName)
|
||||
}
|
||||
|
||||
// TarResourceRebaseOpts does not preform the Tar, but instead just creates the rebase
|
||||
// parameters to be sent to TarWithOptions.
|
||||
//
|
||||
// Deprecated: use [archive.TarResourceRebaseOpts] instead.
|
||||
func TarResourceRebaseOpts(sourceBase string, rebaseName string) *TarOptions {
|
||||
filter := []string{sourceBase}
|
||||
return &TarOptions{
|
||||
Compression: compression.None,
|
||||
IncludeFiles: filter,
|
||||
IncludeSourceDir: true,
|
||||
RebaseNames: map[string]string{
|
||||
sourceBase: rebaseName,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// CopyInfo holds basic info about the source or destination path of a copy operation.
|
||||
//
|
||||
// Deprecated: use [archive.CopyInfo] instead.
|
||||
type CopyInfo = archive.CopyInfo
|
||||
|
||||
// CopyInfoSourcePath stats the given path to create a CopyInfo struct.
|
||||
// struct representing that resource for the source of an archive copy
|
||||
// operation.
|
||||
//
|
||||
// Deprecated: use [archive.CopyInfoSourcePath] instead.
|
||||
func CopyInfoSourcePath(path string, followLink bool) (archive.CopyInfo, error) {
|
||||
return archive.CopyInfoSourcePath(path, followLink)
|
||||
}
|
||||
|
||||
// CopyInfoDestinationPath stats the given path to create a CopyInfo
|
||||
// struct representing that resource for the destination of an archive copy
|
||||
// operation.
|
||||
//
|
||||
// Deprecated: use [archive.CopyInfoDestinationPath] instead.
|
||||
func CopyInfoDestinationPath(path string) (info archive.CopyInfo, err error) {
|
||||
return archive.CopyInfoDestinationPath(path)
|
||||
}
|
||||
|
||||
// PrepareArchiveCopy prepares the given srcContent archive.
|
||||
//
|
||||
// Deprecated: use [archive.PrepareArchiveCopy] instead.
|
||||
func PrepareArchiveCopy(srcContent io.Reader, srcInfo, dstInfo archive.CopyInfo) (dstDir string, content io.ReadCloser, err error) {
|
||||
return archive.PrepareArchiveCopy(srcContent, srcInfo, dstInfo)
|
||||
}
|
||||
|
||||
// RebaseArchiveEntries rewrites the given srcContent archive replacing
|
||||
// an occurrence of oldBase with newBase at the beginning of entry names.
|
||||
//
|
||||
// Deprecated: use [archive.RebaseArchiveEntries] instead.
|
||||
func RebaseArchiveEntries(srcContent io.Reader, oldBase, newBase string) io.ReadCloser {
|
||||
return archive.RebaseArchiveEntries(srcContent, oldBase, newBase)
|
||||
}
|
||||
|
||||
// CopyResource performs an archive copy from the given source path to the
|
||||
// given destination path.
|
||||
//
|
||||
// Deprecated: use [archive.CopyResource] instead.
|
||||
func CopyResource(srcPath, dstPath string, followLink bool) error {
|
||||
return archive.CopyResource(srcPath, dstPath, followLink)
|
||||
}
|
||||
|
||||
// CopyTo handles extracting the given content whose
|
||||
// entries should be sourced from srcInfo to dstPath.
|
||||
//
|
||||
// Deprecated: use [archive.CopyTo] instead.
|
||||
func CopyTo(content io.Reader, srcInfo archive.CopyInfo, dstPath string) error {
|
||||
return archive.CopyTo(content, srcInfo, dstPath)
|
||||
}
|
||||
|
||||
// ResolveHostSourcePath decides real path need to be copied.
|
||||
//
|
||||
// Deprecated: use [archive.ResolveHostSourcePath] instead.
|
||||
func ResolveHostSourcePath(path string, followLink bool) (resolvedPath, rebaseName string, _ error) {
|
||||
return archive.ResolveHostSourcePath(path, followLink)
|
||||
}
|
||||
|
||||
// GetRebaseName normalizes and compares path and resolvedPath.
|
||||
//
|
||||
// Deprecated: use [archive.GetRebaseName] instead.
|
||||
func GetRebaseName(path, resolvedPath string) (string, string) {
|
||||
return archive.GetRebaseName(path, resolvedPath)
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package archive
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/moby/go-archive"
|
||||
)
|
||||
|
||||
// UnpackLayer unpack `layer` to a `dest`.
|
||||
//
|
||||
// Deprecated: use [archive.UnpackLayer] instead.
|
||||
func UnpackLayer(dest string, layer io.Reader, options *TarOptions) (size int64, err error) {
|
||||
return archive.UnpackLayer(dest, layer, toArchiveOpt(options))
|
||||
}
|
||||
|
||||
// ApplyLayer parses a diff in the standard layer format from `layer`,
|
||||
// and applies it to the directory `dest`.
|
||||
//
|
||||
// Deprecated: use [archive.ApplyLayer] instead.
|
||||
func ApplyLayer(dest string, layer io.Reader) (int64, error) {
|
||||
return archive.ApplyLayer(dest, layer)
|
||||
}
|
||||
|
||||
// ApplyUncompressedLayer parses a diff in the standard layer format from
|
||||
// `layer`, and applies it to the directory `dest`.
|
||||
//
|
||||
// Deprecated: use [archive.ApplyUncompressedLayer] instead.
|
||||
func ApplyUncompressedLayer(dest string, layer io.Reader, options *TarOptions) (int64, error) {
|
||||
return archive.ApplyUncompressedLayer(dest, layer, toArchiveOpt(options))
|
||||
}
|
||||
|
||||
// IsEmpty checks if the tar archive is empty (doesn't contain any entries).
|
||||
//
|
||||
// Deprecated: use [archive.IsEmpty] instead.
|
||||
func IsEmpty(rd io.Reader) (bool, error) {
|
||||
return archive.IsEmpty(rd)
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package archive
|
||||
|
||||
import "github.com/moby/go-archive"
|
||||
|
||||
// CheckSystemDriveAndRemoveDriveLetter verifies that a path is the system drive.
|
||||
//
|
||||
// Deprecated: use [archive.CheckSystemDriveAndRemoveDriveLetter] instead.
|
||||
func CheckSystemDriveAndRemoveDriveLetter(path string) (string, error) {
|
||||
return archive.CheckSystemDriveAndRemoveDriveLetter(path)
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package archive
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/moby/go-archive"
|
||||
)
|
||||
|
||||
// ToArchiveOpt converts an [TarOptions] to a [archive.TarOptions].
|
||||
//
|
||||
// Deprecated: use [archive.TarOptions] instead, this utility is for internal use to transition to the [github.com/moby/go-archive] module.
|
||||
func ToArchiveOpt(options *TarOptions) *archive.TarOptions {
|
||||
return toArchiveOpt(options)
|
||||
}
|
||||
|
||||
func toArchiveOpt(options *TarOptions) *archive.TarOptions {
|
||||
if options == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var chownOpts *archive.ChownOpts
|
||||
if options.ChownOpts != nil {
|
||||
chownOpts = &archive.ChownOpts{
|
||||
UID: options.ChownOpts.UID,
|
||||
GID: options.ChownOpts.GID,
|
||||
}
|
||||
}
|
||||
|
||||
return &archive.TarOptions{
|
||||
IncludeFiles: options.IncludeFiles,
|
||||
ExcludePatterns: options.ExcludePatterns,
|
||||
Compression: options.Compression,
|
||||
NoLchown: options.NoLchown,
|
||||
IDMap: idtools.ToUserIdentityMapping(options.IDMap),
|
||||
ChownOpts: chownOpts,
|
||||
IncludeSourceDir: options.IncludeSourceDir,
|
||||
WhiteoutFormat: options.WhiteoutFormat,
|
||||
NoOverwriteDirNonDir: options.NoOverwriteDirNonDir,
|
||||
RebaseNames: options.RebaseNames,
|
||||
InUserNS: options.InUserNS,
|
||||
BestEffortXattrs: options.BestEffortXattrs,
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package archive
|
||||
|
||||
import "github.com/moby/go-archive"
|
||||
|
||||
const (
|
||||
WhiteoutPrefix = archive.WhiteoutPrefix // Deprecated: use [archive.WhiteoutPrefix] instead.
|
||||
WhiteoutMetaPrefix = archive.WhiteoutMetaPrefix // Deprecated: use [archive.WhiteoutMetaPrefix] instead.
|
||||
WhiteoutLinkDir = archive.WhiteoutLinkDir // Deprecated: use [archive.WhiteoutLinkDir] instead.
|
||||
WhiteoutOpaqueDir = archive.WhiteoutOpaqueDir // Deprecated: use [archive.WhiteoutOpaqueDir] instead.
|
||||
)
|
|
@ -1,14 +0,0 @@
|
|||
package archive
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/moby/go-archive"
|
||||
)
|
||||
|
||||
// Generate generates a new archive from the content provided as input.
|
||||
//
|
||||
// Deprecated: use [archive.Generate] instead.
|
||||
func Generate(input ...string) (io.Reader, error) {
|
||||
return archive.Generate(input...)
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
package idtools
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/moby/sys/user"
|
||||
)
|
||||
|
||||
// IDMap contains a single entry for user namespace range remapping. An array
|
||||
// of IDMap entries represents the structure that will be provided to the Linux
|
||||
// kernel for creating a user namespace.
|
||||
//
|
||||
// Deprecated: use [user.IDMap] instead.
|
||||
type IDMap struct {
|
||||
ContainerID int `json:"container_id"`
|
||||
HostID int `json:"host_id"`
|
||||
Size int `json:"size"`
|
||||
}
|
||||
|
||||
// MkdirAllAndChown creates a directory (include any along the path) and then modifies
|
||||
// ownership to the requested uid/gid. If the directory already exists, this
|
||||
// function will still change ownership and permissions.
|
||||
//
|
||||
// Deprecated: use [user.MkdirAllAndChown] instead.
|
||||
func MkdirAllAndChown(path string, mode os.FileMode, owner Identity) error {
|
||||
return user.MkdirAllAndChown(path, mode, owner.UID, owner.GID)
|
||||
}
|
||||
|
||||
// MkdirAndChown creates a directory and then modifies ownership to the requested uid/gid.
|
||||
// If the directory already exists, this function still changes ownership and permissions.
|
||||
// Note that unlike os.Mkdir(), this function does not return IsExist error
|
||||
// in case path already exists.
|
||||
//
|
||||
// Deprecated: use [user.MkdirAndChown] instead.
|
||||
func MkdirAndChown(path string, mode os.FileMode, owner Identity) error {
|
||||
return user.MkdirAndChown(path, mode, owner.UID, owner.GID)
|
||||
}
|
||||
|
||||
// MkdirAllAndChownNew creates a directory (include any along the path) and then modifies
|
||||
// ownership ONLY of newly created directories to the requested uid/gid. If the
|
||||
// directories along the path exist, no change of ownership or permissions will be performed
|
||||
//
|
||||
// Deprecated: use [user.MkdirAllAndChown] with the [user.WithOnlyNew] option instead.
|
||||
func MkdirAllAndChownNew(path string, mode os.FileMode, owner Identity) error {
|
||||
return user.MkdirAllAndChown(path, mode, owner.UID, owner.GID, user.WithOnlyNew)
|
||||
}
|
||||
|
||||
// GetRootUIDGID retrieves the remapped root uid/gid pair from the set of maps.
|
||||
// If the maps are empty, then the root uid/gid will default to "real" 0/0
|
||||
//
|
||||
// Deprecated: use [(user.IdentityMapping).RootPair] instead.
|
||||
func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error) {
|
||||
return getRootUIDGID(uidMap, gidMap)
|
||||
}
|
||||
|
||||
// getRootUIDGID retrieves the remapped root uid/gid pair from the set of maps.
|
||||
// If the maps are empty, then the root uid/gid will default to "real" 0/0
|
||||
func getRootUIDGID(uidMap, gidMap []IDMap) (int, int, error) {
|
||||
uid, err := toHost(0, uidMap)
|
||||
if err != nil {
|
||||
return -1, -1, err
|
||||
}
|
||||
gid, err := toHost(0, gidMap)
|
||||
if err != nil {
|
||||
return -1, -1, err
|
||||
}
|
||||
return uid, gid, nil
|
||||
}
|
||||
|
||||
// toContainer takes an id mapping, and uses it to translate a
|
||||
// host ID to the remapped ID. If no map is provided, then the translation
|
||||
// assumes a 1-to-1 mapping and returns the passed in id
|
||||
func toContainer(hostID int, idMap []IDMap) (int, error) {
|
||||
if idMap == nil {
|
||||
return hostID, nil
|
||||
}
|
||||
for _, m := range idMap {
|
||||
if (hostID >= m.HostID) && (hostID <= (m.HostID + m.Size - 1)) {
|
||||
contID := m.ContainerID + (hostID - m.HostID)
|
||||
return contID, nil
|
||||
}
|
||||
}
|
||||
return -1, fmt.Errorf("Host ID %d cannot be mapped to a container ID", hostID)
|
||||
}
|
||||
|
||||
// toHost takes an id mapping and a remapped ID, and translates the
|
||||
// ID to the mapped host ID. If no map is provided, then the translation
|
||||
// assumes a 1-to-1 mapping and returns the passed in id #
|
||||
func toHost(contID int, idMap []IDMap) (int, error) {
|
||||
if idMap == nil {
|
||||
return contID, nil
|
||||
}
|
||||
for _, m := range idMap {
|
||||
if (contID >= m.ContainerID) && (contID <= (m.ContainerID + m.Size - 1)) {
|
||||
hostID := m.HostID + (contID - m.ContainerID)
|
||||
return hostID, nil
|
||||
}
|
||||
}
|
||||
return -1, fmt.Errorf("Container ID %d cannot be mapped to a host ID", contID)
|
||||
}
|
||||
|
||||
// Identity is either a UID and GID pair or a SID (but not both)
|
||||
type Identity struct {
|
||||
UID int
|
||||
GID int
|
||||
SID string
|
||||
}
|
||||
|
||||
// Chown changes the numeric uid and gid of the named file to id.UID and id.GID.
|
||||
//
|
||||
// Deprecated: this method is deprecated and will be removed in the next release.
|
||||
func (id Identity) Chown(name string) error {
|
||||
return os.Chown(name, id.UID, id.GID)
|
||||
}
|
||||
|
||||
// IdentityMapping contains a mappings of UIDs and GIDs.
|
||||
// The zero value represents an empty mapping.
|
||||
//
|
||||
// Deprecated: this type is deprecated and will be removed in the next release.
|
||||
type IdentityMapping struct {
|
||||
UIDMaps []IDMap `json:"UIDMaps"`
|
||||
GIDMaps []IDMap `json:"GIDMaps"`
|
||||
}
|
||||
|
||||
// FromUserIdentityMapping converts a [user.IdentityMapping] to an [idtools.IdentityMapping].
|
||||
//
|
||||
// Deprecated: use [user.IdentityMapping] directly, this is transitioning to user package.
|
||||
func FromUserIdentityMapping(u user.IdentityMapping) IdentityMapping {
|
||||
return IdentityMapping{
|
||||
UIDMaps: fromUserIDMap(u.UIDMaps),
|
||||
GIDMaps: fromUserIDMap(u.GIDMaps),
|
||||
}
|
||||
}
|
||||
|
||||
func fromUserIDMap(u []user.IDMap) []IDMap {
|
||||
if u == nil {
|
||||
return nil
|
||||
}
|
||||
m := make([]IDMap, len(u))
|
||||
for i := range u {
|
||||
m[i] = IDMap{
|
||||
ContainerID: int(u[i].ID),
|
||||
HostID: int(u[i].ParentID),
|
||||
Size: int(u[i].Count),
|
||||
}
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// ToUserIdentityMapping converts an [idtools.IdentityMapping] to a [user.IdentityMapping].
|
||||
//
|
||||
// Deprecated: use [user.IdentityMapping] directly, this is transitioning to user package.
|
||||
func ToUserIdentityMapping(u IdentityMapping) user.IdentityMapping {
|
||||
return user.IdentityMapping{
|
||||
UIDMaps: toUserIDMap(u.UIDMaps),
|
||||
GIDMaps: toUserIDMap(u.GIDMaps),
|
||||
}
|
||||
}
|
||||
|
||||
func toUserIDMap(u []IDMap) []user.IDMap {
|
||||
if u == nil {
|
||||
return nil
|
||||
}
|
||||
m := make([]user.IDMap, len(u))
|
||||
for i := range u {
|
||||
m[i] = user.IDMap{
|
||||
ID: int64(u[i].ContainerID),
|
||||
ParentID: int64(u[i].HostID),
|
||||
Count: int64(u[i].Size),
|
||||
}
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// RootPair returns a uid and gid pair for the root user. The error is ignored
|
||||
// because a root user always exists, and the defaults are correct when the uid
|
||||
// and gid maps are empty.
|
||||
func (i IdentityMapping) RootPair() Identity {
|
||||
uid, gid, _ := getRootUIDGID(i.UIDMaps, i.GIDMaps)
|
||||
return Identity{UID: uid, GID: gid}
|
||||
}
|
||||
|
||||
// ToHost returns the host UID and GID for the container uid, gid.
|
||||
// Remapping is only performed if the ids aren't already the remapped root ids
|
||||
func (i IdentityMapping) ToHost(pair Identity) (Identity, error) {
|
||||
var err error
|
||||
target := i.RootPair()
|
||||
|
||||
if pair.UID != target.UID {
|
||||
target.UID, err = toHost(pair.UID, i.UIDMaps)
|
||||
if err != nil {
|
||||
return target, err
|
||||
}
|
||||
}
|
||||
|
||||
if pair.GID != target.GID {
|
||||
target.GID, err = toHost(pair.GID, i.GIDMaps)
|
||||
}
|
||||
return target, err
|
||||
}
|
||||
|
||||
// ToContainer returns the container UID and GID for the host uid and gid
|
||||
func (i IdentityMapping) ToContainer(pair Identity) (int, int, error) {
|
||||
uid, err := toContainer(pair.UID, i.UIDMaps)
|
||||
if err != nil {
|
||||
return -1, -1, err
|
||||
}
|
||||
gid, err := toContainer(pair.GID, i.GIDMaps)
|
||||
return uid, gid, err
|
||||
}
|
||||
|
||||
// Empty returns true if there are no id mappings
|
||||
func (i IdentityMapping) Empty() bool {
|
||||
return len(i.UIDMaps) == 0 && len(i.GIDMaps) == 0
|
||||
}
|
||||
|
||||
// CurrentIdentity returns the identity of the current process
|
||||
//
|
||||
// Deprecated: use [os.Getuid] and [os.Getegid] instead.
|
||||
func CurrentIdentity() Identity {
|
||||
return Identity{UID: os.Getuid(), GID: os.Getegid()}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package idtools
|
||||
|
||||
const (
|
||||
SeTakeOwnershipPrivilege = "SeTakeOwnershipPrivilege"
|
||||
)
|
||||
|
||||
// TODO(thaJeztah): these magic consts need a source of reference, and should be defined in a canonical location
|
||||
const (
|
||||
ContainerAdministratorSidString = "S-1-5-93-2-1"
|
||||
|
||||
ContainerUserSidString = "S-1-5-93-2-2"
|
||||
)
|
|
@ -1,5 +1,24 @@
|
|||
version: "2"
|
||||
linters:
|
||||
disable-all: true
|
||||
default: none
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
formatters:
|
||||
enable:
|
||||
- gofumpt
|
||||
- goimports
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
|
|
@ -30,7 +30,7 @@ type UpdateContainerOptions struct {
|
|||
//
|
||||
// See https://goo.gl/Y6fXUy for more details.
|
||||
func (c *Client) UpdateContainer(id string, opts UpdateContainerOptions) error {
|
||||
resp, err := c.do(http.MethodPost, fmt.Sprintf("/containers/"+id+"/update"), doOptions{
|
||||
resp, err := c.do(http.MethodPost, fmt.Sprintf("/containers/%s/update", id), doOptions{
|
||||
data: opts,
|
||||
forceJSON: true,
|
||||
context: opts.Context,
|
||||
|
|
|
@ -271,11 +271,13 @@ func (eventState *eventMonitoringState) monitorEvents(c *Client, opts EventsOpti
|
|||
return
|
||||
}
|
||||
if ev == EOFEvent {
|
||||
eventState.disableEventMonitoring()
|
||||
go eventState.disableEventMonitoring()
|
||||
return
|
||||
}
|
||||
eventState.updateLastSeen(ev)
|
||||
eventState.sendEvent(ev)
|
||||
go func(ev *APIEvents) {
|
||||
eventState.updateLastSeen(ev)
|
||||
eventState.sendEvent(ev)
|
||||
}(ev)
|
||||
case err = <-eventState.errC:
|
||||
if errors.Is(err, ErrNoListeners) {
|
||||
eventState.disableEventMonitoring()
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/patternmatcher"
|
||||
)
|
||||
|
||||
|
|
|
@ -135,9 +135,7 @@ github.com/docker/docker/api/types/volume
|
|||
github.com/docker/docker/client
|
||||
github.com/docker/docker/internal/lazyregexp
|
||||
github.com/docker/docker/internal/multierror
|
||||
github.com/docker/docker/pkg/archive
|
||||
github.com/docker/docker/pkg/homedir
|
||||
github.com/docker/docker/pkg/idtools
|
||||
github.com/docker/docker/pkg/jsonmessage
|
||||
github.com/docker/docker/pkg/stdcopy
|
||||
# github.com/docker/docker-credential-helpers v0.9.3
|
||||
|
@ -159,8 +157,8 @@ github.com/felixge/httpsnoop
|
|||
## explicit; go 1.17
|
||||
github.com/fsnotify/fsnotify
|
||||
github.com/fsnotify/fsnotify/internal
|
||||
# github.com/fsouza/go-dockerclient v1.12.1
|
||||
## explicit; go 1.23
|
||||
# github.com/fsouza/go-dockerclient v1.12.2
|
||||
## explicit; go 1.24.0
|
||||
github.com/fsouza/go-dockerclient
|
||||
# github.com/go-jose/go-jose/v4 v4.0.5
|
||||
## explicit; go 1.21
|
||||
|
|
Loading…
Reference in New Issue