Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Improve build.sh to check the running directory and some other UX improvement
天舟4163874149d5
diff --git a/build.sh b/build.shindex cac7fa9685..a944d0f557 100755--- a/build.sh+++ b/build.sh@@ -1,18 +1,26 @@#!/bin/sh+# cd to the root directory and run+# ./build.sh+# exit when any command failsset -eRED='\033[0;31m'+GREEN='\033[0;32m'NC='\033[0m' # No Color-goversion=`go version | { read _ _ v _; echo ${v#go}; }`+OUTPUT_BINARY=$( cd bytebase-build &> /dev/null && pwd )/bytebase-echo ${goversion}+if [[ `dirname "${BASH_SOURCE[0]}"` != "." ]]+then+ echo "${RED}Precheck failed.${NC} Build script must run from Bytebase root directory ${SCRIPT_DIR}"; exit 1;+fi-if [[ "${goversion}" < "1.16" ]];+GO_VERSION=`go version | { read _ _ v _; echo ${v#go}; }`+if [[ "${GO_VERSION}" < "1.16" ]];then- echo "${RED}Precheck failed.${NC} Require go version >= 1.16. Current version ${goversion}."; exit 1;+ echo "${RED}Precheck failed.${NC} Require go version >= 1.16. Current version ${GO_VERSION}."; exit 1;fiif ! command -v npm &> /dev/null@@ -20,12 +28,12 @@ thenecho "${RED}Precheck failed.${NC} npm is not installed."; exit 1;fi-version=`cat ./VERSION`-# Step 1 - Build the frontend release version into the backend/server/dist folder# Step 2 - Build the monolithic app by building backend release version together with the backend/server/dist (leveraing embed introduced in Golang 1.16).-echo "Start building Bytebase monolithic ${version}..."+VERSION=`cat ./VERSION`+echo "Start building Bytebase monolithic ${VERSION}..."+echo ""echo "Step 1 - building bytebase frontend..."if command -v yarn &> /dev/null@@ -37,18 +45,29 @@ fiecho "Completed building bytebase frontend."-+echo ""echo "Step 2 - building bytebase backend..."-flags="-X 'github.com/bytebase/bytebase/bin/server/cmd.version=${version}'+flags="-X 'github.com/bytebase/bytebase/bin/server/cmd.version=${VERSION}'-X 'github.com/bytebase/bytebase/bin/server/cmd.goversion=$(go version)'-X 'github.com/bytebase/bytebase/bin/server/cmd.gitcommit=$(git rev-parse HEAD)'-X 'github.com/bytebase/bytebase/bin/server/cmd.buildtime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")'-X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=$(id -u -n)'"# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information-go build -ldflags "-w -s $flags" -o ./bytebase-build/bytebase ./bin/server/main.go+go build -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./bin/server/main.goecho "Completed building bytebase backend."-echo "Completed building Bytebase monolithic ${version}."\ No newline at end of file+echo ""+echo "Step 3 - printing version..."++${OUTPUT_BINARY} version++echo ""+echo "${GREEN}Completed building Bytebase monolithic ${VERSION} at ${OUTPUT_BINARY}.${NC}"+echo ""+echo "Command to start Bytebase on http://localhost:8080"+echo ""+echo "$ ${OUTPUT_BINARY} --host http://localhost --port 8080${NC}"+echo ""\ No newline at end of file