Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM mcr.microsoft.com/devcontainers/go
# Install additional OS packages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
libcurl4-openssl-dev \
libssl-dev \
libaio-dev \
libnl-3-dev \
libnl-genl-3-dev \
libgflags-dev \
libzstd-dev \
libext2fs-dev \
libgtest-dev \
libtool \
zlib1g-dev \
e2fsprogs \
pkg-config \
autoconf \
automake \
g++ \
cmake \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Set up workspace directory
WORKDIR /workspaces/accelerated-container-image
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "Accelerated Container Image Dev",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go"
},
"extensions": [
"golang.go",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools"
]
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
"--privileged"
],
"remoteUser": "root",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true
}
}
}
93 changes: 0 additions & 93 deletions .github/workflows/check.yml

This file was deleted.

47 changes: 32 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
version: "2"
run:
go: "1.21"
linters:
enable:
- depguard
- staticcheck
- unconvert
- gofmt
- goimports
- ineffassign
- govet
- unused
- misspell
- unconvert
disable:
- errcheck

linters-settings:
depguard:
rules:
main:
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
settings:
depguard:
rules:
main:
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ install: ## install binaries from bin
@install -m 0644 script/overlaybd-snapshotter.service $(SN_DESTDIR)
@mkdir -p ${SN_CFGDIR}
@install -m 0644 script/config.json ${SN_CFGDIR}
test: ## run tests that require root
@go test ${GO_TESTFLAGS} ${GO_PACKAGES} -test.root
test: test-regular test-root ## run all tests (both regular and root-requiring tests)

test-regular: ## run tests that don't require root
@go run gotest.tools/gotestsum --format standard-quiet -- ${GO_TESTFLAGS} $(shell go list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /pkg/snapshot)

test-root: ## run tests that require root privileges
@sudo go run gotest.tools/gotestsum --format standard-quiet -- ${GO_TESTFLAGS} ./pkg/snapshot -test.root

clean:
@rm -rf ./bin
Expand Down
20 changes: 16 additions & 4 deletions cmd/convertor/builder/builder_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,19 @@ func Test_fetchManifest(t *testing.T) {
},
ctx: ctx,
},
// The manifest list is expected to select the first manifest that can be converted
// in the list, for this image that is the very first one.
// When we fetch a manifest list:
// 1. The function receives a manifest list containing multiple platform variants
// 2. It uses platforms.Default() to select the best manifest for current platform
// 3. It then fetches and returns that specific manifest
//
// This descriptor describes what we expect the selected manifest to look like.
// We don't compare digests because the selected manifest depends on the platform,
// but we do verify we got a manifest for the correct platform with correct type.
wantSubDesc: v1.Descriptor{
MediaType: images.MediaTypeDockerSchema2Manifest,
// The config media type we expect to see in the manifest
Digest: testingresources.DockerV2_Manifest_Simple_Digest,
Size: 525,
MediaType: images.MediaTypeDockerSchema2Config,
Platform: &v1.Platform{
Architecture: "amd64",
OS: "linux",
Expand Down Expand Up @@ -137,9 +144,14 @@ func Test_fetchManifest(t *testing.T) {

contentDigest := digest.FromBytes(content)

// Handle two different cases:
// 1. Regular manifests (direct manifest references)
// 2. Manifest lists (which require platform-specific manifest selection)
if tt.args.desc.MediaType != images.MediaTypeDockerSchema2ManifestList &&
tt.args.desc.MediaType != v1.MediaTypeImageIndex {


// For regular manifests, we can directly compare the digest
// because we expect to get back exactly what we asked for
if tt.args.desc.Digest != contentDigest {
t.Errorf("fetchManifest() = %v, want %v", manifest, tt.want)
}
Expand Down
27 changes: 18 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
github.com/urfave/cli/v2 v2.27.6
golang.org/x/sync v0.14.0
go.opentelemetry.io/otel v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0
go.opentelemetry.io/otel/sdk v1.35.0
go.opentelemetry.io/otel/trace v1.35.0
golang.org/x/sync v0.15.0
golang.org/x/sys v0.33.0
google.golang.org/grpc v1.72.2
gotest.tools/gotestsum v1.12.3
oras.land/oras-go/v2 v2.5.0
)

Expand All @@ -36,6 +42,7 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.13.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bitfield/gotestdox v0.2.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cilium/ebpf v0.16.0 // indirect
Expand All @@ -53,6 +60,8 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/dnephin/pflag v1.0.7 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
Expand All @@ -62,11 +71,14 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/intel/goresctrl v0.8.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mdlayher/socket v0.5.1 // indirect
github.com/mdlayher/vsock v1.2.1 // indirect
github.com/moby/sys/sequential v0.6.0 // indirect
Expand Down Expand Up @@ -94,17 +106,14 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/mod v0.24.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/tools v0.34.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/protobuf v1.36.6 // indirect
Expand Down
Loading
Loading