Skip to content

Commit

Permalink
deps: update docker to 23.0.3 (#16862)
Browse files Browse the repository at this point in the history
* [no ci] deps: update docker to 23.0.3

This PR brings our docker/docker dependency (which is hosted at github.com/moby/moby)
up to 23.0.3 (forward about 2 years). Refactored our use of docker/libnetwork to
reference the package in its new home, which is docker/docker/libnetwork (it is
no longer an independent repository). Some minor nearby test case cleanup as well.

* add cl
  • Loading branch information
shoenig committed Apr 12, 2023
1 parent a1ebd07 commit 74b16da
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 83 deletions.
3 changes: 3 additions & 0 deletions .changelog/16862.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
deps: update docker to 23.0.3
```
4 changes: 2 additions & 2 deletions drivers/docker/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1482,10 +1482,10 @@ func TestDockerDriver_DNS(t *testing.T) {
require.NoError(t, task.EncodeConcreteDriverConfig(cfg))

_, d, _, cleanup := dockerSetup(t, task, nil)
defer cleanup()
t.Cleanup(cleanup)

require.NoError(t, d.WaitUntilStarted(task.ID, 5*time.Second))
defer d.DestroyTask(task.ID, true)
t.Cleanup(func() { _ = d.DestroyTask(task.ID, true) })

dtestutil.TestTaskDNSConfig(t, d, task.ID, c.cfg)
}
Expand Down
24 changes: 13 additions & 11 deletions drivers/shared/resolvconf/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os"
"path/filepath"

dresolvconf "github.com/docker/libnetwork/resolvconf"
"github.com/docker/libnetwork/types"
"github.com/docker/docker/libnetwork/resolvconf"
"github.com/docker/docker/libnetwork/types"
"github.com/hashicorp/nomad/plugins/drivers"
)

Expand Down Expand Up @@ -37,15 +37,15 @@ func GenerateDNSMount(taskDir string, conf *drivers.DNSConfig) (*drivers.MountCo
return mount, nil
}

currRC, err := dresolvconf.Get()
currRC, err := resolvconf.Get()
if err != nil {
return nil, err
}

var (
dnsList = dresolvconf.GetNameservers(currRC.Content, types.IP)
dnsSearchList = dresolvconf.GetSearchDomains(currRC.Content)
dnsOptionsList = dresolvconf.GetOptions(currRC.Content)
dnsList = resolvconf.GetNameservers(currRC.Content, types.IP)
dnsSearchList = resolvconf.GetSearchDomains(currRC.Content)
dnsOptionsList = resolvconf.GetOptions(currRC.Content)
)
if nServers > 0 {
dnsList = conf.Servers
Expand All @@ -57,25 +57,27 @@ func GenerateDNSMount(taskDir string, conf *drivers.DNSConfig) (*drivers.MountCo
dnsOptionsList = conf.Options
}

_, err = dresolvconf.Build(path, dnsList, dnsSearchList, dnsOptionsList)
_, err = resolvconf.Build(path, dnsList, dnsSearchList, dnsOptionsList)
if err != nil {
return nil, err
}

return mount, nil
}

func copySystemDNS(dest string) error {
in, err := os.Open(dresolvconf.Path())
func copySystemDNS(filePath string) error {
in, err := os.Open(resolvconf.Path())
if err != nil {
return err
}
defer in.Close()
defer func() {
_ = in.Close()
}()

content, err := io.ReadAll(in)
if err != nil {
return err
}

return os.WriteFile(dest, content, 0644)
return os.WriteFile(filePath, content, 0644)
}
22 changes: 10 additions & 12 deletions drivers/shared/resolvconf/mount_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0

//go:build !windows
// +build !windows

package resolvconf

Expand All @@ -11,21 +10,20 @@ import (
"path/filepath"
"testing"

dresolvconf "github.com/docker/libnetwork/resolvconf"
"github.com/stretchr/testify/require"
"github.com/docker/docker/libnetwork/resolvconf"
"github.com/shoenig/test/must"
)

func Test_copySystemDNS(t *testing.T) {
require := require.New(t)
data, err := os.ReadFile(dresolvconf.Path())
require.NoError(err)
data, err := os.ReadFile(resolvconf.Path())
must.NoError(t, err)

dest := filepath.Join(t.TempDir(), "resolv.conf")
resolvConfFile := filepath.Join(t.TempDir(), "resolv.conf")

require.NoError(copySystemDNS(dest))
require.FileExists(dest)
must.NoError(t, copySystemDNS(resolvConfFile))
must.FileExists(t, resolvConfFile)

tmpResolv, err := os.ReadFile(dest)
require.NoError(err)
require.Equal(data, tmpResolv)
tmpResolv, readErr := os.ReadFile(resolvConfFile)
must.NoError(t, readErr)
must.Eq(t, data, tmpResolv)
}
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ require (
github.com/creack/pty v1.1.18
github.com/docker/cli v23.0.1+incompatible
github.com/docker/distribution v2.8.1+incompatible
github.com/docker/docker v20.10.23+incompatible
github.com/docker/docker v23.0.3+incompatible
github.com/docker/go-units v0.5.0
github.com/docker/libnetwork v0.8.0-dev.2.0.20210525090646-64b7a4574d14
github.com/dustin/go-humanize v1.0.0
github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f
github.com/fsouza/go-dockerclient v1.7.9
Expand Down Expand Up @@ -154,7 +153,6 @@ require (
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Masterminds/sprig/v3 v3.2.1
github.com/Microsoft/hcsshim v0.9.6 // indirect
github.com/VividCortex/ewma v1.1.1 // indirect
github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-cidr v1.0.1 // indirect
Expand All @@ -173,7 +171,6 @@ require (
github.com/cilium/ebpf v0.9.1 // indirect
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible // indirect
github.com/circonus-labs/circonusllhist v0.1.3 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/containerd v1.6.18 // indirect
github.com/coreos/go-oidc/v3 v3.1.0 // indirect
Expand Down Expand Up @@ -230,6 +227,8 @@ require (
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/pointerstructure v1.2.1
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/mrunalp/fileutils v0.5.0 // indirect
github.com/muesli/reflow v0.3.0
Expand Down
Loading

0 comments on commit 74b16da

Please sign in to comment.