Skip to content

Commit

Permalink
Verify gen-all-sdk-grpc has run
Browse files Browse the repository at this point in the history
Adds a build step to verify that `make gen-all-sdk-grpc` has run.

Credit to @Kalaiselvi84 for original #3310

Sample output:
```
=== Diffing workspace after 'make gen-all-sdk-grpc'
*** Failure: Differences found:
D    sdks/rust/proto/allocation/allocation.proto
D    sdks/rust/proto/googleapis/google/api/annotations.proto
D    sdks/rust/proto/googleapis/google/api/client.proto
D    sdks/rust/proto/googleapis/google/api/field_behavior.proto
D    sdks/rust/proto/googleapis/google/api/http.proto
D    sdks/rust/proto/googleapis/google/api/launch_stage.proto
D    sdks/rust/proto/googleapis/google/api/resource.proto
D    sdks/rust/proto/grpc-gateway/LICENSE.txt
D    sdks/rust/proto/grpc-gateway/protoc-gen-openapiv2/options/annotations.proto
D    sdks/rust/proto/grpc-gateway/protoc-gen-openapiv2/options/openapiv2.proto
D    sdks/rust/proto/sdk/alpha/alpha.proto
D    sdks/rust/proto/sdk/beta/beta.proto
D    sdks/rust/proto/sdk/sdk.proto
```

(Note this sample output was also what happens when I just run this
check on my desktop because the `rust` generation spews files as root.)
  • Loading branch information
zmerlynn committed Aug 25, 2023
1 parent 959abbf commit 423ec21
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,19 @@ sdk-shell-csharp:
sdk-publish-csharp: RELEASE_VERSION ?= $(base_version)
sdk-publish-csharp:
$(MAKE) run-sdk-command-csharp COMMAND=publish VERSION=$(RELEASE_VERSION) DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS) -it"

# difference in sdks before and after gen-all-sdk-grpc target
test-gen-all-sdk-grpc:
make gen-all-sdk-grpc
@echo; \
echo "=== Diffing workspace after 'make gen-all-sdk-grpc'"; \
diff_output=$$(git diff --name-status HEAD -- ../sdks); \
diff_output_test_sdk=$$(git diff --name-status HEAD -- ../test/sdk); \
if [ -z "$$diff_output" ] && [ -z "$$diff_output_test_sdk" ]; then \
echo "+++ Success: No differences found."; \
else \
echo "*** Failure: Differences found:"; \
echo "$$diff_output"; \
echo "$$diff_output_test_sdk"; \
exit 1; \
fi
11 changes: 11 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ steps:
dir: "build"
args: ["ensure-build-sdk-image-base"]

#
# Preventing SDKs failure in CI
#
- name: "make-docker"
id: test-gen-all-sdk-grpc
waitFor:
- ensure-build-sdk-image-base
dir: "build"
args: ["test-gen-all-sdk-grpc"]

#
# Preventing Broken PR Merges in CI
#
Expand All @@ -134,6 +144,7 @@ steps:
waitFor:
- pull-build-image
- test-gen-crd-client
- test-gen-all-sdk-grpc
dir: "build"
args: ["lint"] # pull the build image if it exists

Expand Down

0 comments on commit 423ec21

Please sign in to comment.