Merge component 'engine' from git@github.com:moby/moby master

This commit is contained in:
Andrew Hsu
2017-09-29 22:30:27 +00:00
11 changed files with 41 additions and 37 deletions
@@ -41,7 +41,6 @@ func (cst *ClientSessionTransport) Copy(ctx context.Context, id fscache.RemoteId
type ClientSessionSourceIdentifier struct {
includePatterns []string
caller session.Caller
sharedKey string
uuid string
}
@@ -8,6 +8,11 @@ import (
"github.com/docker/docker/pkg/idtools"
)
var pathBlacklist = map[string]bool{
"c:\\": true,
"c:\\windows": true,
}
func fixPermissions(source, destination string, rootIDs idtools.IDPair, overrideSkip bool) error {
// chown is not supported on Windows
return nil
@@ -203,13 +203,6 @@ func (s *dispatchState) hasFromImage() bool {
return s.imageID != "" || (s.baseImage != nil && s.baseImage.ImageID() == "")
}
func (s *dispatchState) isCurrentStage(target string) bool {
if target == "" {
return false
}
return strings.EqualFold(s.stageName, target)
}
func (s *dispatchState) beginStage(stageName string, image builder.Image) {
s.stageName = stageName
s.imageID = image.ImageID()
@@ -18,7 +18,6 @@ type imageSources struct {
byImageID map[string]*imageMount
mounts []*imageMount
getImage getAndMountFunc
cache pathCache // TODO: remove
}
// TODO @jhowardmsft LCOW Support: Eventually, platform can be moved to options.Options.Platform,
@@ -29,12 +29,6 @@ import (
"github.com/pkg/errors"
)
// For Windows only
var pathBlacklist = map[string]bool{
"c:\\": true,
"c:\\windows": true,
}
// Archiver defines an interface for copying files from one destination to
// another using Tar/Untar.
type Archiver interface {
@@ -217,7 +217,6 @@ func syncFrom(ctx context.Context, cs *cachedSourceRef, transport Transport, id
}
type fsCacheStore struct {
root string
mu sync.Mutex
sources map[string]*cachedSource
db *bolt.DB
@@ -1,7 +1,6 @@
package remotecontext
import (
"fmt"
"os"
"sync"
@@ -133,19 +132,6 @@ func (cs *CachableSource) Close() error {
return nil
}
func (cs *CachableSource) normalize(path string) (cleanpath, fullpath string, err error) {
cleanpath = cs.root.Clean(string(cs.root.Separator()) + path)[1:]
fullpath, err = cs.root.ResolveScopedPath(path, true)
if err != nil {
return "", "", fmt.Errorf("Forbidden path outside the context: %s (%s)", path, fullpath)
}
_, err = cs.root.Lstat(fullpath)
if err != nil {
return "", "", convertPathError(err, path)
}
return
}
// Hash returns a hash for a single file in the source
func (cs *CachableSource) Hash(path string) (string, error) {
n := cs.getRoot()
+2 -2
View File
@@ -248,8 +248,8 @@ func (cli *Client) NegotiateAPIVersionPing(p types.Ping) {
cli.version = api.DefaultVersion
}
// if server version is lower than the maximum version supported by the Client, downgrade
if versions.LessThan(p.APIVersion, api.DefaultVersion) {
// if server version is lower than the client version, downgrade
if versions.LessThan(p.APIVersion, cli.version) {
cli.version = p.APIVersion
}
}
+8
View File
@@ -276,6 +276,14 @@ func TestNegotiateAPIVersion(t *testing.T) {
// test downgrade
client.NegotiateAPIVersionPing(ping)
assert.Equal(t, expected, client.version)
// set the client version to something older, and verify that we keep the
// original setting.
expected = "1.20"
client.version = expected
client.NegotiateAPIVersionPing(ping)
assert.Equal(t, expected, client.version)
}
// TestNegotiateAPIVersionOverride asserts that we honor
+11 -5
View File
@@ -525,18 +525,24 @@ func (daemon *Daemon) deleteLoadBalancerSandbox(n libnetwork.Network) {
if len(endpoints) == 1 {
sandboxName := n.Name() + "-sbox"
if err := endpoints[0].Info().Sandbox().DisableService(); err != nil {
logrus.Errorf("Failed to disable service on sandbox %s: %v", sandboxName, err)
//Ignore error and attempt to delete the load balancer endpoint
info := endpoints[0].Info()
if info != nil {
sb := info.Sandbox()
if sb != nil {
if err := sb.DisableService(); err != nil {
logrus.Warnf("Failed to disable service on sandbox %s: %v", sandboxName, err)
//Ignore error and attempt to delete the load balancer endpoint
}
}
}
if err := endpoints[0].Delete(true); err != nil {
logrus.Errorf("Failed to delete endpoint %s (%s) in %s: %v", endpoints[0].Name(), endpoints[0].ID(), sandboxName, err)
logrus.Warnf("Failed to delete endpoint %s (%s) in %s: %v", endpoints[0].Name(), endpoints[0].ID(), sandboxName, err)
//Ignore error and attempt to delete the sandbox.
}
if err := controller.SandboxDestroy(sandboxName); err != nil {
logrus.Errorf("Failed to delete %s sandbox: %v", sandboxName, err)
logrus.Warnf("Failed to delete %s sandbox: %v", sandboxName, err)
//Ignore error and attempt to delete the network.
}
}
@@ -27,6 +27,7 @@ import (
"github.com/docker/docker/integration-cli/cli/build"
"github.com/docker/docker/integration-cli/cli/build/fakecontext"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/stringutils"
"github.com/docker/docker/runconfig"
@@ -4010,6 +4011,20 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) {
}
func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) {
// TODO @msabansal - https://github.com/moby/moby/issues/35023. Duplicate
// port mappings are not errored out on RS3 builds. Temporarily disabling
// this test pending further investigation. Note we parse kernel.GetKernelVersion
// rather than system.GetOSVersion as test binaries aren't manifested, so would
// otherwise report build 9200.
if runtime.GOOS == "windows" {
v, err := kernel.GetKernelVersion()
c.Assert(err, checker.IsNil)
build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0])
if build >= 16292 { // @jhowardmsft TODO - replace with final RS3 build and ==
c.Skip("Temporarily disabled on RS3 builds")
}
}
nroutines, err := getGoroutineNumber()
c.Assert(err, checker.IsNil)