enkit

module
v0.0.0-...-5206ba3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause

README

Enkit (engineering toolkit)

Importing into a downstream Bazel workspace

When using enkit in a downstream workspace, there are two options for loading Go dependencies:

  • Call only //bazel:go_repositories%go_repositories from this repo, and use only those dependencies in the downstream repo. This works if Golang binaries only need to be built from this repo and not the downstream repo.

  • Call //bazel:go_repositories%go_repositories after loading Golang dependencies in the downstream repo. This would ensure that:

    1. Go dependencies in the downstream repo obey that repo's go.mod version selection, rather than enkit's, for minimal surprises.

    2. enkit dependencies are loaded, for processes that require a complete dependency graph

    Note that building binaries from enkit loaded in a downstream repo in this manner will not necessarily match those built from this repo directly, as the downstream repo may be loading different versions of enkit's dependencies. This may cause build divergence and/or failures.

Testing

Setting up for tests
Install non-bazel managed dependencies
  1. google-cloud-sdk

    • Install here https://cloud.google.com/sdk/docs/install

      PLEASE NOTE: do not install using snap/brew/apt-get etc., as emulators do not work.

    • Run the following command to get access to the emulators:

      gcloud components install beta
      
    • Add the gcloud binary to the local binaries directory with the following symlink:

      ln -s $(which gcloud) /usr/local/bin
      
  2. Get a service account from <x, Y, Z person>

    • Put it in //astore/testdata/credentials.json
Examples of Running Tests
  • Running a specific go test target

    bazel test //astore:go_default_test
    
  • Running specific test of a test file

    bazel test //astore:go_default_test --test_filter=^TestServer$
    
  • Running Everything

    bazel test //...
    
  • Remove all emulator spawned processes

    Sometimes emulator processes can be left behind after a test run. These can be cleaned up with:

    ps aux | grep gcloud/emulators/datastore | awk '{print $2}' | xargs kill
    
Adding Tests
  1. Create the test in * \_test.go

  2. Run Gazelle:

    bazel run //:gazelle
    
  3. If your test needs server dependencies, such as astore or minio, add the attribute local = True to the test rule.

Directories

