github.com/m3db/m3@v1.5.0/src/dbnode/generated/thrift/generate.sh (about)

     1  #!/bin/bash
     2  
     3  # paranoia, ftw
     4  set -e
     5  
     6  # ensure docker is running
     7  docker run --rm hello-world >/dev/null
     8  
     9  # generate files using dockerized thrift-gen
    10  THRIFT_IMAGE_VERSION=${THRIFT_IMAGE_VERSION:-"quay.io/m3db/thrift-gen:0.1.0"}
    11  echo "Generating thrift files with image: $THRIFT_IMAGE_VERSION"
    12  
    13  UID_FLAGS="-u $(id -u)"
    14  if [[ -n "$BUILDKITE" ]]; then
    15  	UID_FLAGS="-u root"
    16  fi
    17  
    18  docker run --rm -v "$(pwd):/data" $UID_FLAGS    \
    19    "$THRIFT_IMAGE_VERSION" --generateThrift      \
    20    --inputFile /data/rpc.thrift --outputDir /data
    21  
    22  # ensure formatting is correct
    23  go fmt github.com/m3db/m3/src/dbnode/generated/thrift/rpc