#16 Update to 1.7.15. Fixes rhbz#2177352.
Merged a year ago by sergiomb. Opened a year ago by gotmax23.
rpms/ gotmax23/containerd 1.7.15  into  rawhide

file modified
+1 -1
@@ -1,2 +1,2 @@ 

- containerd-*.tar.gz

+ containerd-*.tar.*

  clog

@@ -1,33 +0,0 @@ 

- From 788f2f928c1d0099d3861553bf82e83169811a29 Mon Sep 17 00:00:00 2001

- From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>

- Date: Tue, 1 Nov 2022 22:09:38 +0100

- Subject: [PATCH] Add reaper StartLocked

- 

- ---

-  sys/reaper/reaper_unix.go | 10 ++++++++++

-  1 file changed, 10 insertions(+)

- 

- diff --git a/sys/reaper/reaper_unix.go b/sys/reaper/reaper_unix.go

- index 6c4f13b90..a6d6a1e77 100644

- --- a/sys/reaper/reaper_unix.go

- +++ b/sys/reaper/reaper_unix.go

- @@ -101,6 +101,16 @@ func (m *Monitor) Start(c *exec.Cmd) (chan runc.Exit, error) {

-  	return ec, nil

-  }

-  

- +// StartLocked starts the command a registers the process with the reaper

- +func (m *Monitor) StartLocked(c *exec.Cmd) (chan runc.Exit, error) {

- +	ec := m.Subscribe()

- +	if err := c.Start(); err != nil {

- +		m.Unsubscribe(ec)

- +		return nil, err

- +	}

- +	return ec, nil

- +}

- +

-  // Wait blocks until a process is signal as dead.

-  // User should rely on the value of the exit status to determine if the

-  // command was successful or not.

- -- 

- 2.38.1

- 

@@ -0,0 +1,48 @@ 

+ From 83e6fb7438808e50f8ac8707d8492d1a32432915 Mon Sep 17 00:00:00 2001

+ From: Maxwell G <maxwell@gtmx.me>

+ Date: Wed, 13 Mar 2024 22:56:27 +0000

+ Subject: [PATCH] Makefile: adjust GO_LDFLAGS flags

+ 

+ Double quotes are needed for compatibility with Fedora's

+ `%{gobuild_ldflags_shescaped}`. We use single quotes within our flags

+ definition.

+ 

+ We also disable static linking for SHIM_GO_LDFLAGS and re-enable

+ SHIM_CGO_ENABLED and PIE in the specfile

+ ---

+  Makefile | 8 ++++----

+  1 file changed, 4 insertions(+), 4 deletions(-)

+ 

+ diff --git a/Makefile b/Makefile

+ index 905dfed..291b494 100644

+ --- a/Makefile

+ +++ b/Makefile

+ @@ -96,13 +96,13 @@ ifneq ($(STATIC),)

+  endif

+  GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(strip $(GO_BUILDTAGS))",)

+  

+ -GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)

+ +GO_LDFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)

+  ifneq ($(STATIC),)

+  	GO_LDFLAGS += -extldflags "-static"

+  endif

+ -GO_LDFLAGS+='

+ +GO_LDFLAGS+="

+  

+ -SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'

+ +SHIM_GO_LDFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)"

+  

+  # Project packages.

+  PACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /integration)

+ @@ -257,7 +257,7 @@ bin/%: cmd/% FORCE

+  # gen-manpages must not have the urfave_cli_no_docs build-tag set

+  bin/gen-manpages: cmd/gen-manpages FORCE

+  	@echo "$(WHALE) $@"

+ -	$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@ ${GO_LDFLAGS} $(subst urfave_cli_no_docs,,${GO_TAGS})  ./cmd/gen-manpages

+ +	$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@ $(subst urfave_cli_no_docs,,${GO_TAGS})  ./cmd/gen-manpages

+  

+  bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220

+  	@echo "$(WHALE) $@"

+ -- 

+ 2.44.0

+ 

@@ -1,157 +0,0 @@ 

- From beb23ffb0624b40b2ee1bc56730e54943bd3020f Mon Sep 17 00:00:00 2001

- From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>

- Date: Thu, 1 Oct 2020 07:19:45 +0200

- Subject: [PATCH] Revert commit for Windows metrics

- MIME-Version: 1.0

- Content-Type: text/plain; charset=UTF-8

- Content-Transfer-Encoding: 8bit

- 

- Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>

- ---

-  cmd/ctr/commands/tasks/metrics.go | 113 ------------------------------

-  1 file changed, 113 deletions(-)

- 

- diff --git a/cmd/ctr/commands/tasks/metrics.go b/cmd/ctr/commands/tasks/metrics.go

- index a83e45ef..f8371401 100644

- --- a/cmd/ctr/commands/tasks/metrics.go

- +++ b/cmd/ctr/commands/tasks/metrics.go

