download_milvus_proto.sh 898 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. SCRIPTS_DIR=$(dirname "$0")
  3. THIRD_PARTY_DIR=$SCRIPTS_DIR/../cmake_build/thirdparty
  4. API_VERSION=$(go list -m github.com/milvus-io/milvus-proto/go-api/v2 | awk -F' ' '{print $2}')
  5. if [ ! -d "$THIRD_PARTY_DIR/milvus-proto" ]; then
  6. mkdir -p $THIRD_PARTY_DIR
  7. pushd $THIRD_PARTY_DIR
  8. git clone https://github.com/milvus-io/milvus-proto.git
  9. cd milvus-proto
  10. # try tagged version first
  11. COMMIT_ID=$(git ls-remote https://github.com/milvus-io/milvus-proto.git refs/tags/${API_VERSION} | cut -f 1)
  12. if [[ -z $COMMIT_ID ]]; then
  13. # parse commit from pseudo version (eg v0.0.0-20230608062631-c453ef1b870a => c453ef1b870a)
  14. COMMIT_ID=$(echo $API_VERSION | awk -F'-' '{print $3}')
  15. fi
  16. echo "version: $API_VERSION, commitID: $COMMIT_ID"
  17. if [ -z $COMMIT_ID ]; then
  18. git checkout -b $API_VERSION $API_VERSION
  19. else
  20. git reset --hard $COMMIT_ID
  21. fi
  22. popd
  23. fi