From 1da741b0cc895b6f46bdfd7ccf044a6bd8329bb8 Mon Sep 17 00:00:00 2001 From: Nick Vigilante Date: Tue, 11 Oct 2022 11:04:33 -0400 Subject: [PATCH] diagrams: Diagrams job no longer fails when no diagrams change If there are PRs that don't affect the diagrams or their related files, the Publish SQL Grammar Diagrams job will fail, because `git commit` produces a non-zero exit code if there are no files changed in the working directory. This fixes that problem. Release note: None Fixes DOC-5642 --- build/teamcity-diagram-generation.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/teamcity-diagram-generation.sh b/build/teamcity-diagram-generation.sh index d8d9eee29180..918f533d987b 100644 --- a/build/teamcity-diagram-generation.sh +++ b/build/teamcity-diagram-generation.sh @@ -34,6 +34,14 @@ tc_end_block "Generate Diagrams" tc_start_block "Push Diagrams to Git" cd generated-diagrams +changed_diagrams=$(git status --porcelain) +if [ -z "$changed_diagrams" ] +then + echo "No diagrams changed. Exiting." + tc_end_block "Push Diagrams to Git" + exit 0 +fi + git add . git commit -m "Snapshot $cockroach_ref"