Skip to content

Commit

Permalink
Update github/docker/docker to a consistent version across all packag…
Browse files Browse the repository at this point in the history
…es (#13415)

* Update github/docker/docker to a consistent version across all packages

This bumps up the version of all vendored github.com/docker/docker packages to `github.com/docker/engine@v19.03.2`. This does impact netbsd, because this version of Docker doesn't compile for netbsd. But we will add the appropriate build tags in a follow-up change.

github.com/docker/engine is a fork of github.com/moby/moby but with release tags. (source: moby/moby#39302 (comment))

Ran command:
    govendor fetch github.com/docker/docker/...::github.com/docker/engine@v19.03.2

This fixes the github.com/Sirupsen/logrus issue causing problems with go.mod in #11850. And ensures that all sub-packages are coming from the same repo (another go.mod requirement).

* Add integration build tag to Metricbeat docker/image metricset test

* Run script/clean_vendor.sh
  • Loading branch information
andrewkroh authored Sep 6, 2019
1 parent 56103a3 commit 44f4b3f
Show file tree
Hide file tree
Showing 1,043 changed files with 226,032 additions and 10,262 deletions.
1,275 changes: 1,149 additions & 126 deletions NOTICE.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dev-tools/generate_notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def create_notice(filename, beat, copyright, vendor_dirs, csvfile, overrides=Non
"Apache License 2.0",
"Apache License Version 2.0",
"Apache License, Version 2.0",
"licensed under the Apache 2.0 license", # github.com/zmap/zcrypto
re.sub(r"\s+", " ", """Apache License
==============
Expand Down
1 change: 0 additions & 1 deletion libbeat/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
BEAT_NAME=libbeat
TEST_ENVIRONMENT?=true
SYSTEM_TESTS=true
GOX_OS=linux darwin windows netbsd openbsd

include scripts/Makefile

Expand Down
29 changes: 11 additions & 18 deletions libbeat/common/docker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,38 @@ import (
"os"

"github.com/docker/docker/api"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
"golang.org/x/net/context"

"github.com/elastic/beats/libbeat/logp"
)

// NewClient builds and returns a new Docker client
// It uses version 1.30 by default, and negotiates it with the server so it is downgraded if 1.30 is too high
// It uses version 1.32 by default, and negotiates it with the server so it is downgraded if 1.32 is too high.
func NewClient(host string, httpClient *http.Client, httpHeaders map[string]string) (*client.Client, error) {
version := os.Getenv("DOCKER_API_VERSION")
version, versionOverride := os.LookupEnv("DOCKER_API_VERSION")
if version == "" {
version = api.DefaultVersion
versionOverride = false
}

c, err := client.NewClient(host, version, httpClient, nil)
if err != nil {
return c, err
}

if os.Getenv("DOCKER_API_VERSION") == "" {
logp.Debug("docker", "Negotiating client version")
log := logp.NewLogger("docker")

if versionOverride {
log.Debug("Negotiating Docker client version.")
ping, err := c.Ping(context.Background())
if err != nil {
logp.Debug("docker", "Failed to perform ping: %s", err)
}

// try a really old version, before versioning headers existed
if ping.APIVersion == "" {
ping.APIVersion = "1.22"
}

// if server version is lower than the client version, downgrade
if versions.LessThan(ping.APIVersion, version) {
c.UpdateClientVersion(ping.APIVersion)
log.Debugf("Failed to perform ping: %v", err)
} else {
c.NegotiateAPIVersionPing(ping)
}
}

logp.Debug("docker", "Client version set to %s", c.ClientVersion())

log.Debugf("Docker client version set to %s.", c.ClientVersion())
return c, nil
}
2 changes: 1 addition & 1 deletion libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TEST_ENVIRONMENT?=false ## @testing if true, "make testsuite" runs integration t
SYSTEM_TESTS?=false ## @testing if true, "make test" and "make testsuite" run unit tests and system tests
STRESS_TESTS?=false ## @testing if true, "make test" and "make testsuite" run also run the stress tests
STRESS_TEST_OPTIONS?=-timeout=20m -race -v
GOX_OS?=linux darwin windows freebsd netbsd openbsd ## @Building List of all OS to be supported by "make crosscompile".
GOX_OS?=linux darwin windows openbsd ## @Building List of all OS to be supported by "make crosscompile".
GOX_OSARCH?=!darwin/arm !darwin/arm64 !darwin/386 ## @building Space separated list of GOOS/GOARCH pairs to build by "make crosscompile".
GOX_FLAGS?= ## @building Additional flags to append to the gox command used by "make crosscompile".
# XXX: Should be switched back to `snapshot` once the Elasticsearch
Expand Down
9 changes: 7 additions & 2 deletions libbeat/tests/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ func (c Client) ContainerStart(image string, cmd []string, labels map[string]str
// ContainerWait waits for a container to finish
func (c Client) ContainerWait(ID string) error {
ctx := context.Background()
_, err := c.cli.ContainerWait(ctx, ID)
return err
waitC, errC := c.cli.ContainerWait(ctx, ID, container.WaitConditionNotRunning)
select {
case <-waitC:
case err := <-errC:
return err
}
return nil
}

// ContainerKill kills the given container
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TEST_ENVIRONMENT?=true
ES_BEATS?=..

# Metricbeat can only be cross-compiled on platforms not requiring CGO.
GOX_OS=netbsd linux windows
GOX_OS=linux windows
GOX_FLAGS=-arch="amd64 386 arm ppc64 ppc64le"

DOCS_BRANCH=$(shell grep doc-branch ../libbeat/docs/version.asciidoc | cut -c 14-)
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/module/docker/image/image_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.

// +build integration

package image

import (
Expand Down

This file was deleted.

21 changes: 21 additions & 0 deletions vendor/github.com/Microsoft/hcsshim/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions vendor/github.com/Microsoft/hcsshim/osversion/osversion_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions vendor/github.com/Microsoft/hcsshim/osversion/windowsbuilds.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions vendor/github.com/Shopify/sarama/dev.yml

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/github.com/aws/aws-sdk-go-v2/NOTICE.txt

This file was deleted.

17 changes: 0 additions & 17 deletions vendor/github.com/aws/aws-sdk-go-v2/buildspec-NoGoMods.yml

This file was deleted.

12 changes: 0 additions & 12 deletions vendor/github.com/aws/aws-sdk-go-v2/buildspec.yml

This file was deleted.

20 changes: 20 additions & 0 deletions vendor/github.com/beorn7/perks/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 44f4b3f

Please sign in to comment.