Skip to content

Commit

Permalink
Make api a Go sub-module
Browse files Browse the repository at this point in the history
Allow the api to stay at the same v1 go package name and keep using a
1.x version number. This indicates the API is still at 1.x and allows
sharing proto types with containerd 1.6 and 1.7 releases.

Signed-off-by: Derek McGowan <derek@mcg.dev>
  • Loading branch information
dmcgowan committed Apr 30, 2024
1 parent 899011a commit 0095cb8
Show file tree
Hide file tree
Showing 371 changed files with 42,057 additions and 483 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ protos: bin/protoc-gen-go-fieldpath
$(eval TMPDIR := $(shell mktemp -d))
@mv ${ROOTDIR}/vendor ${TMPDIR}
@(cd ${ROOTDIR}/api && PATH="${ROOTDIR}/bin:${PATH}" protobuild --quiet ${API_PACKAGES})
find v2 -name '*.pb.go' -exec sh -c 'f={}; mkdir -p $$(dirname "$${f#v2/}"); echo mv $$f $${f#v2/}; mv $$f $${f#v2/}' \;
@mv ${TMPDIR}/vendor ${ROOTDIR}
@rm -rf ${TMPDIR} v2
go-fix-acronym -w -a '^Os' $(shell find api/ -name '*.pb.go')
Expand Down Expand Up @@ -472,17 +471,18 @@ vendor: ## ensure all the go.mod/go.sum files are up-to-date including vendor/ d
@$(GO) mod tidy
@$(GO) mod vendor
@$(GO) mod verify
#@(cd ${ROOTDIR}/integration/client && ${GO} mod tidy)
@(cd ${ROOTDIR}/api && ${GO} mod tidy)

verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date
@echo "$(WHALE) $@"
$(eval TMPDIR := $(shell mktemp -d))
@cp -R ${ROOTDIR} ${TMPDIR}
@(cd ${TMPDIR}/containerd && ${GO} mod tidy)
@(cd ${TMPDIR}/containerd/integration/client && ${GO} mod tidy)
@(cd ${TMPDIR}/containerd && ${GO} mod vendor)
@(cd ${TMPDIR}/containerd && ${GO} mod verify)
@(cd ${TMPDIR}/containerd/api && ${GO} mod tidy)
@diff -r -u -q ${ROOTDIR} ${TMPDIR}/containerd
@rm -rf ${TMPDIR}
#@${ROOTDIR}/script/verify-go-modules.sh integration/client


help: ## this help
Expand Down
10 changes: 5 additions & 5 deletions api/events/container.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/events/container.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package containerd.events;
import "google/protobuf/any.proto";
import "github.com/containerd/containerd/api/types/fieldpath.proto";

option go_package = "github.com/containerd/containerd/v2/api/events;events";
option go_package = "github.com/containerd/containerd/api/events;events";
option (containerd.types.fieldpath_all) = true;

message ContainerCreate {
Expand Down
10 changes: 5 additions & 5 deletions api/events/content.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/events/content.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package containerd.events;

import "github.com/containerd/containerd/api/types/fieldpath.proto";

option go_package = "github.com/containerd/containerd/v2/api/events;events";
option go_package = "github.com/containerd/containerd/api/events;events";
option (containerd.types.fieldpath_all) = true;

message ContentDelete {
Expand Down
10 changes: 5 additions & 5 deletions api/events/image.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/events/image.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package containerd.services.images.v1;

import "github.com/containerd/containerd/api/types/fieldpath.proto";

option go_package = "github.com/containerd/containerd/v2/api/events;events";
option go_package = "github.com/containerd/containerd/api/events;events";
option (containerd.types.fieldpath_all) = true;

message ImageCreate {
Expand Down
10 changes: 5 additions & 5 deletions api/events/namespace.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/events/namespace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package containerd.events;

import "github.com/containerd/containerd/api/types/fieldpath.proto";

option go_package = "github.com/containerd/containerd/v2/api/events;events";
option go_package = "github.com/containerd/containerd/api/events;events";
option (containerd.types.fieldpath_all) = true;

message NamespaceCreate {
Expand Down
8 changes: 4 additions & 4 deletions api/events/sandbox.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/events/sandbox.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package containerd.events;

import "google/protobuf/timestamp.proto";

option go_package = "github.com/containerd/containerd/v2/api/events;events";
option go_package = "github.com/containerd/containerd/api/events;events";

message SandboxCreate {
string sandbox_id = 1;
Expand Down
10 changes: 5 additions & 5 deletions api/events/snapshot.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/events/snapshot.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package containerd.events;

import "github.com/containerd/containerd/api/types/fieldpath.proto";

option go_package = "github.com/containerd/containerd/v2/api/events;events";
option go_package = "github.com/containerd/containerd/api/events;events";
option (containerd.types.fieldpath_all) = true;

message SnapshotPrepare {
Expand Down
10 changes: 5 additions & 5 deletions api/events/task.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/events/task.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import "google/protobuf/timestamp.proto";
import "github.com/containerd/containerd/api/types/mount.proto";
import "github.com/containerd/containerd/api/types/fieldpath.proto";

option go_package = "github.com/containerd/containerd/v2/api/events;events";
option go_package = "github.com/containerd/containerd/api/events;events";
option (containerd.types.fieldpath_all) = true;

message TaskCreate {
Expand Down
21 changes: 21 additions & 0 deletions api/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module github.com/containerd/containerd/api

go 1.21.8

require (
github.com/containerd/ttrpc v1.2.3
github.com/containerd/typeurl/v2 v2.1.1
github.com/opencontainers/image-spec v1.1.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
)

require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
)
Loading

0 comments on commit 0095cb8

Please sign in to comment.