Skip to content

Commit

Permalink
Update to containerd v2
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
  • Loading branch information
apostasie committed Jul 10, 2024
1 parent e01b2e1 commit ac10622
Show file tree
Hide file tree
Showing 37 changed files with 410 additions and 841 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ jobs:

strategy:
matrix:
go-version: [1.19]
go-version: [1.22.0]

steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
- uses: actions/checkout@v4
- uses: golangci/golangci-lint-action@v6
with:
version: v1.50.1
version: v1.59
skip-cache: true
args: --timeout=5m

Expand All @@ -40,7 +40,7 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/containerd/accelerated-container-image
fetch-depth: 100
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
type: string

env:
GO_VERSION: "1.19"
GO_VERSION: "1.22.0"
OBD_VERSION: "1.0.9"

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
fetch-depth: 100

- name: install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.19'
go-version: '1.22.0'

- name: set env
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: 1.19
go-version: 1.22.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3

- run: |
make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "v*"

env:
GO_VERSION: "1.19"
GO_VERSION: "1.22.0"

jobs:
build:
Expand All @@ -23,7 +23,7 @@ jobs:
releasever="${releasever#refs/tags/}"
echo "RELEASE_VERSION=${releasever}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100
- name: Setup buildx instance
Expand Down
13 changes: 6 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ linters:
- gofmt
- goimports
- ineffassign
- vet
- govet
- unused
- misspell
disable:
- errcheck

linters-settings:
depguard:
list-type: denylist
include-go-root: true
packages:
# use "io" or "os" instead
# https://go.dev/doc/go1.16#ioutil
- io/ioutil
rules:
main:
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
12 changes: 6 additions & 6 deletions cmd/convertor/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ import (
"time"

"github.com/containerd/accelerated-container-image/cmd/convertor/database"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/reference"
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/containerd/v2/core/remotes"
"github.com/containerd/containerd/v2/core/remotes/docker"
"github.com/containerd/containerd/v2/pkg/reference"
"github.com/containerd/log"
"github.com/containerd/platforms"
"github.com/opencontainers/go-digest"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
Expand Down
6 changes: 3 additions & 3 deletions cmd/convertor/builder/builder_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"path"

"github.com/containerd/accelerated-container-image/cmd/convertor/database"
"github.com/containerd/containerd/archive/compression"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/containerd/v2/core/remotes"
"github.com/containerd/containerd/v2/pkg/archive/compression"
"github.com/containerd/continuity"
"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1"
Expand Down
4 changes: 2 additions & 2 deletions cmd/convertor/builder/builder_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"testing"

testingresources "github.com/containerd/accelerated-container-image/cmd/convertor/testingresources"
_ "github.com/containerd/containerd/pkg/testutil" // Handle custom root flag
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/v2/core/remotes"
_ "github.com/containerd/containerd/v2/pkg/testutil" // Handle custom root flag
"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/convertor/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"testing"
"time"

_ "github.com/containerd/containerd/pkg/testutil" // Handle custom root flag
_ "github.com/containerd/containerd/v2/pkg/testutil" // Handle custom root flag
specs "github.com/opencontainers/image-spec/specs-go/v1"
)