Path Synopsis
astore
rpc/astore
Package astore is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package astore is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
server/configs
Package configs is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package configs is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
auth
proto
Package auth is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package auth is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
server/assets
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
server/assets/assets
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
server/assets/credentials
Package credentials is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package credentials is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
server/assets/templates
Package templates is empty here because this package contains only code from generated templates; an empty source file helps satisfy `go get -u ./...`.
Package templates is empty here because this package contains only code from generated templates; an empty source file helps satisfy `go get -u ./...`.
server/credentials
Package credentials is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package credentials is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
bazel
qtc
Package qtc exists to trick the Go tooling into adding required packages to go.mod, so that generating dependencies doesn't continually try to remove these and break the build.
Package qtc exists to trick the Go tooling into adding required packages to go.mod, so that generating dependencies doesn't continually try to remove these and break the build.
bestie
proto
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
cmd
machinecert
Package machinecert provides the machine-cert subcommands to enkit.
Package machinecert provides the machine-cert subcommands to enkit.
proto
Package auth is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package auth is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
experimental
nomad_resource_plugin/licensedevice/cmd/nomad_license_plugin
Follows example main: https://github.com/hashicorp/nomad-skeleton-device-plugin/blob/31e2e063e167ed4bdbba787b659fac75d4bce659/main.go
Follows example main: https://github.com/hashicorp/nomad-skeleton-device-plugin/blob/31e2e063e167ed4bdbba787b659fac75d4bce659/main.go
remote_apis_build_demo
remote_apis_build_demo demonstrates that we're able to build against: * google bytestream protos * bazel remote-apis protos * buildbarn libraries (bb-storage, bb-remote-execution)
remote_apis_build_demo demonstrates that we're able to build against: * google bytestream protos * bazel remote-apis protos * buildbarn libraries (bb-storage, bb-remote-execution)
flextape
frontend
Package frontend provides some server-side generated HTML for viewing Flextape state.
Package frontend provides some server-side generated HTML for viewing Flextape state.
proto
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
infra
k8s_dummy
Webserver that exposes metrics for testing k8s setups
Webserver that exposes metrics for testing k8s setups
assets
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
lib
bazel
Package bazel provides functions and types for interacting with a bazel workspace.
Package bazel provides functions and types for interacting with a bazel workspace.
bazel/proto
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
bes
config
Simple abstractions to read and write configuration parameters by name.
Simple abstractions to read and write configuration parameters by name.
config/datastore
Package datastore provides a Store capable of storing configs on datastore.
Package datastore provides a Store capable of storing configs on datastore.
config/defcon
Returns the default config store used in the enkit repository.
Returns the default config store used in the enkit repository.
config/directory
Config loaders to read/write files in directories.
Config loaders to read/write files in directories.
config/identity
Utility functions to load, process, and store identity tokens in a config store.
Utility functions to load, process, and store identity tokens in a config store.
config/marshal
Generic marshalling and unmarshalling interfaces.
Generic marshalling and unmarshalling interfaces.
config/remote
A config Store able to load and store configs via simple HTTP requests.
A config Store able to load and store configs via simple HTTP requests.
git
gmap
Package gmap provides generic functions over maps.
Package gmap provides generic functions over maps.
kcerts
+build linux
+build linux
khttp/kcookie
Collection of utilities to more easily compose cookies.
Collection of utilities to more easily compose cookies.
knetwork/echo
+build !release
+build !release
oauth/cookie
Collection of utilities to more easily compose cookies.
Collection of utilities to more easily compose cookies.
oauth/providers
Package providers provides functions to configure and use the providers supported out of the box by the enkit oauth library: google and github.
Package providers provides functions to configure and use the providers supported out of the box by the enkit oauth library: google and github.
proto/delimited
Package delimited allows for reading of a stream of protobuf messages delimited by size.
Package delimited allows for reading of a stream of protobuf messages delimited by size.
retry
A simple library to safely retry operations.
A simple library to safely retry operations.
srand
A thread safe cryptographically secure random number generator.
A thread safe cryptographically secure random number generator.
str
token
Package token provides primitives to create and decode cryptographic tokens.
Package token provides primitives to create and decode cryptographic tokens.
cmd
machine/assets
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package assets is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
rpc
Package rpc is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package rpc is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
amux
Many of the enproxy libraries require an http.Mux to work.
Many of the enproxy libraries require an http.Mux to work.
amux/amuxie
Interface adapter to make a "muxie" (from https://github.com/kataras/muxie) comformant to the "github.com/enfabrica/enkit/proxy/amux" interface.
Interface adapter to make a "muxie" (from https://github.com/kataras/muxie) comformant to the "github.com/enfabrica/enkit/proxy/amux" interface.
credentials
Package credentials is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
Package credentials is empty here because this package contains only embedded assets; having a source file here helps `go get -u ./...` to not error.
enfuse/rpc
Package rpc is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package rpc is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
enproxy
Package enproxy provides a complete proxy implementation with support for HTTP, HTTP/2, and NASSH, with OAUTH authentication, all in a simple API to use.
Package enproxy provides a complete proxy implementation with support for HTTP, HTTP/2, and NASSH, with OAUTH authentication, all in a simple API to use.
shims
third_party
bazel/buildeventstream
Package buildeventstream is actually satisfied by generated code from //third_party/bazel/src/main/java/com/google/devtools/build/lib/buildeventstream/proto; this empty package helps satisfy `go get -u ./...`.
Package buildeventstream is actually satisfied by generated code from //third_party/bazel/src/main/java/com/google/devtools/build/lib/buildeventstream/proto; this empty package helps satisfy `go get -u ./...`.
buildbuddy/proto
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.
Package proto is empty here because this package is generated solely from protobuf; having a source file here helps `go get -u ./...` to not error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL