Skip to content

Commit 09b2766

Browse files
authored
Merge pull request #4 from runloopai/container-image-fixes
Adding workflow fixes
2 parents 20fc9dc + d8b00c1 commit 09b2766

File tree

9 files changed

+173
-136
lines changed

9 files changed

+173
-136
lines changed

.devcontainer/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM mcr.microsoft.com/devcontainers/go
2+
# Install additional OS packages
3+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
4+
&& apt-get -y install --no-install-recommends \
5+
libcurl4-openssl-dev \
6+
libssl-dev \
7+
libaio-dev \
8+
libnl-3-dev \
9+
libnl-genl-3-dev \
10+
libgflags-dev \
11+
libzstd-dev \
12+
libext2fs-dev \
13+
libgtest-dev \
14+
libtool \
15+
zlib1g-dev \
16+
e2fsprogs \
17+
pkg-config \
18+
autoconf \
19+
automake \
20+
g++ \
21+
cmake \
22+
&& apt-get clean -y \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
# Set up workspace directory
26+
WORKDIR /workspaces/accelerated-container-image

.devcontainer/devcontainer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Accelerated Container Image Dev",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"settings": {
9+
"go.toolsManagement.checkForUpdates": "local",
10+
"go.useLanguageServer": true,
11+
"go.gopath": "/go"
12+
},
13+
"extensions": [
14+
"golang.go",
15+
"ms-vscode.cmake-tools",
16+
"ms-vscode.cpptools"
17+
]
18+
}
19+
},
20+
"runArgs": [
21+
"--cap-add=SYS_PTRACE",
22+
"--security-opt",
23+
"seccomp=unconfined",
24+
"--privileged"
25+
],
26+
"remoteUser": "root",
27+
"features": {
28+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
29+
"version": "latest",
30+
"moby": true
31+
}
32+
}
33+
}

.github/workflows/check.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

.golangci.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1+
version: "2"
2+
run:
3+
go: "1.21"
14
linters:
25
enable:
36
- depguard
4-
- staticcheck
5-
- unconvert
6-
- gofmt
7-
- goimports
8-
- ineffassign
9-
- govet
10-
- unused
117
- misspell
8+
- unconvert
129
disable:
1310
- errcheck
14-
15-
linters-settings:
16-
depguard:
17-
rules:
18-
main:
19-
deny:
20-
- pkg: io/ioutil
21-
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
11+
settings:
12+
depguard:
13+
rules:
14+
main:
15+
deny:
16+
- pkg: io/ioutil
17+
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
18+
exclusions:
19+
generated: lax
20+
presets:
21+
- comments
22+
- common-false-positives
23+
- legacy
24+
- std-error-handling
25+
paths:
26+
- third_party$
27+
- builtin$
28+
- examples$
29+
formatters:
30+
enable:
31+
- gofmt
32+
- goimports
33+
exclusions:
34+
generated: lax
35+
paths:
36+
- third_party$
37+
- builtin$
38+
- examples$

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ install: ## install binaries from bin
3333
@install -m 0644 script/overlaybd-snapshotter.service $(SN_DESTDIR)
3434
@mkdir -p ${SN_CFGDIR}
3535
@install -m 0644 script/config.json ${SN_CFGDIR}
36-
test: ## run tests that require root
37-
@go test ${GO_TESTFLAGS} ${GO_PACKAGES} -test.root
36+
test: test-regular test-root ## run all tests (both regular and root-requiring tests)
37+
38+
test-regular: ## run tests that don't require root
39+
@go run gotest.tools/gotestsum --format standard-quiet -- ${GO_TESTFLAGS} $(shell go list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /pkg/snapshot)
40+
41+
test-root: ## run tests that require root privileges
42+
@sudo go run gotest.tools/gotestsum --format standard-quiet -- ${GO_TESTFLAGS} ./pkg/snapshot -test.root
3843

3944
clean:
4045
@rm -rf ./bin

cmd/convertor/builder/builder_utils_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,19 @@ func Test_fetchManifest(t *testing.T) {
7777
},
7878
ctx: ctx,
7979
},
80-
// The manifest list is expected to select the first manifest that can be converted
81-
// in the list, for this image that is the very first one.
80+
// When we fetch a manifest list:
81+
// 1. The function receives a manifest list containing multiple platform variants
82+
// 2. It uses platforms.Default() to select the best manifest for current platform
83+
// 3. It then fetches and returns that specific manifest
84+
//
85+
// This descriptor describes what we expect the selected manifest to look like.
86+
// We don't compare digests because the selected manifest depends on the platform,
87+
// but we do verify we got a manifest for the correct platform with correct type.
8288
wantSubDesc: v1.Descriptor{
83-
MediaType: images.MediaTypeDockerSchema2Manifest,
89+
// The config media type we expect to see in the manifest
8490
Digest: testingresources.DockerV2_Manifest_Simple_Digest,
8591
Size: 525,
92+
MediaType: images.MediaTypeDockerSchema2Config,
8693
Platform: &v1.Platform{
8794
Architecture: "amd64",
8895
OS: "linux",
@@ -137,9 +144,14 @@ func Test_fetchManifest(t *testing.T) {
137144

138145
contentDigest := digest.FromBytes(content)
139146

147+
// Handle two different cases:
148+
// 1. Regular manifests (direct manifest references)
149+
// 2. Manifest lists (which require platform-specific manifest selection)
140150
if tt.args.desc.MediaType != images.MediaTypeDockerSchema2ManifestList &&
141151
tt.args.desc.MediaType != v1.MediaTypeImageIndex {
142-
152+
153+
// For regular manifests, we can directly compare the digest
154+
// because we expect to get back exactly what we asked for
143155
if tt.args.desc.Digest != contentDigest {
144156
t.Errorf("fetchManifest() = %v, want %v", manifest, tt.want)
145157
}

go.mod

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ require (
2525
github.com/sirupsen/logrus v1.9.3
2626
github.com/spf13/cobra v1.8.1
2727
github.com/urfave/cli/v2 v2.27.6
28-
golang.org/x/sync v0.14.0
28+
go.opentelemetry.io/otel v1.35.0
29+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0
30+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0
31+
go.opentelemetry.io/otel/sdk v1.35.0
32+
go.opentelemetry.io/otel/trace v1.35.0
33+
golang.org/x/sync v0.15.0
2934
golang.org/x/sys v0.33.0
3035
google.golang.org/grpc v1.72.2
36+
gotest.tools/gotestsum v1.12.3
3137
oras.land/oras-go/v2 v2.5.0
3238
)
3339

@@ -36,6 +42,7 @@ require (
3642
github.com/Microsoft/go-winio v0.6.2 // indirect
3743
github.com/Microsoft/hcsshim v0.13.0 // indirect
3844
github.com/beorn7/perks v1.0.1 // indirect
45+
github.com/bitfield/gotestdox v0.2.2 // indirect
3946
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
4047
github.com/cespare/xxhash/v2 v2.3.0 // indirect
4148
github.com/cilium/ebpf v0.16.0 // indirect
@@ -53,6 +60,8 @@ require (
5360
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
5461
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
5562
github.com/distribution/reference v0.6.0 // indirect
63+
github.com/dnephin/pflag v1.0.7 // indirect
64+
github.com/fatih/color v1.18.0 // indirect
5665
github.com/felixge/httpsnoop v1.0.4 // indirect
5766
github.com/fsnotify/fsnotify v1.9.0 // indirect
5867
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
@@ -62,11 +71,14 @@ require (
6271
github.com/gogo/protobuf v1.3.2 // indirect
6372
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
6473
github.com/google/go-cmp v0.7.0 // indirect
74+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
6575
github.com/google/uuid v1.6.0 // indirect
6676
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect
6777
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6878
github.com/intel/goresctrl v0.8.0 // indirect
6979
github.com/klauspost/compress v1.18.0 // indirect
80+
github.com/mattn/go-colorable v0.1.13 // indirect
81+
github.com/mattn/go-isatty v0.0.20 // indirect
7082
github.com/mdlayher/socket v0.5.1 // indirect
7183
github.com/mdlayher/vsock v1.2.1 // indirect
7284
github.com/moby/sys/sequential v0.6.0 // indirect
@@ -94,17 +106,14 @@ require (
94106
go.opencensus.io v0.24.0 // indirect
95107
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
96108
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
97-
go.opentelemetry.io/otel v1.35.0 // indirect
98-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
99-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect
100109
go.opentelemetry.io/otel/metric v1.35.0 // indirect
101-
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
102-
go.opentelemetry.io/otel/trace v1.35.0 // indirect
103110
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
104111
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
105-
golang.org/x/mod v0.24.0 // indirect
106-
golang.org/x/net v0.38.0 // indirect
107-
golang.org/x/text v0.23.0 // indirect
112+
golang.org/x/mod v0.25.0 // indirect
113+
golang.org/x/net v0.41.0 // indirect
114+
golang.org/x/term v0.32.0 // indirect
115+
golang.org/x/text v0.26.0 // indirect
116+
golang.org/x/tools v0.34.0 // indirect
108117
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
109118
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
110119
google.golang.org/protobuf v1.36.6 // indirect

0 commit comments

Comments
 (0)