Expand Down
14 changes: 7 additions & 7 deletions cmd/convertor/builder/builder_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import (
"os"
"path"

"github.com/containerd/containerd/archive/compression"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/v2/core/content"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/containerd/v2/core/remotes"
"github.com/containerd/containerd/v2/pkg/archive/compression"
"github.com/containerd/continuity"
"github.com/containerd/errdefs"
"github.com/containerd/log"
"github.com/containerd/platforms"
"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
Expand Down
6 changes: 3 additions & 3 deletions cmd/convertor/builder/builder_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (

testingresources "github.com/containerd/accelerated-container-image/cmd/convertor/testingresources"
sn "github.com/containerd/accelerated-container-image/pkg/types"
"github.com/containerd/containerd/images"
_ "github.com/containerd/containerd/pkg/testutil" // Handle custom root flag
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/containerd/v2/core/remotes"
_ "github.com/containerd/containerd/v2/pkg/testutil" // Handle custom root flag
"github.com/opencontainers/go-digest"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/convertor/builder/overlaybd_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
sn "github.com/containerd/accelerated-container-image/pkg/types"
"github.com/containerd/accelerated-container-image/pkg/utils"
"github.com/containerd/accelerated-container-image/pkg/version"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/errdefs"
"github.com/opencontainers/go-digest"
"github.com/opencontainers/image-spec/identity"
specs "github.com/opencontainers/image-spec/specs-go/v1"
Expand Down
7 changes: 4 additions & 3 deletions cmd/convertor/builder/overlaybd_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import (

testingresources "github.com/containerd/accelerated-container-image/cmd/convertor/testingresources"
sn "github.com/containerd/accelerated-container-image/pkg/types"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images"
_ "github.com/containerd/containerd/pkg/testutil" // Handle custom root flag
"github.com/containerd/errdefs"

"github.com/containerd/containerd/v2/core/images"
_ "github.com/containerd/containerd/v2/pkg/testutil" // Handle custom root flag
"github.com/opencontainers/go-digest"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/convertor/builder/turboOCI_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
sn "github.com/containerd/accelerated-container-image/pkg/types"
"github.com/containerd/accelerated-container-image/pkg/utils"
"github.com/containerd/accelerated-container-image/pkg/version"
"github.com/containerd/containerd/archive/compression"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/containerd/v2/pkg/archive/compression"
"github.com/containerd/errdefs"
"github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go/v1"

Expand Down
2 changes: 1 addition & 1 deletion cmd/convertor/database/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"database/sql"
"fmt"

"github.com/containerd/containerd/log"
"github.com/containerd/log"
"github.com/opencontainers/go-digest"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/convertor/testingresources/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"strings"

"github.com/containerd/containerd/reference"
"github.com/containerd/containerd/v2/pkg/reference"
)

/*
Expand Down
4 changes: 2 additions & 2 deletions cmd/convertor/testingresources/local_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"os"
"path/filepath"

"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/errdefs"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/convertor/testingresources/local_remotes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"io"
"time"

"github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker"
"github.com/containerd/containerd/v2/core/content"
"github.com/containerd/containerd/v2/core/remotes"
"github.com/containerd/containerd/v2/core/remotes/docker"
"github.com/containerd/errdefs"
"github.com/opencontainers/go-digest"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/convertor/testingresources/local_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"io"
"strings"

"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/v2/core/images"
"github.com/containerd/errdefs"
"github.com/opencontainers/go-digest"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2/content/oci"
Expand Down
2 changes: 1 addition & 1 deletion cmd/convertor/testingresources/serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"encoding/json"
"errors"

"github.com/containerd/containerd/images"
"github.com/containerd/containerd/v2/core/images"
"github.com/opencontainers/go-digest"
"github.com/opencontainers/image-spec/specs-go"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
Expand Down
4 changes: 2 additions & 2 deletions cmd/convertor/testingresources/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"path/filepath"
"testing"

"github.com/containerd/containerd/pkg/testutil"
"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/v2/core/remotes"
"github.com/containerd/containerd/v2/pkg/testutil"
)

func GetLocalRegistryPath() string {
Expand Down
12 changes: 3 additions & 9 deletions cmd/ctr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ package main

import (
"fmt"
"math/rand"
"os"
"time"

"github.com/containerd/containerd/cmd/ctr/app"
"github.com/urfave/cli"
"github.com/containerd/containerd/v2/cmd/ctr/app"
"github.com/urfave/cli/v2"
)

func init() {
rand.Seed(time.Now().UnixNano())
}

var pluginCmds = []cli.Command{
var pluginCmds = []*cli.Command{
rpullCommand,
convertCommand,
recordTraceCommand,
Expand Down
21 changes: 11 additions & 10 deletions cmd/ctr/overlaybd_conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,42 @@ import (
"time"

obdconv "github.com/containerd/accelerated-container-image/pkg/convertor"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/images/converter"
"github.com/containerd/containerd/leases"

"github.com/containerd/containerd/v2/cmd/ctr/commands"
"github.com/containerd/containerd/v2/core/images/converter"
"github.com/containerd/containerd/v2/core/leases"
_ "github.com/go-sql-driver/mysql"
"github.com/pkg/errors"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

var convertCommand = cli.Command{
var convertCommand = &cli.Command{
Name: "obdconv",
Usage: "convert image layer into overlaybd format type",
ArgsUsage: "<src-image> <dst-image>",
Description: `Export images to an OCI tar[.gz] into zfile format`,
Flags: append(commands.RegistryFlags,
cli.StringFlag{
&cli.StringFlag{
Name: "fstype",
Usage: "filesystem type(required), used to mount block device, support specifying mount options and mkfs options, separate fs type and options by ';', separate mount options by ',', separate mkfs options by ' '",
Value: "ext4",
},
cli.StringFlag{
&cli.StringFlag{
Name: "dbstr",
Usage: "data base config string used for layer deduplication",
Value: "",
},
cli.StringFlag{
&cli.StringFlag{
Name: "algorithm",
Usage: "compress algorithm uses in zfile, [lz4|zstd]",
Value: "",
},
cli.IntFlag{
&cli.IntFlag{
Name: "bs",
Usage: "The size of a compressed data block in KB. Must be a power of two between 4K~64K [4/8/16/32/64]",
Value: 0,
},
cli.IntFlag{
&cli.IntFlag{
Name: "vsize",
Usage: "virtual block device size (GB)",
Value: 64,
Expand Down
Loading

0 comments on commit ac10622

Please sign in to comment.