-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using buf to manage protobuf code (#641)
This required some rework around code generation (e.g. we use enumer to generate strings out of enums, enumer is part of grafana-build-tools, so that required some adjusting to work correctly). Because of the above, this is adding a `scripts/docker-run` script that is used to run tools from grafana-build-tools consistenly. Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
- Loading branch information
Showing
20 changed files
with
704 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is used by the makefile in order to obtain the version of the | ||
# Grafana Build Tools image to use. This is *also* used by scripts/docker-run | ||
# to obtain the same information. That means this file must be both a Makefile | ||
# and a shell script. This is achieved by using the `VAR=value` syntax, which | ||
# is valid in both Makefile and shell. | ||
|
||
GBT_IMAGE=ghcr.io/grafana/grafana-build-tools:v0.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: v1 | ||
plugins: | ||
- name: gogofast | ||
out: . | ||
opt: | ||
- plugins=grpc | ||
- paths=source_relative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Generated by buf. DO NOT EDIT. | ||
version: v1 | ||
deps: | ||
- remote: buf.build | ||
owner: gogo | ||
repository: protobuf | ||
commit: 5461a3dfa9d941da82028ab185dc2a0e | ||
digest: shake256:37c7c75224982038cb1abf45b481ef06716c1f806ffaa162018d0df092bd11a2a9b62c2d0dc0a2ae43beff86b6014fc0eb8c594ffd84d52ade4b08fca901eadc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: v1 | ||
name: buf.build/grafana/synthetic-monitoring-agent | ||
breaking: | ||
use: | ||
- FILE | ||
lint: | ||
use: | ||
- DEFAULT | ||
deps: | ||
- buf.build/gogo/protobuf | ||
|
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
# This is a fallback value; the actual value should be passed in the environment. | ||
CGO_ENABLED=${CGO_ENABLED:-0} | ||
|
||
if test -z "${ROOTDIR}" ; then | ||
ROOTDIR=$(dirname "$(go env GOMOD)") | ||
if test -z "${ROOTDIR}" ; then | ||
ROOTDIR=$(git rev-parse --show-toplevel) | ||
fi | ||
ROOTDIR=$(realpath -m "${ROOTDIR}") | ||
fi | ||
|
||
. "${ROOTDIR}/.gbt.mk" | ||
|
||
if test -z "${GOPATH}" ; then | ||
GOPATH=$(go env GOPATH) | ||
fi | ||
|
||
if test -z "${GOMODCACHE}" ; then | ||
GOMODCACHE=$(go env GOMODCACHE) | ||
fi | ||
|
||
if test -z "${CI}" ; then | ||
CI=false | ||
fi | ||
|
||
if test -z "${GOOS}" ; then | ||
GOOS=$(go env GOOS) | ||
fi | ||
|
||
if test -z "${GOARCH}" ; then | ||
GOARCH=$(go env GOARCH) | ||
fi | ||
|
||
exec docker run \ | ||
--rm \ | ||
--user "$(id -u):$(id -g)" \ | ||
--volume "${ROOTDIR}:${ROOTDIR}" \ | ||
--volume "${HOME}/.cache:/.cache" \ | ||
--volume "${GOPATH}:/go" \ | ||
--volume "${GOMODCACHE}:/go/pkg/mod" \ | ||
--workdir "${PWD}" \ | ||
--env CI="${CI}" \ | ||
--env CGO_ENABLED="${CGO_ENABLED}" \ | ||
--env GOOS="${GOOS}" \ | ||
--env GOARCH="${GOARCH}" \ | ||
"${GBT_IMAGE}" \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if command -v enumer > /dev/null 2>&1 ; then | ||
exec enumer "$@" | ||
fi | ||
|
||
if test -z "${ROOTDIR}" ; then | ||
ROOTDIR=$(dirname "$(go env GOMOD)") | ||
if test -z "${ROOTDIR}" ; then | ||
ROOTDIR=$(git rev-parse --show-toplevel) | ||
fi | ||
ROOTDIR=$(realpath -m "${ROOTDIR}") | ||
fi | ||
|
||
"${ROOTDIR}/scripts/docker-run" enumer "$@" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters