Update containerd to fix mount.Lookup.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
8094fe69d4
commit
a28672b088
@ -1,6 +1,6 @@
|
|||||||
RUNC_VERSION=9f9c96235cc97674e935002fc3d78361b696a69e
|
RUNC_VERSION=9f9c96235cc97674e935002fc3d78361b696a69e
|
||||||
CNI_VERSION=v0.6.0
|
CNI_VERSION=v0.6.0
|
||||||
CONTAINERD_VERSION=ec15fe95aa8fd3abeb05d036e1579129c0ba7b1c
|
CONTAINERD_VERSION=6570c97942e5438bb6bfa202aa5467a0a9a83b55
|
||||||
CONTAINERD_REPO=
|
CONTAINERD_REPO=
|
||||||
CRITOOL_VERSION=v1.0.0-alpha.0
|
CRITOOL_VERSION=v1.0.0-alpha.0
|
||||||
KUBERNETES_VERSION=v1.9.0
|
KUBERNETES_VERSION=v1.9.0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
github.com/blang/semver v3.1.0
|
github.com/blang/semver v3.1.0
|
||||||
github.com/BurntSushi/toml v0.2.0-21-g9906417
|
github.com/BurntSushi/toml v0.2.0-21-g9906417
|
||||||
github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f
|
github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f
|
||||||
github.com/containerd/containerd ec15fe95aa8fd3abeb05d036e1579129c0ba7b1c
|
github.com/containerd/containerd 6570c97942e5438bb6bfa202aa5467a0a9a83b55
|
||||||
github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e
|
github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e
|
||||||
github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6
|
github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6
|
||||||
github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788
|
github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788
|
||||||
|
48
vendor/github.com/containerd/containerd/client.go
generated
vendored
48
vendor/github.com/containerd/containerd/client.go
generated
vendored
@ -7,8 +7,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
containersapi "github.com/containerd/containerd/api/services/containers/v1"
|
containersapi "github.com/containerd/containerd/api/services/containers/v1"
|
||||||
@ -301,51 +299,7 @@ func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var m sync.Mutex
|
return remotes.PushContent(ctx, pusher, desc, c.ContentStore(), pushCtx.BaseHandlers...)
|
||||||
manifestStack := []ocispec.Descriptor{}
|
|
||||||
|
|
||||||
filterHandler := images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
|
||||||
switch desc.MediaType {
|
|
||||||
case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest,
|
|
||||||
images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex:
|
|
||||||
m.Lock()
|
|
||||||
manifestStack = append(manifestStack, desc)
|
|
||||||
m.Unlock()
|
|
||||||
return nil, images.ErrStopHandler
|
|
||||||
default:
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
cs := c.ContentStore()
|
|
||||||
pushHandler := remotes.PushHandler(cs, pusher)
|
|
||||||
|
|
||||||
handlers := append(pushCtx.BaseHandlers,
|
|
||||||
images.ChildrenHandler(cs, platforms.Default()),
|
|
||||||
filterHandler,
|
|
||||||
pushHandler,
|
|
||||||
)
|
|
||||||
|
|
||||||
if err := images.Dispatch(ctx, images.Handlers(handlers...), desc); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate in reverse order as seen, parent always uploaded after child
|
|
||||||
for i := len(manifestStack) - 1; i >= 0; i-- {
|
|
||||||
_, err := pushHandler(ctx, manifestStack[i])
|
|
||||||
if err != nil {
|
|
||||||
// TODO(estesp): until we have a more complete method for index push, we need to report
|
|
||||||
// missing dependencies in an index/manifest list by sensing the "400 Bad Request"
|
|
||||||
// as a marker for this problem
|
|
||||||
if (manifestStack[i].MediaType == ocispec.MediaTypeImageIndex ||
|
|
||||||
manifestStack[i].MediaType == images.MediaTypeDockerSchema2ManifestList) &&
|
|
||||||
errors.Cause(err) != nil && strings.Contains(errors.Cause(err).Error(), "400 Bad Request") {
|
|
||||||
return errors.Wrap(err, "manifest list/index references to blobs and/or manifests are missing in your target registry")
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetImage returns an existing image
|
// GetImage returns an existing image
|
||||||
|
3
vendor/github.com/containerd/containerd/container.go
generated
vendored
3
vendor/github.com/containerd/containerd/container.go
generated
vendored
@ -2,6 +2,7 @@ package containerd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -13,7 +14,6 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/typeurl"
|
"github.com/containerd/typeurl"
|
||||||
prototypes "github.com/gogo/protobuf/types"
|
prototypes "github.com/gogo/protobuf/types"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@ -115,7 +115,6 @@ func (c *container) Spec(ctx context.Context) (*specs.Spec, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
var s specs.Spec
|
var s specs.Spec
|
||||||
if err := json.Unmarshal(r.Spec.Value, &s); err != nil {
|
if err := json.Unmarshal(r.Spec.Value, &s); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
3
vendor/github.com/containerd/containerd/container_opts_unix.go
generated
vendored
3
vendor/github.com/containerd/containerd/container_opts_unix.go
generated
vendored
@ -4,6 +4,7 @@ package containerd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -19,7 +20,6 @@ import (
|
|||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
protobuf "github.com/gogo/protobuf/types"
|
protobuf "github.com/gogo/protobuf/types"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
"github.com/opencontainers/image-spec/identity"
|
"github.com/opencontainers/image-spec/identity"
|
||||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -121,7 +121,6 @@ func decodeIndex(ctx context.Context, store content.Store, id digest.Digest) (*v
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
if err := json.Unmarshal(p, &index); err != nil {
|
if err := json.Unmarshal(p, &index); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
33
vendor/github.com/containerd/containerd/content/helpers.go
generated
vendored
33
vendor/github.com/containerd/containerd/content/helpers.go
generated
vendored
@ -3,6 +3,7 @@ package content
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
@ -76,14 +77,7 @@ func Copy(ctx context.Context, cw Writer, r io.Reader, size int64, expected dige
|
|||||||
if ws.Offset > 0 {
|
if ws.Offset > 0 {
|
||||||
r, err = seekReader(r, ws.Offset, size)
|
r, err = seekReader(r, ws.Offset, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !isUnseekable(err) {
|
return errors.Wrapf(err, "unable to resume write to %v", ws.Ref)
|
||||||
return errors.Wrapf(err, "unable to resume write to %v", ws.Ref)
|
|
||||||
}
|
|
||||||
|
|
||||||
// reader is unseekable, try to move the writer back to the start.
|
|
||||||
if err := cw.Truncate(0); err != nil {
|
|
||||||
return errors.Wrapf(err, "content writer truncate failed")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,14 +97,9 @@ func Copy(ctx context.Context, cw Writer, r io.Reader, size int64, expected dige
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var errUnseekable = errors.New("seek not supported")
|
|
||||||
|
|
||||||
func isUnseekable(err error) bool {
|
|
||||||
return errors.Cause(err) == errUnseekable
|
|
||||||
}
|
|
||||||
|
|
||||||
// seekReader attempts to seek the reader to the given offset, either by
|
// seekReader attempts to seek the reader to the given offset, either by
|
||||||
// resolving `io.Seeker` or by detecting `io.ReaderAt`.
|
// resolving `io.Seeker`, by detecting `io.ReaderAt`, or discarding
|
||||||
|
// up to the given offset.
|
||||||
func seekReader(r io.Reader, offset, size int64) (io.Reader, error) {
|
func seekReader(r io.Reader, offset, size int64) (io.Reader, error) {
|
||||||
// attempt to resolve r as a seeker and setup the offset.
|
// attempt to resolve r as a seeker and setup the offset.
|
||||||
seeker, ok := r.(io.Seeker)
|
seeker, ok := r.(io.Seeker)
|
||||||
@ -134,5 +123,17 @@ func seekReader(r io.Reader, offset, size int64) (io.Reader, error) {
|
|||||||
return sr, nil
|
return sr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return r, errors.Wrapf(errUnseekable, "seek to offset %v failed", offset)
|
// well then, let's just discard up to the offset
|
||||||
|
buf := bufPool.Get().(*[]byte)
|
||||||
|
defer bufPool.Put(buf)
|
||||||
|
|
||||||
|
n, err := io.CopyBuffer(ioutil.Discard, io.LimitReader(r, offset), *buf)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "failed to discard to offset")
|
||||||
|
}
|
||||||
|
if n != offset {
|
||||||
|
return nil, errors.Errorf("unable to discard to offset")
|
||||||
|
}
|
||||||
|
|
||||||
|
return r, nil
|
||||||
}
|
}
|
||||||
|
3
vendor/github.com/containerd/containerd/contrib/seccomp/seccomp.go
generated
vendored
3
vendor/github.com/containerd/containerd/contrib/seccomp/seccomp.go
generated
vendored
@ -4,12 +4,12 @@ package seccomp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +23,6 @@ func WithProfile(profile string) oci.SpecOpts {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Cannot load seccomp profile %q: %v", profile, err)
|
return fmt.Errorf("Cannot load seccomp profile %q: %v", profile, err)
|
||||||
}
|
}
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
if err := json.Unmarshal(f, s.Linux.Seccomp); err != nil {
|
if err := json.Unmarshal(f, s.Linux.Seccomp); err != nil {
|
||||||
return fmt.Errorf("Decoding seccomp profile failed %q: %v", profile, err)
|
return fmt.Errorf("Decoding seccomp profile failed %q: %v", profile, err)
|
||||||
}
|
}
|
||||||
|
6
vendor/github.com/containerd/containerd/images/image.go
generated
vendored
6
vendor/github.com/containerd/containerd/images/image.go
generated
vendored
@ -2,6 +2,7 @@ package images
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -9,7 +10,6 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -123,7 +123,6 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc
|
|||||||
return ocispec.Manifest{}, err
|
return ocispec.Manifest{}, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
|
|
||||||
if err := Walk(ctx, HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
if err := Walk(ctx, HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
||||||
switch desc.MediaType {
|
switch desc.MediaType {
|
||||||
@ -217,7 +216,6 @@ func Config(ctx context.Context, provider content.Provider, image ocispec.Descri
|
|||||||
// Platforms returns one or more platforms supported by the image.
|
// Platforms returns one or more platforms supported by the image.
|
||||||
func Platforms(ctx context.Context, provider content.Provider, image ocispec.Descriptor) ([]ocispec.Platform, error) {
|
func Platforms(ctx context.Context, provider content.Provider, image ocispec.Descriptor) ([]ocispec.Platform, error) {
|
||||||
var platformSpecs []ocispec.Platform
|
var platformSpecs []ocispec.Platform
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
||||||
if desc.Platform != nil {
|
if desc.Platform != nil {
|
||||||
platformSpecs = append(platformSpecs, *desc.Platform)
|
platformSpecs = append(platformSpecs, *desc.Platform)
|
||||||
@ -288,7 +286,6 @@ func Check(ctx context.Context, provider content.Provider, image ocispec.Descrip
|
|||||||
|
|
||||||
// Children returns the immediate children of content described by the descriptor.
|
// Children returns the immediate children of content described by the descriptor.
|
||||||
func Children(ctx context.Context, provider content.Provider, desc ocispec.Descriptor, platform string) ([]ocispec.Descriptor, error) {
|
func Children(ctx context.Context, provider content.Provider, desc ocispec.Descriptor, platform string) ([]ocispec.Descriptor, error) {
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
var descs []ocispec.Descriptor
|
var descs []ocispec.Descriptor
|
||||||
switch desc.MediaType {
|
switch desc.MediaType {
|
||||||
case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest:
|
case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest:
|
||||||
@ -357,7 +354,6 @@ func RootFS(ctx context.Context, provider content.Provider, configDesc ocispec.D
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
var config ocispec.Image
|
var config ocispec.Image
|
||||||
if err := json.Unmarshal(p, &config); err != nil {
|
if err := json.Unmarshal(p, &config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
19
vendor/github.com/containerd/containerd/mount/lookup_unix.go
generated
vendored
19
vendor/github.com/containerd/containerd/mount/lookup_unix.go
generated
vendored
@ -3,22 +3,16 @@
|
|||||||
package mount
|
package mount
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Lookup returns the mount info corresponds to the path.
|
// Lookup returns the mount info corresponds to the path.
|
||||||
func Lookup(dir string) (Info, error) {
|
func Lookup(dir string) (Info, error) {
|
||||||
var dirStat syscall.Stat_t
|
|
||||||
dir = filepath.Clean(dir)
|
dir = filepath.Clean(dir)
|
||||||
if err := syscall.Stat(dir, &dirStat); err != nil {
|
|
||||||
return Info{}, errors.Wrapf(err, "failed to access %q", dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
mounts, err := Self()
|
mounts, err := Self()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -26,21 +20,18 @@ func Lookup(dir string) (Info, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort descending order by Info.Mountpoint
|
// Sort descending order by Info.Mountpoint
|
||||||
sort.Slice(mounts, func(i, j int) bool {
|
sort.SliceStable(mounts, func(i, j int) bool {
|
||||||
return mounts[j].Mountpoint < mounts[i].Mountpoint
|
return mounts[j].Mountpoint < mounts[i].Mountpoint
|
||||||
})
|
})
|
||||||
for _, m := range mounts {
|
for _, m := range mounts {
|
||||||
// Note that m.{Major, Minor} are generally unreliable for our purpose here
|
// Note that m.{Major, Minor} are generally unreliable for our purpose here
|
||||||
// https://www.spinics.net/lists/linux-btrfs/msg58908.html
|
// https://www.spinics.net/lists/linux-btrfs/msg58908.html
|
||||||
var st syscall.Stat_t
|
// Note that device number is not checked here, because for overlayfs files
|
||||||
if err := syscall.Stat(m.Mountpoint, &st); err != nil {
|
// may have different device number with the mountpoint.
|
||||||
// may fail; ignore err
|
if strings.HasPrefix(dir, m.Mountpoint) {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if st.Dev == dirStat.Dev && strings.HasPrefix(dir, m.Mountpoint) {
|
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Info{}, fmt.Errorf("failed to find the mount info for %q", dir)
|
return Info{}, errors.Errorf("failed to find the mount info for %q", dir)
|
||||||
}
|
}
|
||||||
|
3
vendor/github.com/containerd/containerd/mount/mount_windows.go
generated
vendored
3
vendor/github.com/containerd/containerd/mount/mount_windows.go
generated
vendored
@ -1,11 +1,11 @@
|
|||||||
package mount
|
package mount
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim"
|
"github.com/Microsoft/hcsshim"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,7 +49,6 @@ const ParentLayerPathsFlag = "parentLayerPaths="
|
|||||||
// GetParentPaths of the mount
|
// GetParentPaths of the mount
|
||||||
func (m *Mount) GetParentPaths() ([]string, error) {
|
func (m *Mount) GetParentPaths() ([]string, error) {
|
||||||
var parentLayerPaths []string
|
var parentLayerPaths []string
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
for _, option := range m.Options {
|
for _, option := range m.Options {
|
||||||
if strings.HasPrefix(option, ParentLayerPathsFlag) {
|
if strings.HasPrefix(option, ParentLayerPathsFlag) {
|
||||||
err := json.Unmarshal([]byte(option[len(ParentLayerPathsFlag):]), &parentLayerPaths)
|
err := json.Unmarshal([]byte(option[len(ParentLayerPathsFlag):]), &parentLayerPaths)
|
||||||
|
3
vendor/github.com/containerd/containerd/oci/spec_opts_unix.go
generated
vendored
3
vendor/github.com/containerd/containerd/oci/spec_opts_unix.go
generated
vendored
@ -4,6 +4,7 @@ package oci
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -16,7 +17,6 @@ import (
|
|||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/opencontainers/runc/libcontainer/user"
|
"github.com/opencontainers/runc/libcontainer/user"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
@ -66,7 +66,6 @@ func WithLinuxNamespace(ns specs.LinuxNamespace) SpecOpts {
|
|||||||
// WithImageConfig configures the spec to from the configuration of an Image
|
// WithImageConfig configures the spec to from the configuration of an Image
|
||||||
func WithImageConfig(image Image) SpecOpts {
|
func WithImageConfig(image Image) SpecOpts {
|
||||||
return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) error {
|
return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) error {
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
ic, err := image.Config(ctx)
|
ic, err := image.Config(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
3
vendor/github.com/containerd/containerd/oci/spec_opts_windows.go
generated
vendored
3
vendor/github.com/containerd/containerd/oci/spec_opts_windows.go
generated
vendored
@ -4,12 +4,12 @@ package oci
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
@ -24,7 +24,6 @@ func WithImageConfig(image Image) SpecOpts {
|
|||||||
var (
|
var (
|
||||||
ociimage v1.Image
|
ociimage v1.Image
|
||||||
config v1.ImageConfig
|
config v1.ImageConfig
|
||||||
json = jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
)
|
)
|
||||||
switch ic.MediaType {
|
switch ic.MediaType {
|
||||||
case v1.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config:
|
case v1.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config:
|
||||||
|
7
vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go
generated
vendored
7
vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go
generated
vendored
@ -5,6 +5,7 @@ import (
|
|||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -20,7 +21,6 @@ import (
|
|||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
"github.com/containerd/containerd/remotes"
|
"github.com/containerd/containerd/remotes"
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go"
|
specs "github.com/opencontainers/image-spec/specs-go"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -110,7 +110,6 @@ func (c *Converter) Convert(ctx context.Context) (ocispec.Descriptor, error) {
|
|||||||
return ocispec.Descriptor{}, errors.Wrap(err, "schema 1 conversion failed")
|
return ocispec.Descriptor{}, errors.Wrap(err, "schema 1 conversion failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
var img ocispec.Image
|
var img ocispec.Image
|
||||||
if err := json.Unmarshal([]byte(c.pulledManifest.History[0].V1Compatibility), &img); err != nil {
|
if err := json.Unmarshal([]byte(c.pulledManifest.History[0].V1Compatibility), &img); err != nil {
|
||||||
return ocispec.Descriptor{}, errors.Wrap(err, "failed to unmarshal image from schema 1 history")
|
return ocispec.Descriptor{}, errors.Wrap(err, "failed to unmarshal image from schema 1 history")
|
||||||
@ -195,7 +194,6 @@ func (c *Converter) fetchManifest(ctx context.Context, desc ocispec.Descriptor)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
var m manifest
|
var m manifest
|
||||||
if err := json.Unmarshal(b, &m); err != nil {
|
if err := json.Unmarshal(b, &m); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -318,7 +316,6 @@ func (c *Converter) schema1ManifestHistory() ([]ocispec.History, []digest.Digest
|
|||||||
return nil, nil, errors.New("no history")
|
return nil, nil, errors.New("no history")
|
||||||
}
|
}
|
||||||
|
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
history := make([]ocispec.History, len(m.History))
|
history := make([]ocispec.History, len(m.History))
|
||||||
diffIDs := []digest.Digest{}
|
diffIDs := []digest.Digest{}
|
||||||
for i := range m.History {
|
for i := range m.History {
|
||||||
@ -376,7 +373,6 @@ type v1History struct {
|
|||||||
// empty layer. A return value of true indicates the layer is empty,
|
// empty layer. A return value of true indicates the layer is empty,
|
||||||
// however false does not indicate non-empty.
|
// however false does not indicate non-empty.
|
||||||
func isEmptyLayer(compatHistory []byte) (bool, error) {
|
func isEmptyLayer(compatHistory []byte) (bool, error) {
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
var h v1History
|
var h v1History
|
||||||
if err := json.Unmarshal(compatHistory, &h); err != nil {
|
if err := json.Unmarshal(compatHistory, &h); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -426,7 +422,6 @@ func joseBase64UrlDecode(s string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func stripSignature(b []byte) ([]byte, error) {
|
func stripSignature(b []byte) ([]byte, error) {
|
||||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
|
||||||
var sig signature
|
var sig signature
|
||||||
if err := json.Unmarshal(b, &sig); err != nil {
|
if err := json.Unmarshal(b, &sig); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
57
vendor/github.com/containerd/containerd/remotes/handlers.go
generated
vendored
57
vendor/github.com/containerd/containerd/remotes/handlers.go
generated
vendored
@ -6,12 +6,15 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
|
"github.com/containerd/containerd/platforms"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -180,7 +183,7 @@ func commitOpts(desc ocispec.Descriptor, r io.Reader) (io.Reader, []content.Opt)
|
|||||||
|
|
||||||
// PushHandler returns a handler that will push all content from the provider
|
// PushHandler returns a handler that will push all content from the provider
|
||||||
// using a writer from the pusher.
|
// using a writer from the pusher.
|
||||||
func PushHandler(provider content.Provider, pusher Pusher) images.HandlerFunc {
|
func PushHandler(pusher Pusher, provider content.Provider) images.HandlerFunc {
|
||||||
return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
||||||
ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{
|
ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{
|
||||||
"digest": desc.Digest,
|
"digest": desc.Digest,
|
||||||
@ -215,3 +218,55 @@ func push(ctx context.Context, provider content.Provider, pusher Pusher, desc oc
|
|||||||
rd := io.NewSectionReader(ra, 0, desc.Size)
|
rd := io.NewSectionReader(ra, 0, desc.Size)
|
||||||
return content.Copy(ctx, cw, rd, desc.Size, desc.Digest)
|
return content.Copy(ctx, cw, rd, desc.Size, desc.Digest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PushContent pushes content specified by the descriptor from the provider.
|
||||||
|
//
|
||||||
|
// Base handlers can be provided which will be called before any push specific
|
||||||
|
// handlers.
|
||||||
|
func PushContent(ctx context.Context, pusher Pusher, desc ocispec.Descriptor, provider content.Provider, baseHandlers ...images.Handler) error {
|
||||||
|
var m sync.Mutex
|
||||||
|
manifestStack := []ocispec.Descriptor{}
|
||||||
|
|
||||||
|
filterHandler := images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
|
||||||
|
switch desc.MediaType {
|
||||||
|
case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest,
|
||||||
|
images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex:
|
||||||
|
m.Lock()
|
||||||
|
manifestStack = append(manifestStack, desc)
|
||||||
|
m.Unlock()
|
||||||
|
return nil, images.ErrStopHandler
|
||||||
|
default:
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
pushHandler := PushHandler(pusher, provider)
|
||||||
|
|
||||||
|
handlers := append(baseHandlers,
|
||||||
|
images.ChildrenHandler(provider, platforms.Default()),
|
||||||
|
filterHandler,
|
||||||
|
pushHandler,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err := images.Dispatch(ctx, images.Handlers(handlers...), desc); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate in reverse order as seen, parent always uploaded after child
|
||||||
|
for i := len(manifestStack) - 1; i >= 0; i-- {
|
||||||
|
_, err := pushHandler(ctx, manifestStack[i])
|
||||||
|
if err != nil {
|
||||||
|
// TODO(estesp): until we have a more complete method for index push, we need to report
|
||||||
|
// missing dependencies in an index/manifest list by sensing the "400 Bad Request"
|
||||||
|
// as a marker for this problem
|
||||||
|
if (manifestStack[i].MediaType == ocispec.MediaTypeImageIndex ||
|
||||||
|
manifestStack[i].MediaType == images.MediaTypeDockerSchema2ManifestList) &&
|
||||||
|
errors.Cause(err) != nil && strings.Contains(errors.Cause(err).Error(), "400 Bad Request") {
|
||||||
|
return errors.Wrap(err, "manifest list/index references to blobs and/or manifests are missing in your target registry")
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
1
vendor/github.com/containerd/containerd/vendor.conf
generated
vendored
1
vendor/github.com/containerd/containerd/vendor.conf
generated
vendored
@ -42,4 +42,3 @@ golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
|
|||||||
github.com/dmcgowan/go-tar go1.10
|
github.com/dmcgowan/go-tar go1.10
|
||||||
github.com/stevvooe/ttrpc d2710463e497617f16f26d1e715a3308609e7982
|
github.com/stevvooe/ttrpc d2710463e497617f16f26d1e715a3308609e7982
|
||||||
github.com/syndtr/gocapability db04d3cc01c8b54962a58ec7e491717d06cfcc16
|
github.com/syndtr/gocapability db04d3cc01c8b54962a58ec7e491717d06cfcc16
|
||||||
github.com/json-iterator/go 1.0.4
|
|
||||||
|
Loading…
Reference in New Issue
Block a user