Skip to content

Commit

Permalink
Move runtimeoptions to api directory
Browse files Browse the repository at this point in the history
Signed-off-by: Derek McGowan <derek@mcg.dev>
  • Loading branch information
dmcgowan committed May 2, 2024
1 parent 4a45507 commit 3e9cace
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 199 deletions.
6 changes: 2 additions & 4 deletions Makefile
Expand Up @@ -109,7 +109,6 @@ SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version
# Project packages.
PACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /integration)
API_PACKAGES=$(shell (cd api && $(GO) list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /integration))
NON_API_PACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /vendor/ | grep -v /integration | grep -v "containerd/api")
TEST_REQUIRES_ROOT_PACKAGES=$(filter \
${PACKAGES}, \
$(shell \
Expand Down Expand Up @@ -178,12 +177,11 @@ 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})
@(PATH="${ROOTDIR}/bin:${PATH}" protobuild --quiet ${NON_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/ core/runtime/ -name '*.pb.go')
go-fix-acronym -w -a '(Id|Io|Uuid|Os)$$' $(shell find api/ core/runtime/ -name '*.pb.go')
go-fix-acronym -w -a '^Os' $(shell find api/ -name '*.pb.go')
go-fix-acronym -w -a '(Id|Io|Uuid|Os)$$' $(shell find api/ -name '*.pb.go')

check-protos: protos ## check if protobufs needs to be generated again
@echo "$(WHALE) $@"
Expand Down
14 changes: 0 additions & 14 deletions Protobuild.toml

This file was deleted.

32 changes: 32 additions & 0 deletions api/next.pb.txt
Expand Up @@ -7350,6 +7350,38 @@ file {
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/types/runtimeoptions/v1/api.proto"
package: "runtimeoptions.v1"
message_type {
name: "Options"
field {
name: "type_url"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "typeUrl"
}
field {
name: "config_path"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "configPath"
}
field {
name: "config_body"
number: 3
label: LABEL_OPTIONAL
type: TYPE_BYTES
json_name: "configBody"
}
}
options {
go_package: "github.com/containerd/containerd/v2/api/types/runtimeoptions/v1;runtimeoptions"
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/types/transfer/imagestore.proto"
package: "containerd.types.transfer"
Expand Down
177 changes: 177 additions & 0 deletions api/types/runtimeoptions/v1/api.pb.go

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

Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";

package runtimeoptions.v1;

option go_package = "github.com/containerd/containerd/v2/pkg/runtimeoptions/v1;runtimeoptions_v1";
option go_package = "github.com/containerd/containerd/v2/api/types/runtimeoptions/v1;runtimeoptions";

message Options {
// TypeUrl specifies the type of the content inside the config file.
Expand Down
Expand Up @@ -14,4 +14,4 @@
limitations under the License.
*/

package runtimeoptions_v1 //nolint:revive // Ignore var-naming: don't use an underscore in package name (revive)
package runtimeoptions
2 changes: 1 addition & 1 deletion cmd/ctr/commands/commands_unix.go
Expand Up @@ -22,7 +22,7 @@ import (
"errors"

"github.com/containerd/containerd/v2/api/types/runc/options"
runtimeoptions "github.com/containerd/containerd/v2/pkg/runtimeoptions/v1"
runtimeoptions "github.com/containerd/containerd/v2/api/types/runtimeoptions/v1"
"github.com/urfave/cli/v2"
)

Expand Down
1 change: 1 addition & 0 deletions contrib/v2-migrate.sh
Expand Up @@ -65,6 +65,7 @@ for GOFILE in $(find . -name "*.go" | grep -v "./vendor/" ); do
perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/metrics/$1$2"github.com\/containerd\/containerd\/v2\/core\/metrics/g' $GOFILE
perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/runtime/$1$2"github.com\/containerd\/containerd\/v2\/core\/runtime/g' $GOFILE
perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/core\/runtime\/v2\/runc\/options/$1$2"github.com\/containerd\/containerd\/v2\/api\/types\/runc\/options/g' $GOFILE
perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/runtimeoptions/$1$2"github.com\/containerd\/containerd\/v2\/api\/types\/runtimeoptions/g' $GOFILE

# Migrate packages split out to their own repository
perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/platforms/$1$2"github.com\/containerd\/platforms/g' $GOFILE
Expand Down
2 changes: 1 addition & 1 deletion internal/cri/config/config.go
Expand Up @@ -30,9 +30,9 @@ import (

runhcsoptions "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options"
runcoptions "github.com/containerd/containerd/v2/api/types/runc/options"
runtimeoptions "github.com/containerd/containerd/v2/api/types/runtimeoptions/v1"
"github.com/containerd/containerd/v2/internal/cri/annotations"
"github.com/containerd/containerd/v2/pkg/deprecation"
runtimeoptions "github.com/containerd/containerd/v2/pkg/runtimeoptions/v1"
"github.com/containerd/containerd/v2/plugins"
)

Expand Down

0 comments on commit 3e9cace

Please sign in to comment.