-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(evpn-gw): updates to support buf lint and generation #411
Changes from 1 commit
0d0654a
93660f5
cf3267d
e0ec268
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,22 @@ | |
# Copyright (c) 2022 Dell Inc, or its subsidiaries. | ||
# Copyright (C) 2023 Nordix Foundation. | ||
|
||
all: | ||
all: buflint doc | ||
|
||
doc: | ||
rm -rf ./google | ||
rm -rf ./v1alpha1/{autogen.md,gen,google} | ||
mkdir -p ./v1alpha1/gen/{go,cpp,python,java} | ||
rm -rf ./v1alpha1/{autogen.md} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
mkdir -p ./v1alpha1 | ||
|
||
# protoc doesn't include annotation and http googleapis, so we have to get them here | ||
curl -kL https://github.com/googleapis/googleapis/archive/master.tar.gz | tar --strip=1 -zxvf - googleapis-master/google/api | ||
|
||
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v ${PWD}/google/api:/opt/include/google/api namely/protoc-all:1.51_2 -i /common -i /opinetcommon --lint -d v1alpha1 -l go -o ./v1alpha1/gen/go/ --go-source-relative | ||
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v ${PWD}/google/api:/opt/include/google/api namely/protoc-all:1.51_2 -i /common -i /opinetcommon --lint -d v1alpha1 -l cpp -o ./v1alpha1/gen/cpp/ --go-source-relative | ||
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v ${PWD}/google/api:/opt/include/google/api namely/protoc-all:1.51_2 -i /common -i /opinetcommon --lint -d v1alpha1 -l python -o ./v1alpha1/gen/python/ --go-source-relative | ||
docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v ${PWD}/google/api:/opt/include/google/api namely/protoc-all:1.51_2 -i /common -i /opinetcommon --lint -d v1alpha1 -l java -o ./v1alpha1/gen/java/ --go-source-relative | ||
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v "${PWD}"/v1alpha1/:/out -w /out -v "${PWD}":/protos pseudomuto/protoc-gen-doc:1.5.1 -c "protoc -I /common -I /opinetcommon -I /protos --doc_out=/out --doc_opt=markdown,autogen.md /protos/*.proto /common/*.proto" | ||
|
||
rm -rf "${PWD}"/google | ||
|
||
mv google "${PWD}"/v1alpha1/ | ||
buflint: | ||
docker run --rm -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinnetcommon -v "${PWD}":/out -w /out bufbuild/buf lint | ||
|
||
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v "${PWD}"/v1alpha1/:/out -w /out -v "${PWD}"/v1alpha1:/protos pseudomuto/protoc-gen-doc:1.5.1 -c "protoc -I /common -I /opinetcommon -I /protos --doc_out=/out --doc_opt=markdown,autogen.md /protos/*.proto /common/*.proto" | ||
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v "${PWD}"/v1alpha1/:/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.59.2 -c "api-linter -I /common -I /opinetcommon /out/*.proto --output-format summary" | ||
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinetcommon -v "${PWD}"/v1alpha1/:/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.59.2 -c "api-linter -I /common -I /opinetcommon /out/[!oc]*.proto --output-format github --set-exit-status" | ||
rm -rf "${PWD}"/v1alpha1/google | ||
bufgen: | ||
docker run --rm -v "${PWD}/../../common/v1":/common -v "${PWD}/../opinetcommon":/opinnetcommon -v "${PWD}/../..":/base -v "${PWD}":/out -w /out msandersdell/bufbuild-go-gen:1.1.0 generate --template /base/buf.gen.yaml -o v1alpha1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,11 @@ name: buf.build/opiproject/evpn-gw | |
deps: | ||
- buf.build/googleapis/googleapis | ||
- buf.build/grpc-ecosystem/grpc-gateway | ||
- buf.build/opiproject/opinetcommon | ||
lint: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's also include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added to latest addition. |
||
except: | ||
- PACKAGE_DIRECTORY_MATCH | ||
# Don't check standard name as that causes google aip issues | ||
- RPC_RESPONSE_STANDARD_NAME | ||
# Allow same name used in request/response type for multiple RPCs | ||
- RPC_REQUEST_RESPONSE_UNIQUE |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,9 +337,9 @@ enum BPOperStatus { | |
// BridgePortType reflects the different types of a Bridge Port | ||
enum BridgePortType { | ||
// "unknown" bridge port type | ||
UNKNOWN = 0; | ||
BRIDGE_PORT_TYPE_UNSPECIFIED = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the reason that we have changed the ENUM here ? Does this follows the googles AIPs for ENUMs ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - this follows the AIPs for ENUMs as part of the checking. It also requires the addition of the "BRIDGE_PORT_TYPE_" for all of the ENUMs to be unique as a check. |
||
// "access" bridge port type | ||
ACCESS = 1; | ||
BRIDGE_PORT_TYPE_ACCESS = 1; | ||
// "trunk" bridge port type | ||
TRUNK = 2; | ||
BRIDGE_PORT_TYPE_TRUNK = 2; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we intentionally not run
bufgen
target? Withoutbufgen
, the CI job does not actually check that we provided all generated artifactsopi-api/.github/workflows/network.yml
Lines 42 to 48 in b990048
I missed that point on the review of
opinetcommon
as well...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will add that into the steps currently. Eventually the generated files will be placed into a separate repository and autogenerated; but, for now adding the bufgen in the make should take care of the operation.