Skip to content

Commit 09285ba

Browse files
dylanhittHitt, Dylan F
andauthored
bump docker version (#184)
* bump docker version * update test.sh for proper dns resolution * upgrade codeclimate reporter and bump docker version * at docker api server negotiation with and switch from NewEnvClient to NewClientWithOpts as newEnvClient is deprecated * add nameserver to resolve.conf * remove extra commander test in makefile * use golang image from build for docker-exec test * code cleanup * Go mody tidy Co-authored-by: Hitt, Dylan F <dylan.hitt@gd-ms.com>
1 parent 2acd0b2 commit 09285ba

782 files changed

Lines changed: 248924 additions & 5081 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

commander_unix.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ tests:
126126
exit-code: 0
127127

128128
it should execute test from url:
129+
skip: false
129130
config:
130131
env:
131132
USER: from_parent

go.mod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@ go 1.17
55
require (
66
github.com/antchfx/xmlquery v1.3.5
77
github.com/commander-cli/cmd v1.3.0
8-
github.com/docker/docker v1.13.1
8+
github.com/containerd/containerd v1.5.8 // indirect
9+
github.com/docker/docker v20.10.11+incompatible
10+
github.com/docker/go-connections v0.4.0 // indirect
11+
github.com/gorilla/mux v1.8.0 // indirect
912
github.com/logrusorgru/aurora v2.0.3+incompatible
13+
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
14+
github.com/morikuni/aec v1.0.0 // indirect
15+
github.com/opencontainers/image-spec v1.0.2 // indirect
1016
github.com/pmezard/go-difflib v1.0.0
1117
github.com/stretchr/testify v1.7.0
1218
github.com/tidwall/gjson v1.9.3
1319
github.com/urfave/cli v1.22.5
1420
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
21+
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
22+
google.golang.org/grpc v1.42.0 // indirect
1523
gopkg.in/h2non/gock.v1 v1.0.16
1624
gopkg.in/yaml.v2 v2.4.0
1725
)

go.sum

Lines changed: 926 additions & 7 deletions
Large diffs are not rendered by default.

integration/linux/docker.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ tests:
1818
PRETTY_NAME="Alpine Linux v3.11"
1919
HOME_URL="https://alpinelinux.org/"
2020
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
21-
2221
"id -u":
2322
stdout: "1001"

pkg/runtime/docker_executor.go

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import (
66
"encoding/base64"
77
"encoding/json"
88
"fmt"
9-
"github.com/docker/docker/api/types"
10-
"github.com/docker/docker/api/types/container"
11-
"github.com/docker/docker/client"
12-
"github.com/docker/docker/pkg/stdcopy"
139
"log"
1410
"os"
1511
"strings"
1612
"time"
13+
14+
"github.com/docker/docker/api/types"
15+
"github.com/docker/docker/api/types/container"
16+
"github.com/docker/docker/client"
17+
"github.com/docker/docker/pkg/stdcopy"
1718
)
1819

1920
var _ Executor = (*DockerExecutor)(nil)
@@ -34,7 +35,7 @@ func (e DockerExecutor) Execute(test TestCase) TestResult {
3435
log.Printf("DOCKER_API_VERSION: %s \n", os.Getenv("DOCKER_API_VERSION"))
3536

3637
ctx := context.Background()
37-
cli, err := client.NewEnvClient()
38+
cli, err := client.NewClientWithOpts(client.WithAPIVersionNegotiation(), client.FromEnv)
3839
if err != nil {
3940
test.Result.Error = err
4041
return TestResult{
@@ -72,14 +73,15 @@ func (e DockerExecutor) Execute(test TestCase) TestResult {
7273
}
7374

7475
log.Printf("Create container %s\n", e.Image)
75-
resp, err := cli.ContainerCreate(ctx, &container.Config{
76-
Image: e.Image,
77-
WorkingDir: test.Command.Dir,
78-
Env: env,
79-
User: e.ExecUser,
80-
Cmd: []string{"/bin/sh", "-c", test.Command.Cmd},
81-
Tty: false,
82-
}, nil, nil, "")
76+
resp, err := cli.ContainerCreate(ctx,
77+
&container.Config{
78+
Image: e.Image,
79+
WorkingDir: test.Command.Dir,
80+
Env: env,
81+
User: e.ExecUser,
82+
Cmd: []string{"/bin/sh", "-c", test.Command.Cmd},
83+
Tty: false,
84+
}, nil, nil, nil, "")
8385
if err != nil {
8486
test.Result.Error = fmt.Errorf("could not pull image '%s' with error: '%s'", e.Image, err)
8587
return TestResult{
@@ -94,12 +96,19 @@ func (e DockerExecutor) Execute(test TestCase) TestResult {
9496
TestCase: test,
9597
}
9698
}
99+
97100
duration := time.Duration(1 * time.Second)
98101
defer cli.ContainerStop(ctx, resp.ID, &duration)
99102

100-
status, err := cli.ContainerWait(ctx, resp.ID)
101-
if err != nil {
102-
panic(err)
103+
status := container.ContainerWaitOKBody{}
104+
statusCh, errC := cli.ContainerWait(ctx, resp.ID, "")
105+
select {
106+
case err := <-errC:
107+
if err != nil {
108+
panic(err)
109+
}
110+
case s := <-statusCh:
111+
status = s
103112
}
104113

105114
out, err := cli.ContainerLogs(ctx, resp.ID, types.ContainerLogsOptions{ShowStdout: true, ShowStderr: true})
@@ -119,9 +128,10 @@ func (e DockerExecutor) Execute(test TestCase) TestResult {
119128
log.Println("title: '"+test.Title+"'", " Directory: ", test.Command.Dir)
120129
log.Println("title: '"+test.Title+"'", " Env: ", test.Command.Env)
121130

131+
// status := <-waitBody
122132
// Write test result
123133
test.Result = CommandResult{
124-
ExitCode: int(status),
134+
ExitCode: int(status.StatusCode),
125135
Stdout: strings.TrimSpace(strings.Replace(stdout.String(), "\r\n", "\n", -1)),
126136
Stderr: strings.TrimSpace(strings.Replace(stderr.String(), "\r\n", "\n", -1)),
127137
}

test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,3 @@ if [[ "$NO_CLEANUP" -eq "0" ]]; then
6666
fi
6767

6868
exit $status_code
69-

vendor/github.com/Microsoft/go-winio/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Microsoft/go-winio/fileinfo.go

Lines changed: 24 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Microsoft/go-winio/hvsock.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)