- @@ -23,9 +23,6 @@ import (

-  	"os"

-  	"text/tabwriter"

-  

- -	wstats "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats"

- -	v1 "github.com/containerd/cgroups/stats/v1"

- -	v2 "github.com/containerd/cgroups/v2/stats"

-  	"github.com/containerd/containerd/cmd/ctr/commands"

-  	"github.com/containerd/typeurl"

-  	"github.com/urfave/cli"

- @@ -77,42 +74,12 @@ var metricsCommand = cli.Command{

-  		if err != nil {

-  			return err

-  		}

- -		var (

- -			data         *v1.Metrics

- -			data2        *v2.Metrics

- -			windowsStats *wstats.Statistics

- -		)

- -		switch v := anydata.(type) {

- -		case *v1.Metrics:

- -			data = v

- -		case *v2.Metrics:

- -			data2 = v

- -		case *wstats.Statistics:

- -			windowsStats = v

- -		default:

- -			return errors.New("cannot convert metric data to cgroups.Metrics or windows.Statistics")

- -		}

-  

-  		switch context.String(formatFlag) {

-  		case formatTable:

-  			w := tabwriter.NewWriter(os.Stdout, 1, 8, 4, ' ', 0)

-  			fmt.Fprintf(w, "ID\tTIMESTAMP\t\n")

-  			fmt.Fprintf(w, "%s\t%s\t\n\n", metric.ID, metric.Timestamp)

- -			if data != nil {

- -				printCgroupMetricsTable(w, data)

- -			} else if data2 != nil {

- -				printCgroup2MetricsTable(w, data2)

- -			} else {

- -				if windowsStats.GetLinux() != nil {

- -					printCgroupMetricsTable(w, windowsStats.GetLinux())

- -				} else if windowsStats.GetWindows() != nil {

- -					printWindowsContainerStatistics(w, windowsStats.GetWindows())

- -				}

- -				// Print VM stats if its isolated

- -				if windowsStats.VM != nil {

- -					printWindowsVMStatistics(w, windowsStats.VM)

- -				}

- -			}

-  			return w.Flush()

-  		case formatJSON:

-  			marshaledJSON, err := json.MarshalIndent(anydata, "", "  ")

- @@ -126,83 +93,3 @@ var metricsCommand = cli.Command{

-  		}

-  	},

-  }

- -

- -func printCgroupMetricsTable(w *tabwriter.Writer, data *v1.Metrics) {

- -	fmt.Fprintf(w, "METRIC\tVALUE\t\n")

- -	if data.Memory != nil {

- -		fmt.Fprintf(w, "memory.usage_in_bytes\t%d\t\n", data.Memory.Usage.Usage)

- -		fmt.Fprintf(w, "memory.limit_in_bytes\t%d\t\n", data.Memory.Usage.Limit)

- -		fmt.Fprintf(w, "memory.stat.cache\t%d\t\n", data.Memory.TotalCache)

- -	}

- -	if data.CPU != nil {

- -		fmt.Fprintf(w, "cpuacct.usage\t%d\t\n", data.CPU.Usage.Total)

- -		fmt.Fprintf(w, "cpuacct.usage_percpu\t%v\t\n", data.CPU.Usage.PerCPU)

- -	}

- -	if data.Pids != nil {

- -		fmt.Fprintf(w, "pids.current\t%v\t\n", data.Pids.Current)

- -		fmt.Fprintf(w, "pids.limit\t%v\t\n", data.Pids.Limit)

- -	}

- -}

- -

- -func printCgroup2MetricsTable(w *tabwriter.Writer, data *v2.Metrics) {

- -	fmt.Fprintf(w, "METRIC\tVALUE\t\n")

- -	if data.Pids != nil {

- -		fmt.Fprintf(w, "pids.current\t%v\t\n", data.Pids.Current)

- -		fmt.Fprintf(w, "pids.limit\t%v\t\n", data.Pids.Limit)

- -	}

- -	if data.CPU != nil {

- -		fmt.Fprintf(w, "cpu.usage_usec\t%v\t\n", data.CPU.UsageUsec)

- -		fmt.Fprintf(w, "cpu.user_usec\t%v\t\n", data.CPU.UserUsec)

- -		fmt.Fprintf(w, "cpu.system_usec\t%v\t\n", data.CPU.SystemUsec)

- -		fmt.Fprintf(w, "cpu.nr_periods\t%v\t\n", data.CPU.NrPeriods)

- -		fmt.Fprintf(w, "cpu.nr_throttled\t%v\t\n", data.CPU.NrThrottled)

- -		fmt.Fprintf(w, "cpu.throttled_usec\t%v\t\n", data.CPU.ThrottledUsec)

- -	}

- -	if data.Memory != nil {

- -		fmt.Fprintf(w, "memory.usage\t%v\t\n", data.Memory.Usage)

- -		fmt.Fprintf(w, "memory.usage_limit\t%v\t\n", data.Memory.UsageLimit)

- -		fmt.Fprintf(w, "memory.swap_usage\t%v\t\n", data.Memory.SwapUsage)

- -		fmt.Fprintf(w, "memory.swap_limit\t%v\t\n", data.Memory.SwapLimit)

- -	}

- -}

- -

- -func printWindowsContainerStatistics(w *tabwriter.Writer, stats *wstats.WindowsContainerStatistics) {

- -	fmt.Fprintf(w, "METRIC\tVALUE\t\n")

- -	fmt.Fprintf(w, "timestamp\t%s\t\n", stats.Timestamp)

- -	fmt.Fprintf(w, "start_time\t%s\t\n", stats.ContainerStartTime)

- -	fmt.Fprintf(w, "uptime_ns\t%d\t\n", stats.UptimeNS)

- -	if stats.Processor != nil {

- -		fmt.Fprintf(w, "cpu.total_runtime_ns\t%d\t\n", stats.Processor.TotalRuntimeNS)

- -		fmt.Fprintf(w, "cpu.runtime_user_ns\t%d\t\n", stats.Processor.RuntimeUserNS)

- -		fmt.Fprintf(w, "cpu.runtime_kernel_ns\t%d\t\n", stats.Processor.RuntimeKernelNS)

- -	}

- -	if stats.Memory != nil {

- -		fmt.Fprintf(w, "memory.commit_bytes\t%d\t\n", stats.Memory.MemoryUsageCommitBytes)

- -		fmt.Fprintf(w, "memory.commit_peak_bytes\t%d\t\n", stats.Memory.MemoryUsageCommitPeakBytes)

- -		fmt.Fprintf(w, "memory.private_working_set_bytes\t%d\t\n", stats.Memory.MemoryUsagePrivateWorkingSetBytes)

- -	}

- -	if stats.Storage != nil {

- -		fmt.Fprintf(w, "storage.read_count_normalized\t%d\t\n", stats.Storage.ReadCountNormalized)

- -		fmt.Fprintf(w, "storage.read_size_bytes\t%d\t\n", stats.Storage.ReadSizeBytes)

- -		fmt.Fprintf(w, "storage.write_count_normalized\t%d\t\n", stats.Storage.WriteCountNormalized)

- -		fmt.Fprintf(w, "storage.write_size_bytes\t%d\t\n", stats.Storage.WriteSizeBytes)

- -	}

- -}

- -

- -func printWindowsVMStatistics(w *tabwriter.Writer, stats *wstats.VirtualMachineStatistics) {

- -	fmt.Fprintf(w, "METRIC\tVALUE\t\n")

- -	if stats.Processor != nil {

- -		fmt.Fprintf(w, "vm.cpu.total_runtime_ns\t%d\t\n", stats.Processor.TotalRuntimeNS)

- -	}

- -	if stats.Memory != nil {

- -		fmt.Fprintf(w, "vm.memory.working_set_bytes\t%d\t\n", stats.Memory.WorkingSetBytes)

- -		fmt.Fprintf(w, "vm.memory.virtual_node_count\t%d\t\n", stats.Memory.VirtualNodeCount)

- -		fmt.Fprintf(w, "vm.memory.available\t%d\t\n", stats.Memory.VmMemory.AvailableMemory)

- -		fmt.Fprintf(w, "vm.memory.available_buffer\t%d\t\n", stats.Memory.VmMemory.AvailableMemoryBuffer)

- -		fmt.Fprintf(w, "vm.memory.reserved\t%d\t\n", stats.Memory.VmMemory.ReservedMemory)

- -		fmt.Fprintf(w, "vm.memory.assigned\t%d\t\n", stats.Memory.VmMemory.AssignedMemory)

- -		fmt.Fprintf(w, "vm.memory.slp_active\t%t\t\n", stats.Memory.VmMemory.SlpActive)

- -		fmt.Fprintf(w, "vm.memory.balancing_enabled\t%t\t\n", stats.Memory.VmMemory.BalancingEnabled)

- -		fmt.Fprintf(w, "vm.memory.dm_operation_in_progress\t%t\t\n", stats.Memory.VmMemory.DmOperationInProgress)

- -	}

- -}

- -- 

- 2.28.0

- 

@@ -1,1467 +0,0 @@ 

- From 92d2d9b8ed28b3918ad902219245b6c737e9dee4 Mon Sep 17 00:00:00 2001

- From: Davanum Srinivas <davanum@gmail.com>

- Date: Fri, 25 Aug 2023 11:11:35 -0400

- Subject: [PATCH] [PATCH] Use typeurl.Any instead of

-  github.com/gogo/protobuf/types.Any

- 

- This commit upgrades github.com/containerd/typeurl to use typeurl.Any.

- The interface hides gogo/protobuf/types.Any from containerd's Go client.

- 

- Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>

- Signed-off-by: Davanum Srinivas <davanum@gmail.com>

- ---

-  cmd/containerd-shim/main_unix.go          |  4 +-

-  cmd/ctr/commands/containers/containers.go |  2 +-

-  container.go                              | 10 +--

-  container_checkpoint_opts.go              |  8 +--

-  container_opts.go                         | 10 +--

-  containers/containers.go                  |  8 +--

-  containerstore.go                         | 19 ++++--

-  events.go                                 |  5 +-

-  events/events.go                          |  3 +-

-  events/exchange/exchange.go               |  8 +--

-  go.mod                                    |  2 +-

-  go.sum                                    |  3 +-

-  integration/client/container_test.go      |  8 +--

-  integration/client/go.mod                 |  2 +-

-  integration/client/go.sum                 |  3 +-

-  metadata/boltutil/helpers.go              | 21 +++---

-  metadata/containers.go                    |  3 +-

-  metadata/containers_test.go               | 83 ++++++++++++++---------

-  metrics/cgroups/metrics_test.go           |  6 +-

-  pkg/cri/server/events.go                  |  3 +-

-  pkg/cri/server/helpers.go                 |  5 +-

-  pkg/cri/server/helpers_test.go            | 13 ++++

-  pkg/cri/server/restart.go                 |  4 +-

-  protobuf/any.go                           | 47 +++++++++++++

-  protobuf/any_test.go                      | 26 +++++++

-  runtime/runtime.go                        |  8 +--

-  runtime/v1/linux/runtime.go               |  9 +--

-  runtime/v1/linux/task.go                  |  4 +-

-  runtime/v1/shim/service.go                |  3 +-

-  runtime/v2/manager.go                     |  7 +-

-  runtime/v2/runc/container.go              |  6 +-

-  runtime/v2/runc/task/service.go           |  5 +-

-  runtime/v2/runc/v1/service.go             |  5 +-

-  runtime/v2/shim.go                        |  5 +-

-  runtime/v2/shim/publisher.go              |  4 +-

-  services/containers/helpers.go            | 20 ++++--

-  services/events/service.go                |  3 +-

-  services/tasks/local.go                   |  5 +-

-  task.go                                   |  7 +-

-  39 files changed, 270 insertions(+), 127 deletions(-)

-  create mode 100644 protobuf/any.go

-  create mode 100644 protobuf/any_test.go

- 

- diff --git a/cmd/containerd-shim/main_unix.go b/cmd/containerd-shim/main_unix.go

- index 024611bf3bdf..ef32ae38bb51 100644

- --- a/cmd/containerd-shim/main_unix.go

- +++ b/cmd/containerd-shim/main_unix.go

- @@ -38,12 +38,12 @@ import (

-  	"github.com/containerd/containerd/events"

-  	"github.com/containerd/containerd/namespaces"

-  	"github.com/containerd/containerd/pkg/process"

- +	"github.com/containerd/containerd/protobuf"

-  	shimlog "github.com/containerd/containerd/runtime/v1"

-  	"github.com/containerd/containerd/runtime/v1/shim"

-  	shimapi "github.com/containerd/containerd/runtime/v1/shim/v1"

-  	"github.com/containerd/containerd/sys/reaper"

-  	"github.com/containerd/ttrpc"

- -	"github.com/containerd/typeurl"

-  	ptypes "github.com/gogo/protobuf/types"

-  	"github.com/sirupsen/logrus"

-  	exec "golang.org/x/sys/execabs"

- @@ -286,7 +286,7 @@ type remoteEventsPublisher struct {

-  

-  func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error {

-  	ns, _ := namespaces.Namespace(ctx)

- -	encoded, err := typeurl.MarshalAny(event)

- +	encoded, err := protobuf.MarshalAnyToProto(event)

-  	if err != nil {

-  		return err

-  	}

- diff --git a/cmd/ctr/commands/containers/containers.go b/cmd/ctr/commands/containers/containers.go

- index d1025344e0a0..3f2d55d6c10c 100644

- --- a/cmd/ctr/commands/containers/containers.go

- +++ b/cmd/ctr/commands/containers/containers.go

- @@ -280,7 +280,7 @@ var infoCommand = cli.Command{

-  			return nil

-  		}

-  

- -		if info.Spec != nil && info.Spec.Value != nil {

- +		if info.Spec != nil && info.Spec.GetValue() != nil {

-  			v, err := typeurl.UnmarshalAny(info.Spec)

-  			if err != nil {

-  				return err

- diff --git a/container.go b/container.go

- index 2cf15666f132..8511d863dc1c 100644

- --- a/container.go

- +++ b/container.go

- @@ -32,10 +32,10 @@ import (

-  	"github.com/containerd/containerd/errdefs"

-  	"github.com/containerd/containerd/images"

-  	"github.com/containerd/containerd/oci"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime/v2/runc/options"

-  	"github.com/containerd/fifo"

-  	"github.com/containerd/typeurl"

- -	prototypes "github.com/gogo/protobuf/types"

-  	ver "github.com/opencontainers/image-spec/specs-go"

-  	ocispec "github.com/opencontainers/image-spec/specs-go/v1"

-  	"github.com/opencontainers/selinux/go-selinux/label"

- @@ -74,7 +74,7 @@ type Container interface {

-  	// SetLabels sets the provided labels for the container and returns the final label set

-  	SetLabels(context.Context, map[string]string) (map[string]string, error)

-  	// Extensions returns the extensions set on the container

- -	Extensions(context.Context) (map[string]prototypes.Any, error)

- +	Extensions(context.Context) (map[string]typeurl.Any, error)

-  	// Update a container

-  	Update(context.Context, ...UpdateContainerOpts) error

-  	// Checkpoint creates a checkpoint image of the current container

- @@ -120,7 +120,7 @@ func (c *container) Info(ctx context.Context, opts ...InfoOpts) (containers.Cont

-  	return c.metadata, nil

-  }

-  

- -func (c *container) Extensions(ctx context.Context) (map[string]prototypes.Any, error) {

- +func (c *container) Extensions(ctx context.Context) (map[string]typeurl.Any, error) {

-  	r, err := c.get(ctx)

-  	if err != nil {

-  		return nil, err

- @@ -163,7 +163,7 @@ func (c *container) Spec(ctx context.Context) (*oci.Spec, error) {

-  		return nil, err

-  	}

-  	var s oci.Spec

- -	if err := json.Unmarshal(r.Spec.Value, &s); err != nil {

- +	if err := json.Unmarshal(r.Spec.GetValue(), &s); err != nil {

-  		return nil, err

-  	}

-  	return &s, nil

- @@ -285,7 +285,7 @@ func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...N

-  		if err != nil {

-  			return nil, err

-  		}

- -		request.Options = any

- +		request.Options = protobuf.FromAny(any)

-  	}

-  	t := &task{

-  		client: c.client,

- diff --git a/container_checkpoint_opts.go b/container_checkpoint_opts.go

- index a64ef618ba62..ee2fa1b977eb 100644

- --- a/container_checkpoint_opts.go

- +++ b/container_checkpoint_opts.go

- @@ -28,9 +28,9 @@ import (

-  	"github.com/containerd/containerd/diff"

-  	"github.com/containerd/containerd/images"

-  	"github.com/containerd/containerd/platforms"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/rootfs"

-  	"github.com/containerd/containerd/runtime/v2/runc/options"

- -	"github.com/containerd/typeurl"

-  	imagespec "github.com/opencontainers/image-spec/specs-go/v1"

-  )

-  

- @@ -56,7 +56,7 @@ func WithCheckpointImage(ctx context.Context, client *Client, c *containers.Cont

-  

-  // WithCheckpointTask includes the running task

-  func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error {

- -	any, err := typeurl.MarshalAny(copts)

- +	any, err := protobuf.MarshalAnyToProto(copts)

-  	if err != nil {

-  		return nil

-  	}

- @@ -97,8 +97,8 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta

-  

-  // WithCheckpointRuntime includes the container runtime info

-  func WithCheckpointRuntime(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error {

- -	if c.Runtime.Options != nil {

- -		data, err := c.Runtime.Options.Marshal()

- +	if c.Runtime.Options != nil && c.Runtime.Options.GetValue() != nil {

- +		data, err := protobuf.FromAny(c.Runtime.Options).Marshal()

-  		if err != nil {

-  			return err

-  		}

- diff --git a/container_opts.go b/container_opts.go

- index 4d630ea6c9d2..f005fe1c7730 100644

- --- a/container_opts.go

- +++ b/container_opts.go

- @@ -27,9 +27,9 @@ import (

-  	"github.com/containerd/containerd/errdefs"

-  	"github.com/containerd/containerd/images"

-  	"github.com/containerd/containerd/oci"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/snapshots"

-  	"github.com/containerd/typeurl"

- -	"github.com/gogo/protobuf/types"

-  	"github.com/opencontainers/image-spec/identity"

-  	v1 "github.com/opencontainers/image-spec/specs-go/v1"

-  )

- @@ -57,7 +57,7 @@ type InfoConfig struct {

-  func WithRuntime(name string, options interface{}) NewContainerOpts {

-  	return func(ctx context.Context, client *Client, c *containers.Container) error {

-  		var (

- -			any *types.Any

- +			any typeurl.Any

-  			err error

-  		)

-  		if options != nil {

- @@ -288,9 +288,9 @@ func WithContainerExtension(name string, extension interface{}) NewContainerOpts

-  		}

-  

-  		if c.Extensions == nil {

- -			c.Extensions = make(map[string]types.Any)

- +			c.Extensions = make(map[string]typeurl.Any)

-  		}

- -		c.Extensions[name] = *any

- +		c.Extensions[name] = any

-  		return nil

-  	}

-  }

- @@ -315,7 +315,7 @@ func WithSpec(s *oci.Spec, opts ...oci.SpecOpts) NewContainerOpts {

-  		}

-  

-  		var err error

- -		c.Spec, err = typeurl.MarshalAny(s)

- +		c.Spec, err = protobuf.MarshalAnyToProto(s)

-  		return err

-  	}

-  }

- diff --git a/containers/containers.go b/containers/containers.go

- index 7174bbd6aa6f..275f8069ea12 100644

- --- a/containers/containers.go

- +++ b/containers/containers.go

- @@ -20,7 +20,7 @@ import (

-  	"context"

-  	"time"

-  

- -	"github.com/gogo/protobuf/types"

- +	"github.com/containerd/typeurl"

-  )

-  

-  // Container represents the set of data pinned by a container. Unless otherwise

- @@ -53,7 +53,7 @@ type Container struct {

-  	// container.

-  	//

-  	// This field is required but mutable.

- -	Spec *types.Any

- +	Spec typeurl.Any

-  

-  	// SnapshotKey specifies the snapshot key to use for the container's root

-  	// filesystem. When starting a task from this container, a caller should

- @@ -75,13 +75,13 @@ type Container struct {

-  	UpdatedAt time.Time

-  

-  	// Extensions stores client-specified metadata

- -	Extensions map[string]types.Any

- +	Extensions map[string]typeurl.Any

-  }

-  

-  // RuntimeInfo holds runtime specific information

-  type RuntimeInfo struct {

-  	Name    string

- -	Options *types.Any

- +	Options typeurl.Any

-  }

-  

-  // Store interacts with the underlying container storage

- diff --git a/containerstore.go b/containerstore.go

- index bdd1c6066a79..2a154e26590d 100644

- --- a/containerstore.go

- +++ b/containerstore.go

- @@ -24,6 +24,8 @@ import (

-  	containersapi "github.com/containerd/containerd/api/services/containers/v1"

-  	"github.com/containerd/containerd/containers"

-  	"github.com/containerd/containerd/errdefs"

- +	"github.com/containerd/containerd/protobuf"

- +	"github.com/containerd/typeurl"

-  	ptypes "github.com/gogo/protobuf/types"

-  	"google.golang.org/grpc/codes"

-  	"google.golang.org/grpc/status"

- @@ -148,18 +150,22 @@ func (r *remoteContainers) Delete(ctx context.Context, id string) error {

-  }

-  

-  func containerToProto(container *containers.Container) containersapi.Container {

- +	extensions := make(map[string]ptypes.Any)

- +	for k, v := range container.Extensions {

- +		extensions[k] = *protobuf.FromAny(v)

- +	}

-  	return containersapi.Container{

-  		ID:     container.ID,

-  		Labels: container.Labels,

-  		Image:  container.Image,

-  		Runtime: &containersapi.Container_Runtime{

-  			Name:    container.Runtime.Name,

- -			Options: container.Runtime.Options,

- +			Options: protobuf.FromAny(container.Runtime.Options),

-  		},

- -		Spec:        container.Spec,

- +		Spec:        protobuf.FromAny(container.Spec),

-  		Snapshotter: container.Snapshotter,

-  		SnapshotKey: container.SnapshotKey,

- -		Extensions:  container.Extensions,

- +		Extensions:  extensions,

-  	}

-  }

-  

- @@ -171,6 +177,11 @@ func containerFromProto(containerpb *containersapi.Container) containers.Contain

-  			Options: containerpb.Runtime.Options,

-  		}

-  	}

- +	extensions := make(map[string]typeurl.Any)

- +	for k, v := range containerpb.Extensions {

- +		v := v

- +		extensions[k] = &v

- +	}

-  	return containers.Container{

-  		ID:          containerpb.ID,

-  		Labels:      containerpb.Labels,

- @@ -181,7 +192,7 @@ func containerFromProto(containerpb *containersapi.Container) containers.Contain

-  		SnapshotKey: containerpb.SnapshotKey,

-  		CreatedAt:   containerpb.CreatedAt,

-  		UpdatedAt:   containerpb.UpdatedAt,

- -		Extensions:  containerpb.Extensions,

- +		Extensions:  extensions,

-  	}

-  }

-  

- diff --git a/events.go b/events.go

- index 3577b7c3a9fc..d6499ad3b3a8 100644

- --- a/events.go

- +++ b/events.go

- @@ -22,6 +22,7 @@ import (

-  	eventsapi "github.com/containerd/containerd/api/services/events/v1"

-  	"github.com/containerd/containerd/errdefs"

-  	"github.com/containerd/containerd/events"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/typeurl"

-  )

-  

- @@ -51,7 +52,7 @@ func (e *eventRemote) Publish(ctx context.Context, topic string, event events.Ev

-  	}

-  	req := &eventsapi.PublishRequest{

-  		Topic: topic,

- -		Event: any,

- +		Event: protobuf.FromAny(any),

-  	}

-  	if _, err := e.client.Publish(ctx, req); err != nil {

-  		return errdefs.FromGRPC(err)

- @@ -65,7 +66,7 @@ func (e *eventRemote) Forward(ctx context.Context, envelope *events.Envelope) er

-  			Timestamp: envelope.Timestamp,

-  			Namespace: envelope.Namespace,

-  			Topic:     envelope.Topic,

- -			Event:     envelope.Event,

- +			Event:     protobuf.FromAny(envelope.Event),

-  		},

-  	}

-  	if _, err := e.client.Forward(ctx, req); err != nil {

- diff --git a/events/events.go b/events/events.go

- index b7eb86f1eb65..8af0ec03a483 100644

- --- a/events/events.go

- +++ b/events/events.go

- @@ -21,7 +21,6 @@ import (

-  	"time"

-  

-  	"github.com/containerd/typeurl"

- -	"github.com/gogo/protobuf/types"

-  )

-  

-  // Envelope provides the packaging for an event.

- @@ -29,7 +28,7 @@ type Envelope struct {

-  	Timestamp time.Time

-  	Namespace string

-  	Topic     string

- -	Event     *types.Any

- +	Event     typeurl.Any

-  }

-  

-  // Field returns the value for the given fieldpath as a string, if defined.

- diff --git a/events/exchange/exchange.go b/events/exchange/exchange.go

- index a1f385d7abd3..7f085dc91774 100644

- --- a/events/exchange/exchange.go

- +++ b/events/exchange/exchange.go

- @@ -30,7 +30,6 @@ import (

-  	"github.com/containerd/containerd/namespaces"

-  	"github.com/containerd/typeurl"

-  	goevents "github.com/docker/go-events"

- -	"github.com/gogo/protobuf/types"

-  	"github.com/sirupsen/logrus"

-  )

-  

- @@ -63,7 +62,7 @@ func (e *Exchange) Forward(ctx context.Context, envelope *events.Envelope) (err

-  		logger := log.G(ctx).WithFields(logrus.Fields{

-  			"topic": envelope.Topic,

-  			"ns":    envelope.Namespace,

- -			"type":  envelope.Event.TypeUrl,

- +			"type":  envelope.Event.GetTypeUrl(),

-  		})

-  

-  		if err != nil {

- @@ -82,7 +81,6 @@ func (e *Exchange) Forward(ctx context.Context, envelope *events.Envelope) (err

-  func (e *Exchange) Publish(ctx context.Context, topic string, event events.Event) (err error) {

-  	var (

-  		namespace string

- -		encoded   *types.Any

-  		envelope  events.Envelope

-  	)

-  

- @@ -94,7 +92,7 @@ func (e *Exchange) Publish(ctx context.Context, topic string, event events.Event

-  		return fmt.Errorf("envelope topic %q: %w", topic, err)

-  	}

-  

- -	encoded, err = typeurl.MarshalAny(event)

- +	encoded, err := typeurl.MarshalAny(event)

-  	if err != nil {

-  		return err

-  	}

- @@ -108,7 +106,7 @@ func (e *Exchange) Publish(ctx context.Context, topic string, event events.Event

-  		logger := log.G(ctx).WithFields(logrus.Fields{

-  			"topic": envelope.Topic,

-  			"ns":    envelope.Namespace,

- -			"type":  envelope.Event.TypeUrl,

- +			"type":  envelope.Event.GetTypeUrl(),

-  		})

-  

-  		if err != nil {

- diff --git a/go.mod b/go.mod

- index 26b0ae08bcc9..fc5ebe10e783 100644

- --- a/go.mod

- +++ b/go.mod

- @@ -17,7 +17,7 @@ require (

-  	github.com/containerd/imgcrypt v1.1.4

-  	github.com/containerd/nri v0.1.0

-  	github.com/containerd/ttrpc v1.1.2

- -	github.com/containerd/typeurl v1.0.2

- +	github.com/containerd/typeurl v1.0.3-0.20220324183432-6193a0e03259

-  	github.com/containerd/zfs v1.1.0

-  	github.com/containernetworking/cni v1.1.1

-  	github.com/containernetworking/plugins v1.1.1

- diff --git a/go.sum b/go.sum

- index 7f42e83a3b68..0bf0cb6c63e1 100644

- --- a/go.sum

- +++ b/go.sum

- @@ -260,8 +260,9 @@ github.com/containerd/ttrpc v1.1.2/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Ev

-  github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=

-  github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk=

-  github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=

- -github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY=

-  github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s=

- +github.com/containerd/typeurl v1.0.3-0.20220324183432-6193a0e03259 h1:bJv9qgjarrsdd4XIIczeRdYXON88Fgn3GdXVfnQjcSo=

- +github.com/containerd/typeurl v1.0.3-0.20220324183432-6193a0e03259/go.mod h1:HDkcKOXRnX6yKnXv3P0QrogFi0DoiauK/LpQi961f0A=

-  github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw=

-  github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y=

-  github.com/containerd/zfs v0.0.0-20210315114300-dde8f0fda960/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY=

- diff --git a/integration/client/container_test.go b/integration/client/container_test.go

- index 53cffb6874d1..cdf3c1fd0296 100644

- --- a/integration/client/container_test.go

- +++ b/integration/client/container_test.go

- @@ -1570,11 +1570,11 @@ func TestContainerExtensions(t *testing.T) {

-  		if len(cExts) != 1 {

-  			t.Errorf("expected 1 container extension")

-  		}

- -		if cExts["hello"].TypeUrl != ext.TypeUrl {

- -			t.Errorf("got unexpected type url for extension: %s", cExts["hello"].TypeUrl)

- +		if actual := cExts["hello"].GetTypeUrl(); actual != ext.TypeUrl {

- +			t.Errorf("got unexpected type url for extension: %s", actual)

-  		}

- -		if !bytes.Equal(cExts["hello"].Value, ext.Value) {

- -			t.Errorf("expected extension value %q, got: %q", ext.Value, cExts["hello"].Value)

- +		if actual := cExts["hello"].GetValue(); !bytes.Equal(actual, ext.Value) {

- +			t.Errorf("expected extension value %q, got: %q", ext.Value, actual)

-  		}

-  	}

-  

- diff --git a/integration/client/go.mod b/integration/client/go.mod

- index f5defa51018c..fcbbdee846ee 100644

- --- a/integration/client/go.mod

- +++ b/integration/client/go.mod

- @@ -11,7 +11,7 @@ require (

-  	github.com/containerd/continuity v0.3.0

-  	github.com/containerd/go-runc v1.0.0

-  	github.com/containerd/ttrpc v1.1.2

- -	github.com/containerd/typeurl v1.0.2

- +	github.com/containerd/typeurl v1.0.3-0.20220324183432-6193a0e03259

-  	github.com/gogo/protobuf v1.3.2

-  	github.com/opencontainers/go-digest v1.0.0

-  	github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b

- diff --git a/integration/client/go.sum b/integration/client/go.sum

- index 5e37298cff45..8c3099b3f5f6 100644

- --- a/integration/client/go.sum

- +++ b/integration/client/go.sum

- @@ -148,8 +148,9 @@ github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Ev

-  github.com/containerd/ttrpc v1.1.2 h1:4jH6OQDQqjfVD2b5TJS5TxmGuLGmp5WW7KtW2TWOP7c=

-  github.com/containerd/ttrpc v1.1.2/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ=

-  github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg=

- -github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY=

-  github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s=

- +github.com/containerd/typeurl v1.0.3-0.20220324183432-6193a0e03259 h1:bJv9qgjarrsdd4XIIczeRdYXON88Fgn3GdXVfnQjcSo=

- +github.com/containerd/typeurl v1.0.3-0.20220324183432-6193a0e03259/go.mod h1:HDkcKOXRnX6yKnXv3P0QrogFi0DoiauK/LpQi961f0A=

-  github.com/containerd/zfs v1.1.0/go.mod h1:oZF9wBnrnQjpWLaPKEinrx3TQ9a+W/RJO7Zb41d8YLE=

-  github.com/containernetworking/cni v1.0.1/go.mod h1:AKuhXbN5EzmD4yTNtfSsX3tPcmtrBI6QcRV0NiNt15Y=

-  github.com/containernetworking/cni v1.1.1/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=

- diff --git a/metadata/boltutil/helpers.go b/metadata/boltutil/helpers.go

- index 4201d7ba9ee1..2b2b0ad1e523 100644

- --- a/metadata/boltutil/helpers.go

- +++ b/metadata/boltutil/helpers.go

- @@ -20,6 +20,8 @@ import (

-  	"fmt"

-  	"time"

-  

- +	"github.com/containerd/containerd/protobuf"

- +	"github.com/containerd/typeurl"

-  	"github.com/gogo/protobuf/proto"

-  	"github.com/gogo/protobuf/types"

-  	bolt "go.etcd.io/bbolt"

- @@ -151,7 +153,7 @@ func WriteTimestamps(bkt *bolt.Bucket, created, updated time.Time) error {

-  

-  // WriteExtensions will write a KV map to the given bucket,

-  // where `K` is a string key and `V` is a protobuf's Any type that represents a generic extension.

- -func WriteExtensions(bkt *bolt.Bucket, extensions map[string]types.Any) error {

- +func WriteExtensions(bkt *bolt.Bucket, extensions map[string]typeurl.Any) error {

-  	if len(extensions) == 0 {

-  		return nil

-  	}

- @@ -162,8 +164,8 @@ func WriteExtensions(bkt *bolt.Bucket, extensions map[string]types.Any) error {

-  	}

-  

-  	for name, ext := range extensions {

- -		ext := ext

- -		p, err := proto.Marshal(&ext)

- +		ext := protobuf.FromAny(ext)

- +		p, err := proto.Marshal(ext)

-  		if err != nil {

-  			return err

-  		}

- @@ -177,9 +179,9 @@ func WriteExtensions(bkt *bolt.Bucket, extensions map[string]types.Any) error {

-  }

-  

-  // ReadExtensions will read back a map of extensions from the given bucket, previously written by WriteExtensions

- -func ReadExtensions(bkt *bolt.Bucket) (map[string]types.Any, error) {

- +func ReadExtensions(bkt *bolt.Bucket) (map[string]typeurl.Any, error) {

-  	var (

- -		extensions = make(map[string]types.Any)

- +		extensions = make(map[string]typeurl.Any)

-  		ebkt       = bkt.Bucket(bucketKeyExtensions)

-  	)

-  

- @@ -193,7 +195,7 @@ func ReadExtensions(bkt *bolt.Bucket) (map[string]types.Any, error) {

-  			return err

-  		}

-  

- -		extensions[string(k)] = t

- +		extensions[string(k)] = &t

-  		return nil

-  	}); err != nil {

-  		return nil, err

- @@ -203,12 +205,13 @@ func ReadExtensions(bkt *bolt.Bucket) (map[string]types.Any, error) {

-  }

-  

-  // WriteAny write a protobuf's Any type to the bucket

- -func WriteAny(bkt *bolt.Bucket, name []byte, any *types.Any) error {

- -	if any == nil {

- +func WriteAny(bkt *bolt.Bucket, name []byte, any typeurl.Any) error {

- +	pbany := protobuf.FromAny(any)

- +	if pbany == nil {

-  		return nil

-  	}

-  

- -	data, err := proto.Marshal(any)

- +	data, err := proto.Marshal(pbany)

-  	if err != nil {

-  		return err

-  	}

- diff --git a/metadata/containers.go b/metadata/containers.go

- index 97002e5886e1..b27dc0f87208 100644

- --- a/metadata/containers.go

- +++ b/metadata/containers.go

- @@ -30,6 +30,7 @@ import (

-  	"github.com/containerd/containerd/labels"

-  	"github.com/containerd/containerd/metadata/boltutil"

-  	"github.com/containerd/containerd/namespaces"

- +	"github.com/containerd/typeurl"

-  	"github.com/gogo/protobuf/proto"

-  	"github.com/gogo/protobuf/types"

-  	bolt "go.etcd.io/bbolt"

- @@ -211,7 +212,7 @@ func (s *containerStore) Update(ctx context.Context, container containers.Contai

-  

-  			if strings.HasPrefix(path, "extensions.") {

-  				if updated.Extensions == nil {

- -					updated.Extensions = map[string]types.Any{}

- +					updated.Extensions = map[string]typeurl.Any{}

-  				}

-  				key := strings.TrimPrefix(path, "extensions.")

-  				updated.Extensions[key] = container.Extensions[key]

- diff --git a/metadata/containers_test.go b/metadata/containers_test.go

- index b45d54cf5234..409bd8478763 100644

- --- a/metadata/containers_test.go

- +++ b/metadata/containers_test.go

- @@ -31,10 +31,13 @@ import (

-  	"github.com/containerd/containerd/filters"

-  	"github.com/containerd/containerd/log/logtest"

-  	"github.com/containerd/containerd/namespaces"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/typeurl"

-  	"github.com/gogo/protobuf/types"

- +	"github.com/google/go-cmp/cmp"

-  	specs "github.com/opencontainers/runtime-spec/specs-go"

-  	bolt "go.etcd.io/bbolt"

- +	"gotest.tools/v3/assert"

-  )

-  

-  func init() {

- @@ -48,7 +51,7 @@ func TestContainersList(t *testing.T) {

-  	store := NewContainerStore(NewDB(db, nil, nil))

-  

-  	spec := &specs.Spec{}

- -	encoded, err := typeurl.MarshalAny(spec)

- +	encoded, err := protobuf.MarshalAnyToProto(spec)

-  	if err != nil {

-  		t.Fatal(err)

-  	}

- @@ -180,13 +183,13 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  	store := NewContainerStore(NewDB(db, nil, nil))

-  

-  	spec := &specs.Spec{}

- -	encoded, err := typeurl.MarshalAny(spec)

- +	encoded, err := protobuf.MarshalAnyToProto(spec)

-  	if err != nil {

-  		t.Fatal(err)

-  	}

-  

-  	spec.Annotations = map[string]string{"updated": "true"}

- -	encodedUpdated, err := typeurl.MarshalAny(spec)

- +	encodedUpdated, err := protobuf.MarshalAnyToProto(spec)

-  	if err != nil {

-  		t.Fatal(err)

-  	}

- @@ -468,8 +471,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("hello"),

-  					},

- @@ -480,8 +483,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("world"),

-  					},

- @@ -492,8 +495,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("world"),

-  					},

- @@ -507,8 +510,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("hello"),

-  					},

- @@ -519,8 +522,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("world"),

-  					},

- @@ -532,8 +535,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("hello"),

-  					},

- @@ -547,8 +550,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("hello"),

-  					},

- @@ -558,8 +561,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Labels: map[string]string{

-  					"foo": "one",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("world"),

-  					},

- @@ -571,8 +574,8 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("world"),

-  					},

- @@ -586,21 +589,21 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- +				Extensions: map[string]typeurl.Any{

-  					// leaves hello in place.

- -					"hello": {

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("hello"),

-  					},

-  				},

-  			},

-  			input: containers.Container{

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("universe"), // this will be ignored

-  					},

- -					"bar": {

- +					"bar": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("foo"), // this will be added

-  					},

- @@ -612,12 +615,12 @@ func TestContainersCreateUpdateDelete(t *testing.T) {

-  				Runtime: containers.RuntimeInfo{

-  					Name: "testruntime",

-  				},

- -				Extensions: map[string]types.Any{

- -					"hello": {

- +				Extensions: map[string]typeurl.Any{

- +					"hello": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("hello"), // remains as world

-  					},

- -					"bar": {

- +					"bar": &types.Any{

-  						TypeUrl: "test.update.extensions",

-  						Value:   []byte("foo"), // this will be added

-  					},

- @@ -708,10 +711,26 @@ func checkContainerTimestamps(t *testing.T, c *containers.Container, now time.Ti

-  	}

-  }

-  

- -func checkContainersEqual(t *testing.T, a, b *containers.Container, format string, args ...interface{}) {

- -	if !reflect.DeepEqual(a, b) {

- -		t.Fatalf("containers not equal \n\t%v != \n\t%v: "+format, append([]interface{}{a, b}, args...)...)

- +// isNil returns true if the given parameter is nil or typed nil.

- +func isNil(x interface{}) bool {

- +	if x == nil {

- +		return true

-  	}

- +	v := reflect.ValueOf(x)

- +	return v.Kind() == reflect.Ptr && v.IsNil()

- +}

- +

- +func checkContainersEqual(t *testing.T, a, b *containers.Container, format string, args ...interface{}) {

- +	// Ignore the difference of nil and typed nil.

- +	opt := cmp.FilterValues(

- +		func(x, y interface{}) bool {

- +			return isNil(x) && isNil(y)

- +		},

- +		cmp.Comparer(func(_, _ interface{}) bool {

- +			return true

- +		}),

- +	)

- +	assert.DeepEqual(t, a, b, opt)

-  }

-  

-  func testEnv(t *testing.T) (context.Context, *bolt.DB, func()) {

- diff --git a/metrics/cgroups/metrics_test.go b/metrics/cgroups/metrics_test.go

- index c71ea60a523a..c362ea3b9d65 100644

- --- a/metrics/cgroups/metrics_test.go

- +++ b/metrics/cgroups/metrics_test.go

- @@ -32,7 +32,7 @@ import (

-  	v2 "github.com/containerd/containerd/metrics/cgroups/v2"

-  	v1types "github.com/containerd/containerd/metrics/types/v1"

-  	v2types "github.com/containerd/containerd/metrics/types/v2"

- -	"github.com/containerd/typeurl"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/prometheus/client_golang/prometheus"

-  

-  	metrics "github.com/docker/go-metrics"

- @@ -152,7 +152,7 @@ func (t *mockStatT) Namespace() string {

-  

-  func (t *mockStatT) Stats(context.Context) (*types.Any, error) {

-  	if t.isV1 {

- -		return typeurl.MarshalAny(&v1types.Metrics{})

- +		return protobuf.MarshalAnyToProto(&v1types.Metrics{})

-  	}

- -	return typeurl.MarshalAny(&v2types.Metrics{})

- +	return protobuf.MarshalAnyToProto(&v2types.Metrics{})

-  }

- diff --git a/pkg/cri/server/events.go b/pkg/cri/server/events.go

- index c8ffdadbfd21..fbecb29a049a 100644

- --- a/pkg/cri/server/events.go

- +++ b/pkg/cri/server/events.go

- @@ -32,7 +32,6 @@ import (

-  	sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox"

-  	ctrdutil "github.com/containerd/containerd/pkg/cri/util"

-  	"github.com/containerd/typeurl"

- -	gogotypes "github.com/gogo/protobuf/types"

-  	"github.com/sirupsen/logrus"

-  	"golang.org/x/net/context"

-  	"k8s.io/utils/clock"

- @@ -207,7 +206,7 @@ func (em *eventMonitor) startContainerExitMonitor(ctx context.Context, id string

-  	return stopCh

-  }

-  

- -func convertEvent(e *gogotypes.Any) (string, interface{}, error) {

- +func convertEvent(e typeurl.Any) (string, interface{}, error) {

-  	id := ""

-  	evt, err := typeurl.UnmarshalAny(e)

-  	if err != nil {

- diff --git a/pkg/cri/server/helpers.go b/pkg/cri/server/helpers.go

- index 4ee0ae8ffc12..8937739540a5 100644

- --- a/pkg/cri/server/helpers.go

- +++ b/pkg/cri/server/helpers.go

- @@ -371,10 +371,11 @@ func getRuntimeOptionsType(t string) interface{} {

-  

-  // getRuntimeOptions get runtime options from container metadata.

-  func getRuntimeOptions(c containers.Container) (interface{}, error) {

- -	if c.Runtime.Options == nil {

- +	from := c.Runtime.Options

- +	if from == nil || from.GetValue() == nil {

-  		return nil, nil

-  	}

- -	opts, err := typeurl.UnmarshalAny(c.Runtime.Options)

- +	opts, err := typeurl.UnmarshalAny(from)

-  	if err != nil {

-  		return nil, err

-  	}

- diff --git a/pkg/cri/server/helpers_test.go b/pkg/cri/server/helpers_test.go

- index f73e174dcc47..8fa9af8c1767 100644

- --- a/pkg/cri/server/helpers_test.go

- +++ b/pkg/cri/server/helpers_test.go

- @@ -23,6 +23,7 @@ import (

-  	"testing"

-  	"time"

-  

- +	"github.com/containerd/containerd/containers"

-  	"github.com/containerd/containerd/errdefs"

-  	"github.com/containerd/containerd/oci"

-  	criconfig "github.com/containerd/containerd/pkg/cri/config"

- @@ -32,6 +33,8 @@ import (

-  	"github.com/containerd/containerd/reference/docker"

-  	"github.com/containerd/containerd/runtime/linux/runctypes"

-  	runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"

- +	"github.com/containerd/typeurl"

- +	"github.com/gogo/protobuf/types"

-  

-  	imagedigest "github.com/opencontainers/go-digest"

-  	runtimespec "github.com/opencontainers/runtime-spec/specs-go"

- @@ -599,3 +602,13 @@ func TestValidateTargetContainer(t *testing.T) {

-  	}

-  

-  }

- +

- +func TestGetRuntimeOptions(t *testing.T) {

- +	_, err := getRuntimeOptions(containers.Container{})

- +	require.NoError(t, err)

- +

- +	var pbany *types.Any               // This is nil.

- +	var typeurlAny typeurl.Any = pbany // This is typed nil.

- +	_, err = getRuntimeOptions(containers.Container{Runtime: containers.RuntimeInfo{Options: typeurlAny}})

- +	require.NoError(t, err)

- +}

- diff --git a/pkg/cri/server/restart.go b/pkg/cri/server/restart.go

- index f5f3e5083e2c..f7db3f7b3064 100644

- --- a/pkg/cri/server/restart.go

- +++ b/pkg/cri/server/restart.go

- @@ -166,7 +166,7 @@ func (c *criService) loadContainer(ctx context.Context, cntr containerd.Containe

-  	if !ok {

-  		return container, fmt.Errorf("metadata extension %q not found", containerMetadataExtension)

-  	}

- -	data, err := typeurl.UnmarshalAny(&ext)

- +	data, err := typeurl.UnmarshalAny(ext)

-  	if err != nil {

-  		return container, fmt.Errorf("failed to unmarshal metadata extension %q: %w", ext, err)

-  	}

- @@ -335,7 +335,7 @@ func (c *criService) loadSandbox(ctx context.Context, cntr containerd.Container)

-  	if !ok {

-  		return sandbox, fmt.Errorf("metadata extension %q not found", sandboxMetadataExtension)

-  	}

- -	data, err := typeurl.UnmarshalAny(&ext)

- +	data, err := typeurl.UnmarshalAny(ext)

-  	if err != nil {

-  		return sandbox, fmt.Errorf("failed to unmarshal metadata extension %q: %w", ext, err)

-  	}

- diff --git a/protobuf/any.go b/protobuf/any.go

- new file mode 100644

- index 000000000000..0f667176502e

- --- /dev/null

- +++ b/protobuf/any.go

- @@ -0,0 +1,47 @@

- +/*

- +   Copyright The containerd Authors.

- +

- +   Licensed under the Apache License, Version 2.0 (the "License");

- +   you may not use this file except in compliance with the License.

- +   You may obtain a copy of the License at

- +

- +       http://www.apache.org/licenses/LICENSE-2.0

- +

- +   Unless required by applicable law or agreed to in writing, software

- +   distributed under the License is distributed on an "AS IS" BASIS,

- +   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

- +   See the License for the specific language governing permissions and

- +   limitations under the License.

- +*/

- +

- +package protobuf

- +

- +import (

- +	"github.com/containerd/typeurl"

- +	"github.com/gogo/protobuf/types"

- +)

- +

- +// FromAny converts typeurl.Any to github.com/gogo/protobuf/types.Any.

- +func FromAny(from typeurl.Any) *types.Any {

- +	if from == nil {

- +		return nil

- +	}

- +

- +	if pbany, ok := from.(*types.Any); ok {

- +		return pbany

- +	}

- +

- +	return &types.Any{

- +		TypeUrl: from.GetTypeUrl(),

- +		Value:   from.GetValue(),

- +	}

- +}

- +

- +// FromAny converts an arbitrary interface to github.com/gogo/protobuf/types.Any.

- +func MarshalAnyToProto(from interface{}) (*types.Any, error) {

- +	any, err := typeurl.MarshalAny(from)

- +	if err != nil {

- +		return nil, err

- +	}

- +	return FromAny(any), nil

- +}

- diff --git a/protobuf/any_test.go b/protobuf/any_test.go

- new file mode 100644

- index 000000000000..7a74ec16c28b

- --- /dev/null

- +++ b/protobuf/any_test.go

- @@ -0,0 +1,26 @@

- +/*

- +   Copyright The containerd Authors.

- +

- +   Licensed under the Apache License, Version 2.0 (the "License");

- +   you may not use this file except in compliance with the License.

- +   You may obtain a copy of the License at

- +

- +       http://www.apache.org/licenses/LICENSE-2.0

- +

- +   Unless required by applicable law or agreed to in writing, software

- +   distributed under the License is distributed on an "AS IS" BASIS,

- +   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

- +   See the License for the specific language governing permissions and

- +   limitations under the License.

- +*/

- +

- +package protobuf

- +

- +import "testing"

- +

- +func TestFromAny(t *testing.T) {

- +	actual := FromAny(nil)

- +	if actual != nil {

- +		t.Fatalf("expected nil, got %v", actual)

- +	}

- +}

- diff --git a/runtime/runtime.go b/runtime/runtime.go

- index 84aaa8ac67f5..1ca22ee2bccc 100644

- --- a/runtime/runtime.go

- +++ b/runtime/runtime.go

- @@ -21,7 +21,7 @@ import (

-  	"time"

-  

-  	"github.com/containerd/containerd/mount"

- -	"github.com/gogo/protobuf/types"

- +	"github.com/containerd/typeurl"

-  )

-  

-  // IO holds process IO information

- @@ -35,7 +35,7 @@ type IO struct {

-  // CreateOpts contains task creation data

-  type CreateOpts struct {

-  	// Spec is the OCI runtime spec

- -	Spec *types.Any

- +	Spec typeurl.Any

-  	// Rootfs mounts to perform to gain access to the container's filesystem

-  	Rootfs []mount.Mount

-  	// IO for the container's main process

- @@ -43,9 +43,9 @@ type CreateOpts struct {

-  	// Checkpoint digest to restore container state

-  	Checkpoint string

-  	// RuntimeOptions for the runtime

- -	RuntimeOptions *types.Any

- +	RuntimeOptions typeurl.Any

-  	// TaskOptions received for the task

- -	TaskOptions *types.Any

- +	TaskOptions typeurl.Any

-  	// Runtime name to use (e.g. `io.containerd.NAME.VERSION`).

-  	// As an alternative full abs path to binary may be specified instead.

-  	Runtime string

- diff --git a/runtime/v1/linux/runtime.go b/runtime/v1/linux/runtime.go

- index b6d53820a859..ad7a0b67ec0b 100644

- --- a/runtime/v1/linux/runtime.go

- +++ b/runtime/v1/linux/runtime.go

- @@ -41,6 +41,7 @@ import (

-  	"github.com/containerd/containerd/pkg/process"

-  	"github.com/containerd/containerd/platforms"

-  	"github.com/containerd/containerd/plugin"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime"

-  	"github.com/containerd/containerd/runtime/linux/runctypes"

-  	v1 "github.com/containerd/containerd/runtime/v1"

- @@ -178,7 +179,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts

-  	bundle, err := newBundle(id,

-  		filepath.Join(r.state, namespace),

-  		filepath.Join(r.root, namespace),

- -		opts.Spec.Value)

- +		opts.Spec.GetValue())

-  	if err != nil {

-  		return nil, err

-  	}

- @@ -191,7 +192,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts

-  	shimopt := ShimLocal(r.config, r.events)

-  	if !r.config.NoShim {

-  		var cgroup string

- -		if opts.TaskOptions != nil {

- +		if opts.TaskOptions != nil && opts.TaskOptions.GetValue() != nil {

-  			v, err := typeurl.UnmarshalAny(opts.TaskOptions)

-  			if err != nil {

-  				return nil, err

- @@ -244,7 +245,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts

-  		Stderr:     opts.IO.Stderr,

-  		Terminal:   opts.IO.Terminal,

-  		Checkpoint: opts.Checkpoint,

- -		Options:    opts.TaskOptions,

- +		Options:    protobuf.FromAny(opts.TaskOptions),

-  	}

-  	for _, m := range opts.Rootfs {

-  		sopts.Rootfs = append(sopts.Rootfs, &types.Mount{

- @@ -537,7 +538,7 @@ func (r *Runtime) getRuncOptions(ctx context.Context, id string) (*runctypes.Run

-  		return nil, err

-  	}

-  

- -	if container.Runtime.Options != nil {

- +	if container.Runtime.Options != nil && container.Runtime.Options.GetValue() != nil {

-  		v, err := typeurl.UnmarshalAny(container.Runtime.Options)

-  		if err != nil {

-  			return nil, err

- diff --git a/runtime/v1/linux/task.go b/runtime/v1/linux/task.go

- index 3ac7839ff02b..44c89e5c27c2 100644

- --- a/runtime/v1/linux/task.go

- +++ b/runtime/v1/linux/task.go

- @@ -32,11 +32,11 @@ import (

-  	"github.com/containerd/containerd/events/exchange"

-  	"github.com/containerd/containerd/identifiers"

-  	"github.com/containerd/containerd/log"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime"

-  	"github.com/containerd/containerd/runtime/v1/shim/client"

-  	"github.com/containerd/containerd/runtime/v1/shim/v1"

-  	"github.com/containerd/ttrpc"

- -	"github.com/containerd/typeurl"

-  	"github.com/gogo/protobuf/types"

-  )

-  

- @@ -340,7 +340,7 @@ func (t *Task) Stats(ctx context.Context) (*types.Any, error) {

-  	if err != nil {

-  		return nil, err

-  	}

- -	return typeurl.MarshalAny(stats)

- +	return protobuf.MarshalAnyToProto(stats)

-  }

-  

-  // Cgroup returns the underlying cgroup for a linux task

- diff --git a/runtime/v1/shim/service.go b/runtime/v1/shim/service.go

- index a08757d0a7b9..926134821d38 100644

- --- a/runtime/v1/shim/service.go

- +++ b/runtime/v1/shim/service.go

- @@ -37,6 +37,7 @@ import (

-  	"github.com/containerd/containerd/namespaces"

-  	"github.com/containerd/containerd/pkg/process"

-  	"github.com/containerd/containerd/pkg/stdio"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime"

-  	"github.com/containerd/containerd/runtime/linux/runctypes"

-  	shimapi "github.com/containerd/containerd/runtime/v1/shim/v1"

- @@ -412,7 +413,7 @@ func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*sh

-  				if err != nil {

-  					return nil, fmt.Errorf("failed to marshal process %d info: %w", pid, err)

-  				}

- -				pInfo.Info = a

- +				pInfo.Info = protobuf.FromAny(a)

-  				break

-  			}

-  		}

- diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go

- index 1927cbb3f0c3..505d5d896995 100644

- --- a/runtime/v2/manager.go

- +++ b/runtime/v2/manager.go

- @@ -33,6 +33,7 @@ import (

-  	"github.com/containerd/containerd/pkg/timeout"

-  	"github.com/containerd/containerd/platforms"

-  	"github.com/containerd/containerd/plugin"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime"

-  	shimbinary "github.com/containerd/containerd/runtime/v2/shim"

-  	"github.com/containerd/containerd/runtime/v2/task"

- @@ -156,7 +157,7 @@ func (m *ShimManager) ID() string {

-  

-  // Start launches a new shim instance

-  func (m *ShimManager) Start(ctx context.Context, id string, opts runtime.CreateOpts) (_ ShimProcess, retErr error) {

- -	bundle, err := NewBundle(ctx, m.root, m.state, id, opts.Spec.Value)

- +	bundle, err := NewBundle(ctx, m.root, m.state, id, opts.Spec.GetValue())

-  	if err != nil {

-  		return nil, err

-  	}

- @@ -197,7 +198,7 @@ func (m *ShimManager) startShim(ctx context.Context, bundle *Bundle, id string,

-  	}

-  

-  	topts := opts.TaskOptions

- -	if topts == nil {

- +	if topts == nil || topts.GetValue() == nil {

-  		topts = opts.RuntimeOptions

-  	}

-  

- @@ -212,7 +213,7 @@ func (m *ShimManager) startShim(ctx context.Context, bundle *Bundle, id string,

-  		ttrpcAddress: m.containerdTTRPCAddress,

-  		schedCore:    m.schedCore,

-  	})

- -	shim, err := b.Start(ctx, topts, func() {

- +	shim, err := b.Start(ctx, protobuf.FromAny(topts), func() {

-  		log.G(ctx).WithField("id", id).Info("shim disconnected")

-  

-  		cleanupAfterDeadShim(context.Background(), id, ns, m.shims, m.events, b)

- diff --git a/runtime/v2/runc/container.go b/runtime/v2/runc/container.go

- index aac9dad7e916..c7e82b610695 100644

- --- a/runtime/v2/runc/container.go

- +++ b/runtime/v2/runc/container.go

- @@ -49,12 +49,14 @@ func NewContainer(ctx context.Context, platform stdio.Platform, r *task.CreateTa

-  	}

-  

-  	var opts options.Options

- -	if r.Options != nil && r.Options.GetTypeUrl() != "" {

- +	if r.Options.GetValue() != nil {

-  		v, err := typeurl.UnmarshalAny(r.Options)

-  		if err != nil {

-  			return nil, err

-  		}

- -		opts = *v.(*options.Options)

- +		if v != nil {

- +			opts = *v.(*options.Options)

- +		}

-  	}

-  

-  	var mounts []process.Mount

- diff --git a/runtime/v2/runc/task/service.go b/runtime/v2/runc/task/service.go

- index d6af20fb03f0..25ec6d1f9df5 100644

- --- a/runtime/v2/runc/task/service.go

- +++ b/runtime/v2/runc/task/service.go

- @@ -38,6 +38,7 @@ import (

-  	"github.com/containerd/containerd/pkg/shutdown"

-  	"github.com/containerd/containerd/pkg/stdio"

-  	"github.com/containerd/containerd/pkg/userns"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime/v2/runc"

-  	"github.com/containerd/containerd/runtime/v2/runc/options"

-  	"github.com/containerd/containerd/runtime/v2/shim"

- @@ -475,7 +476,7 @@ func (s *service) Pids(ctx context.Context, r *taskAPI.PidsRequest) (*taskAPI.Pi

-  				d := &options.ProcessDetails{

-  					ExecID: p.ID(),

-  				}

- -				a, err := typeurl.MarshalAny(d)

- +				a, err := protobuf.MarshalAnyToProto(d)

-  				if err != nil {

-  					return nil, fmt.Errorf("failed to marshal process %d info: %w", pid, err)

-  				}

- @@ -603,7 +604,7 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.

-  		return nil, err

-  	}

-  	return &taskAPI.StatsResponse{

- -		Stats: data,

- +		Stats: protobuf.FromAny(data),

-  	}, nil

-  }

-  

- diff --git a/runtime/v2/runc/v1/service.go b/runtime/v2/runc/v1/service.go

- index 8c473430e218..8fdac3f8a2fd 100644

- --- a/runtime/v2/runc/v1/service.go

- +++ b/runtime/v2/runc/v1/service.go

- @@ -41,6 +41,7 @@ import (

-  	"github.com/containerd/containerd/pkg/process"

-  	"github.com/containerd/containerd/pkg/schedcore"

-  	"github.com/containerd/containerd/pkg/stdio"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime/v2/runc"

-  	"github.com/containerd/containerd/runtime/v2/runc/options"

-  	"github.com/containerd/containerd/runtime/v2/shim"

- @@ -507,7 +508,7 @@ func (s *service) Pids(ctx context.Context, r *taskAPI.PidsRequest) (*taskAPI.Pi

-  				d := &options.ProcessDetails{

-  					ExecID: p.ID(),

-  				}

- -				a, err := typeurl.MarshalAny(d)

- +				a, err := protobuf.MarshalAnyToProto(d)

-  				if err != nil {

-  					return nil, fmt.Errorf("failed to marshal process %d info: %w", pid, err)

-  				}

- @@ -621,7 +622,7 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.

-  		return nil, err

-  	}

-  	return &taskAPI.StatsResponse{

- -		Stats: data,

- +		Stats: protobuf.FromAny(data),

-  	}, nil

-  }

-  

- diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go

- index 456ffb4409bd..18cc9a0ed6cc 100644

- --- a/runtime/v2/shim.go

- +++ b/runtime/v2/shim.go

- @@ -34,6 +34,7 @@ import (

-  	"github.com/containerd/containerd/log"

-  	"github.com/containerd/containerd/namespaces"

-  	"github.com/containerd/containerd/pkg/timeout"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime"

-  	client "github.com/containerd/containerd/runtime/v2/shim"

-  	"github.com/containerd/containerd/runtime/v2/task"

- @@ -324,7 +325,7 @@ func (s *shimTask) delete(ctx context.Context, removeTask func(ctx context.Conte

-  

-  func (s *shimTask) Create(ctx context.Context, opts runtime.CreateOpts) (runtime.Task, error) {

-  	topts := opts.TaskOptions

- -	if topts == nil {

- +	if topts == nil || topts.GetValue() == nil {

-  		topts = opts.RuntimeOptions

-  	}

-  	request := &task.CreateTaskRequest{

- @@ -335,7 +336,7 @@ func (s *shimTask) Create(ctx context.Context, opts runtime.CreateOpts) (runtime

-  		Stderr:     opts.IO.Stderr,

-  		Terminal:   opts.IO.Terminal,

-  		Checkpoint: opts.Checkpoint,

- -		Options:    topts,

- +		Options:    protobuf.FromAny(topts),

-  	}

-  	for _, m := range opts.Rootfs {

-  		request.Rootfs = append(request.Rootfs, &types.Mount{

- diff --git a/runtime/v2/shim/publisher.go b/runtime/v2/shim/publisher.go

- index ed1ebdd58b9c..20856f115bd6 100644

- --- a/runtime/v2/shim/publisher.go

- +++ b/runtime/v2/shim/publisher.go

- @@ -25,8 +25,8 @@ import (

-  	"github.com/containerd/containerd/events"

-  	"github.com/containerd/containerd/namespaces"

-  	"github.com/containerd/containerd/pkg/ttrpcutil"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/ttrpc"

- -	"github.com/containerd/typeurl"

-  	"github.com/sirupsen/logrus"

-  )

-  

- @@ -110,7 +110,7 @@ func (l *RemoteEventsPublisher) Publish(ctx context.Context, topic string, event

-  	if err != nil {

-  		return err

-  	}

- -	any, err := typeurl.MarshalAny(event)

- +	any, err := protobuf.MarshalAnyToProto(event)

-  	if err != nil {

-  		return err

-  	}

- diff --git a/services/containers/helpers.go b/services/containers/helpers.go

- index aece9ca41471..a75d5d62bbc0 100644

- --- a/services/containers/helpers.go

- +++ b/services/containers/helpers.go

- @@ -19,6 +19,9 @@ package containers

-  import (

-  	api "github.com/containerd/containerd/api/services/containers/v1"

-  	"github.com/containerd/containerd/containers"

- +	"github.com/containerd/containerd/protobuf"

- +	"github.com/containerd/typeurl"

- +	"github.com/gogo/protobuf/types"

-  )

-  

-  func containersToProto(containers []containers.Container) []api.Container {

- @@ -33,20 +36,24 @@ func containersToProto(containers []containers.Container) []api.Container {

-  }

-  

-  func containerToProto(container *containers.Container) api.Container {

- +	extensions := make(map[string]types.Any)

- +	for k, v := range container.Extensions {

- +		extensions[k] = *protobuf.FromAny(v)

- +	}

-  	return api.Container{

-  		ID:     container.ID,

-  		Labels: container.Labels,

-  		Image:  container.Image,

-  		Runtime: &api.Container_Runtime{

-  			Name:    container.Runtime.Name,

- -			Options: container.Runtime.Options,

- +			Options: protobuf.FromAny(container.Runtime.Options),

-  		},

- -		Spec:        container.Spec,

- +		Spec:        protobuf.FromAny(container.Spec),

-  		Snapshotter: container.Snapshotter,

-  		SnapshotKey: container.SnapshotKey,

-  		CreatedAt:   container.CreatedAt,

-  		UpdatedAt:   container.UpdatedAt,

- -		Extensions:  container.Extensions,

- +		Extensions:  extensions,

-  	}

-  }

-  

- @@ -58,6 +65,11 @@ func containerFromProto(containerpb *api.Container) containers.Container {

-  			Options: containerpb.Runtime.Options,

-  		}

-  	}

- +	extensions := make(map[string]typeurl.Any)

- +	for k, v := range containerpb.Extensions {

- +		v := v

- +		extensions[k] = &v

- +	}

-  	return containers.Container{

-  		ID:          containerpb.ID,

-  		Labels:      containerpb.Labels,

- @@ -66,6 +78,6 @@ func containerFromProto(containerpb *api.Container) containers.Container {

-  		Spec:        containerpb.Spec,

-  		Snapshotter: containerpb.Snapshotter,

-  		SnapshotKey: containerpb.SnapshotKey,

- -		Extensions:  containerpb.Extensions,

- +		Extensions:  extensions,

-  	}

-  }

- diff --git a/services/events/service.go b/services/events/service.go

- index 3b5f811382b7..b1992a1ab716 100644

- --- a/services/events/service.go

- +++ b/services/events/service.go

- @@ -26,6 +26,7 @@ import (

-  	"github.com/containerd/containerd/events"

-  	"github.com/containerd/containerd/events/exchange"

-  	"github.com/containerd/containerd/plugin"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/ttrpc"

-  	ptypes "github.com/gogo/protobuf/types"

-  	"google.golang.org/grpc"

- @@ -115,7 +116,7 @@ func toProto(env *events.Envelope) *api.Envelope {

-  		Timestamp: env.Timestamp,

-  		Namespace: env.Namespace,

-  		Topic:     env.Topic,

- -		Event:     env.Event,

- +		Event:     protobuf.FromAny(env.Event),

-  	}

-  }

-  

- diff --git a/services/tasks/local.go b/services/tasks/local.go

- index 96ed36ca4a34..34cb23d1672c 100644

- --- a/services/tasks/local.go

- +++ b/services/tasks/local.go

- @@ -41,6 +41,7 @@ import (

-  	"github.com/containerd/containerd/mount"

-  	"github.com/containerd/containerd/pkg/timeout"

-  	"github.com/containerd/containerd/plugin"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/runtime"

-  	"github.com/containerd/containerd/runtime/linux/runctypes"

-  	"github.com/containerd/containerd/runtime/v2/runc/options"

- @@ -461,7 +462,7 @@ func (l *local) ListPids(ctx context.Context, r *api.ListPidsRequest, _ ...grpc.

-  			Pid: p.Pid,

-  		}

-  		if p.Info != nil {

- -			a, err := typeurl.MarshalAny(p.Info)

- +			a, err := protobuf.MarshalAnyToProto(p.Info)

-  			if err != nil {

-  				return nil, fmt.Errorf("failed to marshal process %d info: %w", p.Pid, err)

-  			}

- @@ -576,7 +577,7 @@ func (l *local) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest, _

-  		return nil, err

-  	}

-  	// write the config to the content store

- -	data, err := container.Spec.Marshal()

- +	data, err := protobuf.FromAny(container.Spec).Marshal()

-  	if err != nil {

-  		return nil, err

-  	}

- diff --git a/task.go b/task.go

- index ef8cd44942cf..bcb522c52e30 100644

- --- a/task.go

- +++ b/task.go

- @@ -38,6 +38,7 @@ import (

-  	"github.com/containerd/containerd/mount"

-  	"github.com/containerd/containerd/oci"

-  	"github.com/containerd/containerd/plugin"

- +	"github.com/containerd/containerd/protobuf"

-  	"github.com/containerd/containerd/rootfs"

-  	"github.com/containerd/containerd/runtime/linux/runctypes"

-  	"github.com/containerd/containerd/runtime/v2/runc/options"

- @@ -365,7 +366,7 @@ func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreat

-  			i.Close()

-  		}

-  	}()

- -	any, err := typeurl.MarshalAny(spec)

- +	any, err := protobuf.MarshalAnyToProto(spec)

-  	if err != nil {

-  		return nil, err

-  	}

- @@ -465,7 +466,7 @@ func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointTaskOpts) (Imag

-  	}

-  	request.ParentCheckpoint = i.ParentCheckpoint

-  	if i.Options != nil {

- -		any, err := typeurl.MarshalAny(i.Options)

- +		any, err := protobuf.MarshalAnyToProto(i.Options)

-  		if err != nil {

-  			return nil, err

-  		}

- @@ -554,7 +555,7 @@ func (t *task) Update(ctx context.Context, opts ...UpdateTaskOpts) error {

-  		if err != nil {

-  			return err

-  		}

- -		request.Resources = any

- +		request.Resources = protobuf.FromAny(any)

-  	}

-  	if i.Annotations != nil {

-  		request.Annotations = i.Annotations

- -- 

- 2.41.0

- 

@@ -1,162 +0,0 @@ 

- From 4347fc8bc2ac225117a3280c0445e855ca7a69f3 Mon Sep 17 00:00:00 2001

- From: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>

- Date: Tue, 9 May 2023 22:24:47 +0900

- Subject: [PATCH] go.mod: github.com/opencontainers/image-spec v1.1.0-rc3

- 

- Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>

- ---

-  go.mod                                        |  2 +-

-  go.sum                                        |  4 +--

-  images/converter/default.go                   |  4 +--

-  images/converter/uncompress/uncompress.go     |  6 ++--

-  images/diffid.go                              |  2 +-

-  images/mediatypes.go                          |  2 +-

-  integration/client/go.mod                     |  2 +-

-  integration/client/go.sum                     |  4 +--

-  integration/client/import_test.go             |  8 +++--

-  oci/spec_opts.go                              |  1 +

-  pkg/cri/opts/spec_windows.go                  |  4 +--

-  remotes/handlers_test.go                      |  1 +

-  .../image-spec/specs-go/v1/annotations.go     |  3 --

-  .../image-spec/specs-go/v1/artifact.go        | 34 -------------------

-  .../image-spec/specs-go/v1/config.go          | 34 ++++++-------------

-  .../image-spec/specs-go/v1/manifest.go        | 11 ++++++

-  .../image-spec/specs-go/v1/mediatype.go       | 19 +++++++++--

-  .../image-spec/specs-go/version.go            |  2 +-

-  vendor/modules.txt                            |  4 +--

-  19 files changed, 64 insertions(+), 83 deletions(-)

-  delete mode 100644 vendor/github.com/opencontainers/image-spec/specs-go/v1/artifact.go

- 

- diff --git a/images/converter/default.go b/images/converter/default.go

- index c67617e4ccfc..4a887242ce40 100644

- --- a/images/converter/default.go

- +++ b/images/converter/default.go

- @@ -431,11 +431,11 @@ func ConvertDockerMediaTypeToOCI(mt stri

-  	case images.MediaTypeDockerSchema2LayerGzip:

-  		return ocispec.MediaTypeImageLayerGzip

-  	case images.MediaTypeDockerSchema2LayerForeignGzip:

- -		return ocispec.MediaTypeImageLayerNonDistributableGzip

- +		return ocispec.MediaTypeImageLayerNonDistributableGzip //nolint:staticcheck // deprecated

-  	case images.MediaTypeDockerSchema2Layer:

-  		return ocispec.MediaTypeImageLayer

-  	case images.MediaTypeDockerSchema2LayerForeign:

- -		return ocispec.MediaTypeImageLayerNonDistributable

- +		return ocispec.MediaTypeImageLayerNonDistributable //nolint:staticcheck // deprecated

-  	case images.MediaTypeDockerSchema2Config:

-  		return ocispec.MediaTypeImageConfig

-  	default:

- diff --git a/images/converter/uncompress/uncompress.go b/images/converter/uncompress/uncompress.go

- index 30ae02cf5ef9..ceb998fb8ff6 100644

- --- a/images/converter/uncompress/uncompress.go

- +++ b/images/converter/uncompress/uncompress.go

- @@ -99,7 +99,7 @@ func IsUncompressedType(mt string) bool

-  		images.MediaTypeDockerSchema2Layer,

-  		images.MediaTypeDockerSchema2LayerForeign,

-  		ocispec.MediaTypeImageLayer,

- -		ocispec.MediaTypeImageLayerNonDistributable:

- +		ocispec.MediaTypeImageLayerNonDistributable: //nolint:staticcheck // deprecated

-  		return true

-  	default:

-  		return false

- @@ -114,8 +114,8 @@ func convertMediaType(mt string) string

-  		return images.MediaTypeDockerSchema2LayerForeign

-  	case ocispec.MediaTypeImageLayerGzip, ocispec.MediaTypeImageLayerZstd:

-  		return ocispec.MediaTypeImageLayer

- -	case ocispec.MediaTypeImageLayerNonDistributableGzip, ocispec.MediaTypeImageLayerNonDistributableZstd:

- -		return ocispec.MediaTypeImageLayerNonDistributable

- +	case ocispec.MediaTypeImageLayerNonDistributableGzip, ocispec.MediaTypeImageLayerNonDistributableZstd: //nolint:staticcheck // deprecated

- +		return ocispec.MediaTypeImageLayerNonDistributable //nolint:staticcheck // deprecated

-  	default:

-  		return mt

-  	}

- diff --git a/images/diffid.go b/images/diffid.go

- index 1bd5256e2b37..c031f8e36377 100644

- --- a/images/diffid.go

- +++ b/images/diffid.go

- @@ -36,7 +36,7 @@ func GetDiffID(ctx context.Context, cs c

-  		MediaTypeDockerSchema2Layer,

-  		ocispec.MediaTypeImageLayer,

-  		MediaTypeDockerSchema2LayerForeign,

- -		ocispec.MediaTypeImageLayerNonDistributable:

- +		ocispec.MediaTypeImageLayerNonDistributable: //nolint:staticcheck // deprecated

-  		return desc.Digest, nil

-  	}

-  	info, err := cs.Info(ctx, desc.Digest)

- diff --git a/images/mediatypes.go b/images/mediatypes.go

- index 067963babba1..d3b28d42dc61 100644

- --- a/images/mediatypes.go

- +++ b/images/mediatypes.go

- @@ -76,7 +76,7 @@ func DiffCompression(ctx context.Context

-  			return "", nil

-  		}

-  		return "gzip", nil

- -	case ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerNonDistributable:

- +	case ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerNonDistributable: //nolint:staticcheck // Non-distributable layers are deprecated

-  		if len(ext) > 0 {

-  			switch ext[len(ext)-1] {

-  			case "gzip":

- diff --git a/integration/client/import_test.go b/integration/client/import_test.go

- index f2ba3db35f89..9f2cc46e624e 100644

- --- a/integration/client/import_test.go

- +++ b/integration/client/import_test.go

- @@ -370,9 +370,11 @@ func createContent(size int64, seed int6

- 

-  func createConfig(osName, archName string) ([]byte, digest.Digest) {

-  	image := ocispec.Image{

- -		OS:           osName,

- -		Architecture: archName,

- -		Author:       "test",

- +		Platform: ocispec.Platform{

- +			OS:           osName,

- +			Architecture: archName,

- +		},

- +		Author: author,

-  	}

-  	b, _ := json.Marshal(image)

- 

- diff --git a/oci/spec_opts.go b/oci/spec_opts.go

- index f38828988577..8c4abd0bd876 100644

- --- a/oci/spec_opts.go

- +++ b/oci/spec_opts.go

- @@ -446,6 +446,7 @@ func WithImageConfigArgs(image Image, ar

-  				return errors.New("no arguments specified")

-  			}

- 

- +			//nolint:staticcheck // ArgsEscaped is deprecated

-  			if config.ArgsEscaped && (len(config.Entrypoint) > 0 || cmdFromImage) {

-  				s.Process.Args = nil

-  				s.Process.CommandLine = cmd[0]

- diff --git a/pkg/cri/opts/spec_windows.go b/pkg/cri/opts/spec_windows.go

- index 0964084ca107..0f7307bd0a6f 100644

- --- a/pkg/cri/opts/spec_windows.go

- +++ b/pkg/cri/opts/spec_windows.go

- @@ -260,7 +260,7 @@ func escapeAndCombineArgsWindows(args []

-  // If image.ArgsEscaped field is set, this function sets the process command line and if not, it sets the

-  // process args field

-  func WithProcessCommandLineOrArgsForWindows(config *runtime.ContainerConfig, image *imagespec.ImageConfig) oci.SpecOpts {

- -	if image.ArgsEscaped {

- +	if image.ArgsEscaped { //nolint:staticcheck // ArgsEscaped is deprecated

-  		return func(ctx context.Context, client oci.Client, c *containers.Container, s *runtimespec.Spec) (err error) {

-  			// firstArgFromImg is a flag that is returned to indicate that the first arg in the slice comes from either the

-  			// image Entrypoint or Cmd. If the first arg instead comes from the container config (e.g. overriding the image values),

- @@ -273,7 +273,7 @@ func WithProcessCommandLineOrArgsForWind

-  			}

- 

-  			var cmdLine string

- -			if image.ArgsEscaped && firstArgFromImg {

- +			if image.ArgsEscaped && firstArgFromImg { //nolint:staticcheck // ArgsEscaped is deprecated

-  				cmdLine = args[0]

-  				if len(args) > 1 {

-  					cmdLine += " " + escapeAndCombineArgsWindows(args[1:])

- diff --git a/remotes/handlers_test.go b/remotes/handlers_test.go

- index c0446e1a52e6..9acf54680bf3 100644

- --- a/remotes/handlers_test.go

- +++ b/remotes/handlers_test.go

- @@ -78,6 +78,7 @@ func TestContextCustomKeyPrefix(t *testi

-  	})

-  }

- 

- +//nolint:staticcheck // Non-distributable layers are deprecated

-  func TestSkipNonDistributableBlobs(t *testing.T) {

-  	ctx := context.Background()

- 

@@ -1,24 +0,0 @@ 

- diff --git a/pkg/cri/server/helpers.go b/pkg/cri/server/helpers.go

- index a8498116d..3682be668 100644

- --- a/pkg/cri/server/helpers.go

- +++ b/pkg/cri/server/helpers.go

- @@ -40,7 +40,7 @@ import (

-  	runtimespec "github.com/opencontainers/runtime-spec/specs-go"

-  	"github.com/sirupsen/logrus"

-  

- -	runhcsoptions "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"

- +	// runhcsoptions "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"

-  	imagedigest "github.com/opencontainers/go-digest"

-  	"github.com/pelletier/go-toml"

-  	"golang.org/x/net/context"

- @@ -366,8 +366,8 @@ func getRuntimeOptionsType(t string) interface{} {

-  		return &runcoptions.Options{}

-  	case plugin.RuntimeLinuxV1:

-  		return &runctypes.RuncOptions{}

- -	case runtimeRunhcsV1:

- -		return &runhcsoptions.Options{}

- +	// case runtimeRunhcsV1:

- +	//	return &runhcsoptions.Options{}

-  	default:

-  		return &runtimeoptions.Options{}

-  	}

file modified
+55 -222
@@ -1,261 +1,94 @@ 

- # Generated by go2rpm

- # arm support not fully implemented: not implemented

- %ifnarch %{arm}

+ # Generated by go2rpm 1.11.0

  %bcond_without check

- %endif

- %bcond_with bootstrap

  

  # https://github.com/containerd/containerd

  %global goipath         github.com/containerd/containerd

- Version:                1.6.23

- 

- %gometa

+ Version:                1.7.15

  

- %global goname          containerd

- %global godevelname     containerd-devel

+ %gometa -L -f

  

  %global common_description %{expand:

- Containerd is an industry-standard container runtime with an emphasis on

- simplicity, robustness and portability. It is available as a daemon for Linux

- and Windows, which can manage the complete container lifecycle of its host

- system: image transfer and storage, container execution and supervision,

- low-level storage and network attachments, etc.}

+ An open and reliable container runtime.}

  

- %global golicenses      LICENSE NOTICE

- %global godocs          docs ROADMAP.md SCOPE.md code-of-conduct.md\\\

-                         BUILDING.md README.md RELEASES.md

- 

- Name:           %{goname}

+ Name:           containerd

  Release:        %autorelease

- Summary:        Open and reliable container runtime

+ Summary:        An open and reliable container runtime

  

- License:        Apache-2.0

+ # Generated by go-vendor-tools

+ # SourceLicense:  Apache-2.0

+ License:        Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0

  URL:            %{gourl}

  Source0:        %{gosource}

- Source2:        containerd.toml

- # Carve out code requiring github.com/Microsoft/hcsshim

- Patch0:         0001-Revert-commit-for-Windows-metrics.patch

- Patch1:         0002-Remove-windows-only-dep.patch

- # Backport for github.com/containerd/typeurl update

- Patch2:         0001-Use-typeurl.Any-instead-of-github.com-gogo-protobuf-.patch

- # To use with latest go-runc

- Patch3:         0001-Add-reaper-StartLocked.patch

- # To use with latest opencontainers/image-spec

- Patch4:         0001-opencontainers-image-spec-v1.1.0-rc3.patch

+ # Generated by go-vendor-tools

+ Source1:        %{archivename}-vendor.tar.bz2

+ Source2:        go-vendor-tools.toml

+ Source3:        containerd.toml

+ 

+ Patch:          0001-Makefile-fix-GO_LDFLAGS-quoting.patch

  

+ BuildRequires:  /usr/bin/go-md2man

  BuildRequires:  btrfs-progs-devel

- BuildRequires:  go-md2man

+ BuildRequires:  go-vendor-tools

+ BuildRequires:  make

  BuildRequires:  systemd-rpm-macros

- %if %{without bootstrap}

- BuildRequires:  golang(github.com/containerd/aufs/plugin)

- %endif

- BuildRequires:  golang(github.com/containerd/btrfs)

- BuildRequires:  golang(github.com/containerd/cgroups)

- BuildRequires:  golang(github.com/containerd/cgroups/stats/v1)

- BuildRequires:  golang(github.com/containerd/cgroups/v2)

- BuildRequires:  golang(github.com/containerd/cgroups/v2/stats)

- BuildRequires:  golang(github.com/containerd/console)

- BuildRequires:  golang(github.com/containerd/continuity)

- BuildRequires:  golang(github.com/containerd/continuity/fs)

- BuildRequires:  golang(github.com/containerd/continuity/fs/fstest)

- BuildRequires:  golang(github.com/containerd/continuity/sysx)

- BuildRequires:  golang(github.com/containerd/fifo)

- BuildRequires:  golang(github.com/containerd/go-cni)

- BuildRequires:  golang(github.com/containerd/go-runc)

- BuildRequires:  golang(github.com/containerd/imgcrypt)

- BuildRequires:  golang(github.com/containerd/imgcrypt/images/encryption)

- BuildRequires:  golang(github.com/containerd/nri)

- BuildRequires:  golang(github.com/containerd/nri/types/v1)

- BuildRequires:  golang(github.com/containerd/ttrpc)

- BuildRequires:  golang(github.com/containerd/ttrpc/plugin)

- BuildRequires:  golang(github.com/containerd/typeurl)

- %if %{without bootstrap}

- BuildRequires:  golang(github.com/containerd/zfs/plugin)

- %endif

- BuildRequires:  golang(github.com/containernetworking/plugins/pkg/ns)

- BuildRequires:  golang(github.com/coreos/go-systemd/v22/daemon)

- BuildRequires:  golang(github.com/davecgh/go-spew/spew)

- BuildRequires:  golang(github.com/docker/go-events)

- BuildRequires:  golang(github.com/docker/go-metrics)

- BuildRequires:  golang(github.com/docker/go-units)

- BuildRequires:  golang(github.com/emicklei/go-restful)

- BuildRequires:  golang(github.com/fsnotify/fsnotify)

- BuildRequires:  golang(github.com/gogo/googleapis/google/rpc)

- BuildRequires:  golang(github.com/gogo/protobuf/gogoproto)

- BuildRequires:  golang(github.com/gogo/protobuf/proto)

- BuildRequires:  golang(github.com/gogo/protobuf/protoc-gen-gogo/descriptor)

- BuildRequires:  golang(github.com/gogo/protobuf/protoc-gen-gogo/generator)

- BuildRequires:  golang(github.com/gogo/protobuf/sortkeys)

- BuildRequires:  golang(github.com/gogo/protobuf/types)

- BuildRequires:  golang(github.com/gogo/protobuf/vanity)

- BuildRequires:  golang(github.com/gogo/protobuf/vanity/command)

- BuildRequires:  golang(github.com/google/uuid)

- BuildRequires:  golang(github.com/grpc-ecosystem/go-grpc-middleware)

- BuildRequires:  golang(github.com/grpc-ecosystem/go-grpc-prometheus)

- BuildRequires:  golang(github.com/hashicorp/go-multierror)

- BuildRequires:  golang(github.com/imdario/mergo)

- BuildRequires:  golang(github.com/intel/goresctrl/pkg/rdt)

- BuildRequires:  golang(github.com/klauspost/compress/zstd)

- # BuildRequires:  golang(github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options)

- # BuildRequires:  golang(github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats)

- BuildRequires:  golang(github.com/moby/locker)

- BuildRequires:  golang(github.com/moby/sys/mountinfo)

- BuildRequires:  golang(github.com/moby/sys/signal)

- BuildRequires:  golang(github.com/moby/sys/symlink)

- BuildRequires:  golang(github.com/opencontainers/go-digest)

- BuildRequires:  golang(github.com/opencontainers/go-digest/digestset)

- BuildRequires:  golang(github.com/opencontainers/image-spec/identity)

- BuildRequires:  golang(github.com/opencontainers/image-spec/specs-go)

- BuildRequires:  golang(github.com/opencontainers/image-spec/specs-go/v1)

- BuildRequires:  golang(github.com/opencontainers/runc/libcontainer/user)

- BuildRequires:  golang(github.com/opencontainers/runtime-spec/specs-go)

- BuildRequires:  golang(github.com/opencontainers/selinux/go-selinux)

- BuildRequires:  golang(github.com/opencontainers/selinux/go-selinux/label)

- BuildRequires:  golang(github.com/pelletier/go-toml)

- BuildRequires:  golang(github.com/prometheus/client_golang/prometheus)

- BuildRequires:  golang(github.com/sirupsen/logrus)

- BuildRequires:  golang(github.com/stretchr/testify/require)

- BuildRequires:  golang(github.com/tchap/go-patricia/patricia)

- BuildRequires:  golang(github.com/urfave/cli)

- BuildRequires:  golang(github.com/vishvananda/netlink)

- BuildRequires:  golang(go.etcd.io/bbolt)

- BuildRequires:  golang(go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc)

- BuildRequires:  golang(go.opentelemetry.io/otel)

- BuildRequires:  golang(go.opentelemetry.io/otel/attribute)

- BuildRequires:  golang(go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc)

- BuildRequires:  golang(go.opentelemetry.io/otel/propagation)

- BuildRequires:  golang(go.opentelemetry.io/otel/sdk/resource)

- BuildRequires:  golang(go.opentelemetry.io/otel/sdk/trace)

- BuildRequires:  golang(go.opentelemetry.io/otel/semconv/v1.4.0)

- BuildRequires:  golang(go.opentelemetry.io/otel/trace)

- BuildRequires:  golang(golang.org/x/net/context)

- BuildRequires:  golang(golang.org/x/net/context/ctxhttp)

- BuildRequires:  golang(golang.org/x/sync/errgroup)

- BuildRequires:  golang(golang.org/x/sync/semaphore)

- BuildRequires:  golang(golang.org/x/sys/execabs)

- BuildRequires:  golang(golang.org/x/sys/unix)

- BuildRequires:  golang(google.golang.org/grpc)

- BuildRequires:  golang(google.golang.org/grpc/backoff)

- BuildRequires:  golang(google.golang.org/grpc/codes)

- BuildRequires:  golang(google.golang.org/grpc/credentials)

- BuildRequires:  golang(google.golang.org/grpc/credentials/insecure)

- BuildRequires:  golang(google.golang.org/grpc/grpclog)

- BuildRequires:  golang(google.golang.org/grpc/health)

- BuildRequires:  golang(google.golang.org/grpc/health/grpc_health_v1)

- BuildRequires:  golang(google.golang.org/grpc/metadata)

- BuildRequires:  golang(google.golang.org/grpc/status)

- BuildRequires:  golang(gotest.tools/v3/assert)

- BuildRequires:  golang(gotest.tools/v3/assert/cmp)

- BuildRequires:  golang(k8s.io/api/core/v1)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/api/errors)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/api/resource)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/apis/meta/v1)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/types)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/util/httpstream)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/util/httpstream/spdy)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/util/net)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/util/remotecommand)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/util/runtime)

- BuildRequires:  golang(k8s.io/apimachinery/pkg/util/sets)

- BuildRequires:  golang(k8s.io/apiserver/pkg/server/httplog)

- BuildRequires:  golang(k8s.io/apiserver/pkg/util/wsstream)

- BuildRequires:  golang(k8s.io/client-go/tools/remotecommand)

- BuildRequires:  golang(k8s.io/client-go/util/cert)

- BuildRequires:  golang(k8s.io/component-base/logs/logreduction)

- BuildRequires:  golang(k8s.io/cri-api/pkg/apis/runtime/v1)

- BuildRequires:  golang(k8s.io/cri-api/pkg/apis/runtime/v1alpha2)

- BuildRequires:  golang(k8s.io/klog/v2)

- BuildRequires:  golang(k8s.io/utils/clock)

- BuildRequires:  golang(k8s.io/utils/exec)

- 

- %if %{with check}

- # Tests

- BuildRequires:  golang(github.com/containerd/continuity/testutil)

- BuildRequires:  golang(github.com/containerd/continuity/testutil/loopback)

- BuildRequires:  golang(github.com/google/go-cmp/cmp)

- BuildRequires:  golang(github.com/google/go-cmp/cmp/cmpopts)

- BuildRequires:  golang(github.com/stretchr/testify/assert)

- BuildRequires:  golang(google.golang.org/protobuf/proto)

- BuildRequires:  golang(k8s.io/utils/clock/testing)

- %endif

  

  Requires:       runc

  

- %description

- %{common_description}

- 

- %gopkg

+ %description %{common_description}

  

  %prep

- %goprep

+ %goprep -A

+ %setup -q -T -D -a1 %{forgesetupargs}

  %autopatch -p1

- # Used only for generation:

- rm -rf cmd/protoc-gen-gogoctrd

  # Replace default bin directory

  sed -i "s|/usr/local/bin/containerd|/usr/bin/containerd|" containerd.service

+ cp -p %{S:3} .

+ 

+ %generate_buildrequires

+ %go_vendor_license_buildrequires -c %{S:2}

  

- %if %{without bootstrap}

  %build

- export LDFLAGS="-X %{goipath}/version.Version=%{version} "

- for cmd in cmd/* ; do

-   %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd

- done

- mkdir _man

- go-md2man -in docs/man/containerd-config.8.md -out _man/containerd-config.8

- go-md2man -in docs/man/containerd-config.toml.5.md -out _man/containerd-config.toml.5

- %{gobuilddir}/bin/gen-manpages containerd.8 _man

- %{gobuilddir}/bin/gen-manpages ctr.8 _man

- rm %{gobuilddir}/bin/gen-manpages

- %else

- rm -rf cmd

- %endif

+ GO_LDFLAGS="" GO_BUILDFLAGS=""

+ %global makeflags %{expand:\\

+     DATADIR=%{_datadir} \\

+     DESTDIR=%{buildroot} \\

+     EXTRA_LDFLAGS=%{gobuild_ldflags_shescaped} \\

+     GO_BUILD_FLAGS=%{gobuild_baseflags_shescaped} \\

+     MANDIR=%{_mandir} \\

+     PREFIX=%{_prefix} \\

+     REVISION=%{release} \\

+     SHIM_CGO_ENABLED=1 \\

+     VERSION=%{version} \\

+ }

+ %make_build %{makeflags} binaries man

  

  %install

- %gopkginstall

- %if %{without bootstrap}

- install -m 0755 -vd                     %{buildroot}%{_bindir}

- install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

- install -D -p -m 0644 _man/containerd.8 %{buildroot}%{_mandir}/man8/containerd.8

- install -D -p -m 0644 _man/containerd-config.8 %{buildroot}%{_mandir}/man8/containerd-config.8

- install -D -p -m 0644 _man/ctr.8 %{buildroot}%{_mandir}/man8/ctr.8

- install -D -p -m 0644 _man/containerd-config.toml.5 %{buildroot}%{_mandir}/man5/containerd-config.toml.5

- install -D -p -m 0644 containerd.service %{buildroot}%{_unitdir}/containerd.service

- install -D -p -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/containerd/config.toml

- mkdir -p %{buildroot}%{_sharedstatedir}/containerd/opt

- %endif

+ %go_vendor_license_install -c %{S:2}

+ %make_build %{makeflags} install install-man

+ install -Dpm 0644 containerd.service -t %{buildroot}%{_unitdir}

+ install -Dpm 0644 containerd.toml %{buildroot}%{_sysconfdir}/containerd/config.toml

  

- %post

- %systemd_post containerd.service

- 

- %preun

- %systemd_preun containerd.service

- 

- %postun

- %systemd_postun_with_restart containerd.service

- 

- %if %{with check}

  %check

- %gocheck -d pkg/cri/server -t integration -d platforms

+ %go_vendor_license_check -c %{S:2}

+ %if %{with check}

+ %make_build %{makeflags} test

  %endif

  

- %if %{without bootstrap}

- %files

- %license LICENSE NOTICE

- %doc docs ROADMAP.md SCOPE.md code-of-conduct.md BUILDING.md

- %doc README.md RELEASES.md

- %{_bindir}/*

+ %files -f %{go_vendor_license_filelist}

+ %license vendor/modules.txt

+ %doc ROADMAP.md ADOPTERS.md BUILDING.md README.md RELEASES.md SCOPE.md

+ %{_bindir}/ctr

+ %{_bindir}/containerd

+ %{_bindir}/containerd-stress

+ %{_bindir}/containerd-shim*

+ %{_mandir}/man5/containerd-config.toml.5*

+ %{_mandir}/man8/ctr.8*

  %{_mandir}/man8/containerd.8*

  %{_mandir}/man8/containerd-config.8*

- %{_mandir}/man8/ctr.8*

- %{_mandir}/man5/containerd-config.toml.5*

- %{_unitdir}/containerd.service

  %dir %{_sysconfdir}/containerd

  %config(noreplace) %{_sysconfdir}/containerd/config.toml

- %dir %{_sharedstatedir}/containerd

- %dir %{_sharedstatedir}/containerd/opt

- %endif

+ %{_unitdir}/containerd.service

  

- %gopkgfiles

  

  %changelog

  %autochangelog

@@ -0,0 +1,2 @@ 

+ [licensing]

+ detector = "trivy"

file modified
+2 -1
@@ -1,1 +1,2 @@ 

- SHA512 (containerd-1.6.23.tar.gz) = 576ab87c07700054918ac8fa8e6c1f1ba971722ac7cad8f3d8ecccdb8cb162103fa826fa815f58f5f63d061b2a8dce8f2fbbee3def85cd4a4f8dbee124d2596a

+ SHA512 (containerd-1.7.15-vendor.tar.bz2) = 4cc7930ffcb7b3351d20d8c9f3a6df64e677f7f0df170ea33df1c7abff627c3b779617c897c4e9ed34b1a64a7381f67b770c9fd2aafdeb7b71680a9579bac05d

+ SHA512 (containerd-1.7.15.tar.gz) = 84a94c7658a431cfd7a5321ac262d966f4291337ddff14211951b0d2025cd3af25a48175794d2b3a630ffc25ba03047579163546a4758a2fb5d1898cd233854f

This update completely revamps the containerd specfile and removes the
-devel subpackage. The latter will be replaced by a new
golang-github-containerd component.

Ref: https://lists.fedoraproject.org/archives/list/golang@lists.fedoraproject.org/thread/K5P6P2MGEE3SCPF4SZFWOIUGHQHJ6GGG/

Depends on the following review:

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/8ec3471487564b598c53cff980d692d7

rebased onto 55cc84b

a year ago

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/70d09049c2744ea5a33f9c70c5ccf865

Pull-Request has been merged by sergiomb

a year ago