Skip to content

Commit e125799

Browse files
authored
update dependencides and fix lint issues (#41)
1 parent c801681 commit e125799

File tree

7 files changed

+138
-157
lines changed

7 files changed

+138
-157
lines changed

autodetect.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/deepfence/vessel/docker"
1717
selfPodman "github.com/deepfence/vessel/podman"
1818
"github.com/deepfence/vessel/utils"
19-
"github.com/docker/docker/api/types"
19+
containerTypes "github.com/docker/docker/api/types/container"
2020
"github.com/docker/docker/client"
2121
"github.com/pkg/errors"
2222
"github.com/sirupsen/logrus"
@@ -240,9 +240,10 @@ func isDockerRunning(host string) (bool, error) {
240240
return false, errors.Wrapf(err, " :error creating docker client")
241241
}
242242
defer dockerCli.Close()
243-
containers, err := dockerCli.ContainerList(context.Background(), types.ContainerListOptions{
244-
All: true, Size: false,
245-
})
243+
containers, err := dockerCli.ContainerList(context.Background(),
244+
containerTypes.ListOptions{
245+
All: true, Size: false,
246+
})
246247
if err != nil {
247248
return false, errors.Wrapf(err, " :error creating docker client")
248249
}
@@ -268,6 +269,9 @@ func isContainerdRunning(host string) (bool, error) {
268269
namespace_store := clientd.NamespaceService()
269270

270271
list, err := namespace_store.List(context.Background())
272+
if err != nil {
273+
return false, errors.Wrapf(err, " :error creating containerd client")
274+
}
271275
for _, l := range list {
272276

273277
namespace := namespaces.WithNamespace(context.Background(), l)

cmd/vessel/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package main
22

33
import (
4+
"os"
5+
46
"github.com/deepfence/vessel"
57
"github.com/joho/godotenv"
68
"github.com/sirupsen/logrus"
7-
"os"
89
)
910

1011
var activeRuntime string

containerd/containerd.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/deepfence/vessel/utils"
1616
"github.com/sirupsen/logrus"
1717

18-
"github.com/containerd/containerd"
1918
containerdApi "github.com/containerd/containerd"
2019
"github.com/containerd/containerd/images"
2120
"github.com/containerd/containerd/images/archive"
@@ -32,7 +31,7 @@ func New(host string) *Containerd {
3231
}
3332

3433
func getNamespaces(host string) []string {
35-
clientd, err := containerd.New(strings.Replace(host, "unix://", "", 1))
34+
clientd, err := containerdApi.New(strings.Replace(host, "unix://", "", 1))
3635
if err != nil {
3736
return nil
3837
}
@@ -233,6 +232,9 @@ func (c Containerd) ExtractFileSystem(imageTarPath string, outputTarPath string,
233232
info, _ := container.Info(ctx)
234233
snapshotter := client.SnapshotService(info.Snapshotter)
235234
mounts, err := snapshotter.Mounts(ctx, info.SnapshotKey)
235+
if err != nil {
236+
logrus.Errorf("Error mount snapshot %s: %s", info.SnapshotKey, err.Error())
237+
}
236238
target := strings.Replace(outputTarPath, ".tar", "", 1) + containerName
237239
_, err = exec.Command("mkdir", target).Output()
238240
if err != nil && !strings.Contains(err.Error(), "exit status 1") {
@@ -281,6 +283,9 @@ func (c Containerd) ExtractFileSystemContainer(containerId string, namespace str
281283
info, _ := container.Info(ctx)
282284
snapshotter := client.SnapshotService(info.Snapshotter)
283285
mounts, err := snapshotter.Mounts(ctx, info.SnapshotKey)
286+
if err != nil {
287+
logrus.Errorf("Error mount snapshot %s: %s", info.SnapshotKey, err.Error())
288+
}
284289
target := strings.Replace(outputTarPath, ".tar", "", 1) + containerId
285290
_, err = exec.Command("mkdir", target).Output()
286291
if err != nil && !strings.Contains(err.Error(), "exit status 1") {

docker/docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (d Docker) ExtractFileSystem(imageTarPath string, outputTarPath string, ima
8484
}
8585
}
8686
if imageId == "" {
87-
return errors.New("image not found from docker load with output: " + string(imageMsg.Bytes()))
87+
return errors.New("image not found from docker load with output: " + imageMsg.String())
8888
}
8989
containerOutput, err := utils.RunCommand(exec.Command("docker", "create", imageId), "docker create: "+imageId)
9090
if err != nil {

go.mod

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,63 @@
11
module github.com/deepfence/vessel
22

3-
go 1.20
3+
go 1.21
44

55
require (
6-
github.com/containerd/containerd v1.7.11
7-
github.com/docker/docker v24.0.7+incompatible
6+
github.com/containerd/containerd v1.7.16
7+
github.com/docker/docker v26.1.1+incompatible
88
github.com/joho/godotenv v1.5.1
99
github.com/pkg/errors v0.9.1
1010
github.com/sirupsen/logrus v1.9.3
11-
google.golang.org/grpc v1.60.1
11+
google.golang.org/grpc v1.63.2
1212
)
1313

1414
require (
1515
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
16-
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect
17-
github.com/Microsoft/go-winio v0.6.1 // indirect
18-
github.com/Microsoft/hcsshim v0.11.4 // indirect
19-
github.com/containerd/cgroups v1.1.0 // indirect
20-
github.com/containerd/continuity v0.4.2 // indirect
16+
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20231105174938-2b5cbb29f3e2 // indirect
17+
github.com/Microsoft/go-winio v0.6.2 // indirect
18+
github.com/Microsoft/hcsshim v0.12.3 // indirect
19+
github.com/containerd/cgroups/v3 v3.0.2 // indirect
20+
github.com/containerd/continuity v0.4.3 // indirect
21+
github.com/containerd/errdefs v0.1.0 // indirect
2122
github.com/containerd/fifo v1.1.0 // indirect
2223
github.com/containerd/log v0.1.0 // indirect
23-
github.com/containerd/ttrpc v1.2.2 // indirect
24+
github.com/containerd/ttrpc v1.2.3 // indirect
2425
github.com/containerd/typeurl/v2 v2.1.1 // indirect
25-
github.com/docker/distribution v2.8.1+incompatible // indirect
26-
github.com/docker/go-connections v0.4.0 // indirect
26+
github.com/distribution/reference v0.6.0 // indirect
27+
github.com/docker/go-connections v0.5.0 // indirect
2728
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
2829
github.com/docker/go-units v0.5.0 // indirect
29-
github.com/felixge/httpsnoop v1.0.3 // indirect
30-
github.com/go-logr/logr v1.2.4 // indirect
30+
github.com/felixge/httpsnoop v1.0.4 // indirect
31+
github.com/go-logr/logr v1.4.1 // indirect
3132
github.com/go-logr/stdr v1.2.2 // indirect
3233
github.com/gogo/protobuf v1.3.2 // indirect
3334
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
34-
github.com/golang/protobuf v1.5.3 // indirect
35-
github.com/google/go-cmp v0.5.9 // indirect
36-
github.com/google/uuid v1.3.1 // indirect
37-
github.com/klauspost/compress v1.16.0 // indirect
35+
github.com/google/go-cmp v0.6.0 // indirect
36+
github.com/google/uuid v1.6.0 // indirect
37+
github.com/klauspost/compress v1.17.8 // indirect
38+
github.com/moby/docker-image-spec v1.3.1 // indirect
3839
github.com/moby/locker v1.0.1 // indirect
39-
github.com/moby/sys/mountinfo v0.6.2 // indirect
40+
github.com/moby/sys/mountinfo v0.7.1 // indirect
4041
github.com/moby/sys/sequential v0.5.0 // indirect
4142
github.com/moby/sys/signal v0.7.0 // indirect
43+
github.com/moby/sys/user v0.1.0 // indirect
4244
github.com/moby/term v0.5.0 // indirect
4345
github.com/morikuni/aec v1.0.0 // indirect
4446
github.com/opencontainers/go-digest v1.0.0 // indirect
45-
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
46-
github.com/opencontainers/runc v1.1.5 // indirect
47-
github.com/opencontainers/runtime-spec v1.1.0-rc.1 // indirect
47+
github.com/opencontainers/image-spec v1.1.0 // indirect
48+
github.com/opencontainers/runtime-spec v1.2.0 // indirect
4849
github.com/opencontainers/selinux v1.11.0 // indirect
4950
go.opencensus.io v0.24.0 // indirect
50-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
51-
go.opentelemetry.io/otel v1.19.0 // indirect
52-
go.opentelemetry.io/otel/metric v1.19.0 // indirect
53-
go.opentelemetry.io/otel/trace v1.19.0 // indirect
54-
golang.org/x/mod v0.11.0 // indirect
55-
golang.org/x/net v0.17.0 // indirect
56-
golang.org/x/sync v0.4.0 // indirect
57-
golang.org/x/sys v0.13.0 // indirect
58-
golang.org/x/text v0.13.0 // indirect
59-
golang.org/x/tools v0.10.0 // indirect
60-
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
61-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
62-
google.golang.org/protobuf v1.31.0 // indirect
51+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 // indirect
52+
go.opentelemetry.io/otel v1.26.0 // indirect
53+
go.opentelemetry.io/otel/metric v1.26.0 // indirect
54+
go.opentelemetry.io/otel/trace v1.26.0 // indirect
55+
golang.org/x/net v0.24.0 // indirect
56+
golang.org/x/sync v0.7.0 // indirect
57+
golang.org/x/sys v0.20.0 // indirect
58+
golang.org/x/text v0.15.0 // indirect
59+
google.golang.org/genproto v0.0.0-20240429193739-8cf5692501f6 // indirect
60+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect
61+
google.golang.org/protobuf v1.34.0 // indirect
6362
gotest.tools/v3 v3.5.1 // indirect
6463
)

0 commit comments

Comments
 (0)