From 321bb69edac1eaa1a8630352d08b2a69db9bcd3f Mon Sep 17 00:00:00 2001 From: Sam Arnold Date: Mon, 19 Jul 2021 16:18:59 -0400 Subject: [PATCH] fix: run codegen during build --- CHANGELOG.md | 1 + Dockerfile_build_ubuntu64 | 1 + build.py | 8 ++++++++ generate.sh | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100755 generate.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 25c540b524f..5463e73f20b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [#21707](https://github.com/influxdata/influxdb/pull/21707): chore: add logging to compaction - [#21752](https://github.com/influxdata/influxdb/pull/21752): feat: add total-buffer-bytes config parameter to subscriptions - [#21820](https://github.com/influxdata/influxdb/pull/21820): chore: update flux to v0.120.1 +- [#21882](https://github.com/influxdata/influxdb/pull/21882): chore: update protobuf library versions and remove influx_tsm ### Bugfixes diff --git a/Dockerfile_build_ubuntu64 b/Dockerfile_build_ubuntu64 index 6da38a8d63e..a089709edea 100644 --- a/Dockerfile_build_ubuntu64 +++ b/Dockerfile_build_ubuntu64 @@ -11,6 +11,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ make \ mercurial \ pkg-config \ + protobuf-compiler \ python \ python3-pip \ python3 \ diff --git a/build.py b/build.py index a65ec77d976..d79758f7015 100755 --- a/build.py +++ b/build.py @@ -189,6 +189,14 @@ def run_tests(race, parallel, timeout, no_vet, junit=False): logging.error("Code not formatted. Please use 'goimports -w ./' to fix formatting errors.") logging.error("{}".format(out)) return False + + logging.info("Ensuring codegen is up to date ...") + out = run("./generate.sh") + if len(out) > 0: + logging.error("Please use 'go generate ./...' to regenerate generated code.") + logging.error("{}".format(out)) + return False + if not no_vet: logging.info("Running 'go vet'...") out = run(go_vet_command) diff --git a/generate.sh b/generate.sh new file mode 100755 index 00000000000..98c34265a0e --- /dev/null +++ b/generate.sh @@ -0,0 +1,18 @@ +#!/bin/bash -e + +go install github.com/gogo/protobuf/protoc-gen-gogofaster + +function check_changes () { + changes="$(git status --porcelain=v1 2>/dev/null)" + if [ -n "$changes" ] ; then + echo $1 + echo "$changes" + exit 1 + fi +} + +check_changes "git is dirty before running generate!" + +go generate ./... + +check_changes "git is dirty after running generate!"