Skip to content

Commit

Permalink
Merge pull request #1 from openconfig/hines
Browse files Browse the repository at this point in the history
add bootz proto
  • Loading branch information
marcushines committed May 30, 2023
2 parents 77dd3d0 0d91289 commit 6b8768f
Show file tree
Hide file tree
Showing 12 changed files with 2,246 additions and 19 deletions.
59 changes: 59 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 1,59 @@
---
###########################################
# These are the rules used for #
# linting all the yaml files in the stack #
# NOTE: #
# You can disable line with: #
# # yamllint disable-line #
###########################################
rules:
braces:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
brackets:
level: warning
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 1
max-spaces-inside-empty: 5
colons:
level: warning
max-spaces-before: 0
max-spaces-after: 1
commas:
level: warning
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments: disable
comments-indentation: disable
document-end: disable
document-start:
level: warning
present: true
empty-lines:
level: warning
max: 2
max-start: 0
max-end: 0
hyphens:
level: warning
max-spaces-after: 1
indentation:
level: warning
spaces: consistent
indent-sequences: true
check-multi-line-strings: false
key-duplicates: enable
line-length:
level: warning
max: 120
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
43 changes: 43 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 1,43 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
name: Lint Code Base

on:
push:
branches: [main]
# Remove the line above to run when pushing to master
pull_request:
branches: [main]

jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter/slim@v5
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_HTML: false
VALIDATE_JSCPD: false
VALIDATE_GO: false
IGNORE_GENERATED_FILES: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 2 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 1,6 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
.vscode/
bazel-*

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
5 changes: 5 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
load("@bazel_gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/openconfig/gnsi
gazelle(name = "gazelle")

265 changes: 263 additions & 2 deletions README.md

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 1,99 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

### Bazel rules for many languages to compile PROTO into gRPC libraries
# Note: any version of this which is less than 4.3.0 requires bazel version 5.4.0 (set in .bazelversion file)
http_archive(
name = "rules_proto_grpc",
sha256 = "fb7fc7a3c19a92b2f15ed7c4ffb2983e956625c1436f57a3430b897ba9864059",
strip_prefix = "rules_proto_grpc-4.3.0",
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/4.3.0.tar.gz"],
)

# googleapis has not had a release since 2016 - take the master version as of 4-jan-23
http_archive(
name = "com_google_googleapis",
sha256 = "9fc03150d86501d7da35eefa989d5553bdd77a95cfe4373cdafe8eee92f6bfb1",
strip_prefix = "googleapis-870a5ed7e141b4faf70e2a0858854e9b5bb18612",
urls = ["https://github.com/googleapis/googleapis/archive/870a5ed7e141b4faf70e2a0858854e9b5bb18612.tar.gz"],
)

load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
switched_rules_by_language(
name = "com_google_googleapis_imports",
cc = True,
go = True,
)

load(
"@rules_proto_grpc//:repositories.bzl",
"bazel_gazelle",
"io_bazel_rules_go",
"rules_proto_grpc_repos",
"rules_proto_grpc_toolchains",
)

rules_proto_grpc_toolchains()

rules_proto_grpc_repos()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

### Golang
io_bazel_rules_go()

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(go_version = "1.18")

# gazelle:repo bazel_gazelle
bazel_gazelle()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

go_repository(
name = "com_github_openconfig_gnoi",
build_directives = [
"gazelle:proto_import_prefix github.com/openconfig/gnoi",
],
build_file_generation = "on",
importpath = "github.com/openconfig/gnoi",
sum = "h1:7Odq6UyieHuXW3PYfDBj/dUWgFrL9KVMm0iooQoFLdw=",
version = "v0.1.0",
)

go_repository(
name = "com_github_openconfig_gnmi",
build_directives = [
"gazelle:proto_import_prefix github.com/openconfig/gnmi",
],
build_file_generation = "on",
importpath = "github.com/openconfig/gnmi",
sum = "h1:hVOdLTaRjdy68oCGJbkf2vrmnUoQ5xbINqBOAMix4xM=",
version = "v0.9.1",
)

go_repository(
name = "com_github_openconfig_gnsi",
importpath = "github.com/openconfig/gnsi",
sum = "h1:CfJsd2V3ElPPtp3eAEExsShKy86Ar20hPL0rhlTp0l0=",
version = "v0.2.1",
)

load("@rules_proto_grpc//go:repositories.bzl", rules_proto_grpc_go_repos = "go_repos")

rules_proto_grpc_go_repos()

# Load gazelle_dependencies last, so that the newer version of org_golang_google_grpc is used.
# see https://github.com/rules-proto-grpc/rules_proto_grpc/issues/160
gazelle_dependencies()


load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()
28 changes: 28 additions & 0 deletions common.bzl
Original file line number Diff line number Diff line change
@@ -0,0 1,28 @@
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler")
load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "PROTO_RUNTIME_DEPS", "WELL_KNOWN_TYPES_APIV2")

def use_new_compilers():
go_proto_compiler(
name = "go_protoc_gen_go",
options = [
"paths=source_relative",
],
plugin = "@org_golang_google_protobuf//cmd/protoc-gen-go",
suffix = ".pb.go",
visibility = ["//visibility:public"],
deps = PROTO_RUNTIME_DEPS WELL_KNOWN_TYPES_APIV2,
)
go_proto_compiler(
name = "go_protoc_gen_go_grpc",
options = [
"paths=source_relative",
],
plugin = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc",
suffix = "_grpc.pb.go",
visibility = ["//visibility:public"],
deps = PROTO_RUNTIME_DEPS [
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
],
)
47 changes: 47 additions & 0 deletions proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 1,47 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:common.bzl", "use_new_compilers")

package(default_visibility = ["//visibility:public"])

use_new_compilers()

proto_library(
name = "bootz_proto",
srcs = ["bootz.proto"],
import_prefix = "github.com/openconfig/bootz",
deps = [
"@com_google_protobuf//:struct_proto",
"@com_github_openconfig_gnsi//authz:authz_proto",
"@com_github_openconfig_gnsi//certz:certz_proto",
"@com_github_openconfig_gnsi//credentialz:credentialz_proto",
"@com_github_openconfig_gnsi//pathz:pathz_proto",
],
)

##############################################################################
# Go
##############################################################################

go_proto_library(
name = "bootz_go_proto",
compilers = [
"go_protoc_gen_go",
"go_protoc_gen_go_grpc",
],
importpath = "github.com/openconfig/bootz/proto/bootz",
proto = ":bootz_proto",
deps = [
"@com_github_openconfig_gnsi//authz:authz_go_proto",
"@com_github_openconfig_gnsi//certz:certz_go_proto",
"@com_github_openconfig_gnsi//credentialz:credentialz_go_proto",
"@com_github_openconfig_gnsi//pathz:pathz_go_proto",
],
)

go_library(
name = "bootz",
embed = [":bootz_go_proto"],
importpath = "github.com/openconfig/bootz/proto/bootz",
)
Loading

0 comments on commit 6b8768f

Please sign in to comment.