Skip to content

Commit

Permalink
Adds generated go client for oci-catalog that we'll use from syncer. (#…
Browse files Browse the repository at this point in the history
…6618)

### Description of the change

Follows on from #6595, updates the proto service files according to
buf's lint, and generates the go client for use in the asset-syncer.

Note: I added a separate `buf.yaml` and `buf.gen.yaml` for the
oci-catalog service as buf doesn't let you refer to a proto outside of
the `buf.yaml` root, so the other option would have been to move our
existing `buf.yaml` and `buf.generate` into the Kubeapps root directory.
I don't mind either way, but it made more sense to me for the
oci-catalog service to have its own so that it is independent (it may be
useful outside of Kubeapps, theoretically).

### Benefits

The next PR can use the client without being cluttered by the extra
diff.

### Applicable issues

<!-- Enter any applicable Issues here (You can reference an issue using
#) -->

- ref: #6263

---------

Signed-off-by: Michael Nelson <minelson@vmware.com>
  • Loading branch information
absoludity authored Aug 15, 2023
1 parent eabf59c commit aab5a8c
Show file tree
Hide file tree
Showing 12 changed files with 825 additions and 45 deletions.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,13 @@ lint:
./script/linters/yaml-linter.sh
./script/linters/golang-linter.sh

.PHONY: default all test-all test test-dashboard fmt vet lint install-tools
buf-generate:
cd cmd/kubeapps-apis && buf generate
cd cmd/oci-catalog && buf generate
cd dashboard && yarn prettier

buf-mod-update:
buf mod update cmd/kubeapps-apis
buf mod update cmd/oci-catalog

.PHONY: default all buf-generate buf-mod-update test-all test test-dashboard fmt vet lint install-tools
14 changes: 14 additions & 0 deletions cmd/oci-catalog/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2021-2023 the Kubeapps contributors.
# SPDX-License-Identifier: Apache-2.0

---
version: v1beta1
plugins:
- name: go
out: gen
opt:
- module=github.com/vmware-tanzu/kubeapps/cmd/oci-catalog/gen
- name: go-grpc
out: gen
opt:
- module=github.com/vmware-tanzu/kubeapps/cmd/oci-catalog/gen
2 changes: 2 additions & 0 deletions cmd/oci-catalog/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by buf. DO NOT EDIT.
version: v1
15 changes: 15 additions & 0 deletions cmd/oci-catalog/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 the Kubeapps contributors.
# SPDX-License-Identifier: Apache-2.0

---
version: v1beta1
name: "buf.build/kubeapps/oci-catalog"
build:
roots:
- proto
lint:
use:
- DEFAULT
ignore_only:
RPC_RESPONSE_STANDARD_NAME:
- ocicatalog/v1alpha1/ocicatalog.proto
2 changes: 1 addition & 1 deletion cmd/oci-catalog/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::env;

fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::compile_protos("proto/ocicatalog.proto")?;
tonic_build::compile_protos("proto/ocicatalog/v1alpha1/ocicatalog.proto")?;

// If the binary is built with the ENV var "OCI_CATALOG_VERSION",
// the value will be available at buildime. Otherwise, it becomes "devel"
Expand Down
Loading

0 comments on commit aab5a8c

Please sign in to comment.