mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-25 07:29:38 -05:00
bazel: add buf as protobuf formatter to //:tidy (#1511)
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
55067b12cd
commit
e7fc541a57
@ -236,6 +236,27 @@ sh_template(
|
|||||||
template = "golangci.sh.in",
|
template = "golangci.sh.in",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "com_github_bufbuild_buf",
|
||||||
|
actual = select({
|
||||||
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_bufbuild_buf_darwin_amd64//:bin/buf",
|
||||||
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_bufbuild_buf_darwin_arm64//:bin/buf",
|
||||||
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_bufbuild_buf_linux_amd64//:bin/buf",
|
||||||
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_bufbuild_buf_linux_arm64//:bin/buf",
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
sh_template(
|
||||||
|
name = "buf_fmt",
|
||||||
|
data = [
|
||||||
|
":com_github_bufbuild_buf",
|
||||||
|
],
|
||||||
|
substitutions = {
|
||||||
|
"@@BUF@@": "$(rootpath :com_github_bufbuild_buf)",
|
||||||
|
},
|
||||||
|
template = "buf.sh.in",
|
||||||
|
)
|
||||||
|
|
||||||
multirun(
|
multirun(
|
||||||
name = "tidy",
|
name = "tidy",
|
||||||
commands = [
|
commands = [
|
||||||
@ -246,6 +267,7 @@ multirun(
|
|||||||
":gazelle_generate",
|
":gazelle_generate",
|
||||||
":buildifier_fix",
|
":buildifier_fix",
|
||||||
":terraform_fmt",
|
":terraform_fmt",
|
||||||
|
":buf_fmt",
|
||||||
],
|
],
|
||||||
jobs = 1, # execute sequentially
|
jobs = 1, # execute sequentially
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
25
bazel/ci/buf.sh.in
Normal file
25
bazel/ci/buf.sh.in
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
lib=$(realpath @@BASE_LIB@@) || exit 1
|
||||||
|
buf=$(realpath @@BUF@@) || exit 1
|
||||||
|
|
||||||
|
# shellcheck source=../sh/lib.bash
|
||||||
|
if ! source "${lib}"; then
|
||||||
|
echo "Error: could not find import"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${BUILD_WORKSPACE_DIRECTORY}" || exit 1
|
||||||
|
|
||||||
|
readarray -t <<< "$(find "$(pwd)" -type f -name "*.proto")"
|
||||||
|
protos=("${MAPFILE[@]}")
|
||||||
|
|
||||||
|
statuscode=0
|
||||||
|
|
||||||
|
echo "Formatting the following protobuf files with buf:"
|
||||||
|
for proto in "${protos[@]}"; do
|
||||||
|
echo " ${proto}"
|
||||||
|
${buf} format -w "${proto}" || statuscode=$?
|
||||||
|
done
|
||||||
|
|
||||||
|
exit "${statuscode}"
|
@ -10,6 +10,7 @@ def ci_deps():
|
|||||||
_gofumpt_deps()
|
_gofumpt_deps()
|
||||||
_tfsec_deps()
|
_tfsec_deps()
|
||||||
_golangci_lint_deps()
|
_golangci_lint_deps()
|
||||||
|
_buf_deps()
|
||||||
|
|
||||||
def _shellcheck_deps():
|
def _shellcheck_deps():
|
||||||
http_archive(
|
http_archive(
|
||||||
@ -213,3 +214,33 @@ def _golangci_lint_deps():
|
|||||||
strip_prefix = "golangci-lint-1.51.2-darwin-arm64",
|
strip_prefix = "golangci-lint-1.51.2-darwin-arm64",
|
||||||
sha256 = "36e69882205a0e42a63ad57ec3015639c11051e03f0beb9cf7949c6451408960",
|
sha256 = "36e69882205a0e42a63ad57ec3015639c11051e03f0beb9cf7949c6451408960",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _buf_deps():
|
||||||
|
http_archive(
|
||||||
|
name = "com_github_bufbuild_buf_linux_amd64",
|
||||||
|
sha256 = "39b58126938e265a7dd60fc4716a4a43931896e62db3d69c704d7dd63d5889dd",
|
||||||
|
url = "https://github.com/bufbuild/buf/releases/download/v1.15.1/buf-Linux-x86_64.tar.gz",
|
||||||
|
strip_prefix = "buf",
|
||||||
|
build_file_content = """exports_files(["bin/buf"], visibility = ["//visibility:public"])""",
|
||||||
|
)
|
||||||
|
http_archive(
|
||||||
|
name = "com_github_bufbuild_buf_linux_aarch64",
|
||||||
|
sha256 = "6c1e7258b79273c60085df8825a52a5ee306530e7327942c91ec84545cd2d40a",
|
||||||
|
url = "https://github.com/bufbuild/buf/releases/download/v1.15.1/buf-Linux-aarch64.tar.gz",
|
||||||
|
strip_prefix = "buf",
|
||||||
|
build_file_content = """exports_files(["bin/buf"], visibility = ["//visibility:public"])""",
|
||||||
|
)
|
||||||
|
http_archive(
|
||||||
|
name = "com_github_bufbuild_buf_darwin_amd64",
|
||||||
|
sha256 = "6c1e7258b79273c60085df8825a52a5ee306530e7327942c91ec84545cd2d40a",
|
||||||
|
url = "https://github.com/bufbuild/buf/releases/download/v1.15.1/buf-Darwin-x86_64.tar.gz",
|
||||||
|
strip_prefix = "buf",
|
||||||
|
build_file_content = """exports_files(["bin/buf"], visibility = ["//visibility:public"])""",
|
||||||
|
)
|
||||||
|
http_archive(
|
||||||
|
name = "com_github_bufbuild_buf_darwin_arm64",
|
||||||
|
sha256 = "6c1e7258b79273c60085df8825a52a5ee306530e7327942c91ec84545cd2d40a",
|
||||||
|
url = "https://github.com/bufbuild/buf/releases/download/v1.15.1/buf-Darwin-arm64.tar.gz",
|
||||||
|
strip_prefix = "buf",
|
||||||
|
build_file_content = """exports_files(["bin/buf"], visibility = ["//visibility:public"])""",
|
||||||
|
)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
option go_package = "github.com/edgelesssys/constellation/v2/debugd/service";
|
|
||||||
|
|
||||||
package debugd;
|
package debugd;
|
||||||
|
|
||||||
|
option go_package = "github.com/edgelesssys/constellation/v2/debugd/service";
|
||||||
|
|
||||||
service Debugd {
|
service Debugd {
|
||||||
rpc SetInfo(SetInfoRequest) returns (SetInfoResponse) {}
|
rpc SetInfo(SetInfoRequest) returns (SetInfoResponse) {}
|
||||||
rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) {}
|
rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) {}
|
||||||
|
@ -11,7 +11,6 @@ service API {
|
|||||||
rpc IssueRejoinTicket(IssueRejoinTicketRequest) returns (IssueRejoinTicketResponse);
|
rpc IssueRejoinTicket(IssueRejoinTicketRequest) returns (IssueRejoinTicketResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message IssueJoinTicketRequest {
|
message IssueJoinTicketRequest {
|
||||||
// disk_uuid is the UUID of a node's state disk.
|
// disk_uuid is the UUID of a node's state disk.
|
||||||
string disk_uuid = 1;
|
string disk_uuid = 1;
|
||||||
|
@ -14,5 +14,4 @@ message ExecuteUpdateRequest {
|
|||||||
string wanted_kubernetes_version = 3;
|
string wanted_kubernetes_version = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ExecuteUpdateResponse {
|
message ExecuteUpdateResponse {}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user