opiproject / opi-api

Open Programmable Infrastructure API and Behavioral Model
Apache License 2.0
31 stars 40 forks source link

[storage]: enable `BUF` linter and compiler #329

Closed glimchb closed 8 months ago

glimchb commented 1 year ago

see https://buf.build/docs/lint/usage#5.-docker

and https://github.com/opiproject/opi-api/commit/0729d7f3a61269ac846f8dff8872ad4bcd9ed30e :

jobs:
  lint-protos:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: bufbuild/buf-setup-action@v1
      - uses: bufbuild/buf-lint-action@v1
glimchb commented 10 months ago

storage fails on

docker run --rm -it -v /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:/etc/ssl/certs/ca-certificates.crt --volume "$(pwd):/workspace" --workdir /workspace bufbuild/buf lint
storage/v1alpha1/backend_aio.proto:21:8:opicommon.proto: does not exist

if

diff --git a/buf.work.yaml b/buf.work.yaml
index 7ddb5da..80d77b7 100644
--- a/buf.work.yaml
+++ b/buf.work.yaml
@@ -3,7 +3,7 @@ directories:
 - common
 - inventory
 - security
-#  - storage
+- storage
 #  - network/opinetcommon
 #  - network/cloud
 #  - network/evpn-gw
diff --git a/storage/buf.yaml b/storage/buf.yaml
index 68e0534..058452d 100644
--- a/storage/buf.yaml
+++ b/storage/buf.yaml
@@ -1,4 +1,4 @@
-version: v1beta1
+version: v1
 name: buf.build/opiproject/storage
 deps:
 - buf.build/googleapis/googleapis

with this change

diff --git a/storage/v1alpha1/backend_aio.proto b/storage/v1alpha1/backend_aio.proto
index 28beafa..afe1da8 100644
--- a/storage/v1alpha1/backend_aio.proto
+++ b/storage/v1alpha1/backend_aio.proto
@@ -18,7 +18,7 @@ import "google/api/annotations.proto";
 import "google/api/field_behavior.proto";
 import "google/protobuf/field_mask.proto";

-import "opicommon.proto";
+import "v1alpha1/opicommon.proto";
 import "uuid.proto";

 // Back End (network-facing) APIs. This service is for AIO generic kernel block device.
(END)

all seems a bit better