diff --git a/build/teamcity-diagram-generation.sh b/build/teamcity-diagram-generation.sh index bc1f4856e077..9b1e530f8e6b 100644 --- a/build/teamcity-diagram-generation.sh +++ b/build/teamcity-diagram-generation.sh @@ -41,16 +41,20 @@ 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 +if [ -z "$changed_diagrams" ]; then + if [ "$TC_BUILD_BRANCH" = "master" ]; then + echo "No diagrams changed and on master branch. Exiting." + tc_end_block "Push Diagrams to Git" + exit 0 + else + echo "No diagrams changed, but creating branch $TC_BUILD_BRANCH anyway." + git commit --allow-empty -m "Empty commit to create branch $TC_BUILD_BRANCH for reference $cockroach_ref.This empty commit is required to ensure the branch exists in the remote repository even when there are no diagram changes. This helps maintain branch consistency with cockroach repo to ensure clean release note generation process " + fi +else + git add . + git commit -m "Snapshot $cockroach_ref" fi -git add . -git commit -m "Snapshot $cockroach_ref" - github_ssh_key="${PRIVATE_DEPLOY_KEY_FOR_GENERATED_DIAGRAMS}" configure_git_ssh_key