diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-10-20 11:24:40 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-10-20 11:24:40 +0300 |
commit | f27e27f915c42b5a921b504501944615b10938ee (patch) | |
tree | 5a91959d7086af235fad1a47a5474ff550e68c06 | |
parent | ebcf168f6704fbfede1ce6512d3390eb285a6912 (diff) |
Makefile: Fix race that causes us to miss Protobuf changes
The `check-proto` target gets executed as part of the `verify`
target by our CI to assert that code generated from our Protobuf
definitions matches the committed code and that it passes our linting
rules. But the former part to check for changes is racy: `check-proto`
depends on both `proto` and `no-proto-changes` in order to first
regenerate files and then check for changes. But if make(1) is executed
with multiple jobs these can run in parallel as `no-proto-changes` does
not depend on `proto`. Because executing git-diff(1) is faster than
generating the code the end result is that we don't ever notice
out-of-date code.
Fix this error by fixing the dependency chain so that `no-proto-changes`
depends on `proto`.
-rw-r--r-- | Makefile | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -497,7 +497,7 @@ proto: ${PROTOC} ${PROTOC_GEN_GO} ${PROTOC_GEN_GO_GRPC} ${PROTOC_GEN_GITALY_PROT ${PROTOC} ${SHARED_PROTOC_OPTS} -I ${SOURCE_DIR}/proto -I ${SOURCE_DIR}/tools -I ${PROTOC_INSTALL_DIR}/include --go_out=${SOURCE_DIR}/tools --go-grpc_out=${SOURCE_DIR}/tools ${SOURCE_DIR}/tools/protoc-gen-gitaly-lint/testdata/*.proto .PHONY: check-proto -check-proto: proto no-proto-changes lint-proto +check-proto: no-proto-changes lint-proto .PHONY: lint-proto lint-proto: ${PROTOC} ${PROTOLINT} ${PROTOC_GEN_GITALY_LINT} @@ -509,7 +509,7 @@ no-changes: ${Q}${GIT} diff --exit-code .PHONY: no-proto-changes -no-proto-changes: | ${BUILD_DIR} +no-proto-changes: proto | ${BUILD_DIR} ${Q}${GIT} diff --exit-code -- '*.pb.go' 'ruby/proto/gitaly' .PHONY: dump-database-schema |