commit
f18d7e7596
35
build.py
35
build.py
|
@ -1,11 +1,4 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/python2.7 -u
|
||||||
#
|
|
||||||
# This is the InfluxDB build script.
|
|
||||||
#
|
|
||||||
# Current caveats:
|
|
||||||
# - Does not checkout the correct commit/branch (for now, you will need to do so manually)
|
|
||||||
# - Has external dependencies for packaging (fpm) and uploading (boto)
|
|
||||||
#
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -132,6 +125,16 @@ def run_generate():
|
||||||
run("go generate ./services/admin")
|
run("go generate ./services/admin")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def go_get(branch, update=False, no_stash=False):
|
||||||
|
if not check_path_for("gdm"):
|
||||||
|
print "Downloading `gdm`..."
|
||||||
|
get_command = "go get github.com/sparrc/gdm"
|
||||||
|
run(get_command)
|
||||||
|
print "Retrieving dependencies with `gdm`..."
|
||||||
|
sys.stdout.flush()
|
||||||
|
run("{}/bin/gdm restore -v".format(os.environ.get("GOPATH")))
|
||||||
|
return True
|
||||||
|
|
||||||
################
|
################
|
||||||
#### All InfluxDB-specific content above this line
|
#### All InfluxDB-specific content above this line
|
||||||
################
|
################
|
||||||
|
@ -145,6 +148,7 @@ def run(command, allow_failure=False, shell=False):
|
||||||
out = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=shell)
|
out = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=shell)
|
||||||
else:
|
else:
|
||||||
out = subprocess.check_output(command.split(), stderr=subprocess.STDOUT)
|
out = subprocess.check_output(command.split(), stderr=subprocess.STDOUT)
|
||||||
|
print "[DEBUG] command output: \n{}\n".format(out)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print ""
|
print ""
|
||||||
print ""
|
print ""
|
||||||
|
@ -458,15 +462,6 @@ def copy_file(fr, to):
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print e
|
print e
|
||||||
|
|
||||||
def go_get(branch, update=False):
|
|
||||||
if not check_path_for("gdm"):
|
|
||||||
print "Downloading `gdm`..."
|
|
||||||
get_command = "go get github.com/sparrc/gdm"
|
|
||||||
run(get_command)
|
|
||||||
print "Retrieving dependencies with `gdm`..."
|
|
||||||
sys.stdout.flush()
|
|
||||||
run("{}/bin/gdm restore".format(os.environ.get("GOPATH")))
|
|
||||||
|
|
||||||
def generate_md5_from_file(path):
|
def generate_md5_from_file(path):
|
||||||
m = hashlib.md5()
|
m = hashlib.md5()
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
|
@ -605,7 +600,7 @@ def print_usage():
|
||||||
print "\t --update \n\t\t- Whether dependencies should be updated prior to building."
|
print "\t --update \n\t\t- Whether dependencies should be updated prior to building."
|
||||||
print "\t --test \n\t\t- Run Go tests. Will not produce a build."
|
print "\t --test \n\t\t- Run Go tests. Will not produce a build."
|
||||||
print "\t --parallel \n\t\t- Run Go tests in parallel up to the count specified."
|
print "\t --parallel \n\t\t- Run Go tests in parallel up to the count specified."
|
||||||
print "\t --generate \n\t\t- Run `go generate` to rebuild admin UI static filesystem."
|
print "\t --generate \n\t\t- Run `go generate`."
|
||||||
print "\t --timeout \n\t\t- Timeout for Go tests. Defaults to 480s."
|
print "\t --timeout \n\t\t- Timeout for Go tests. Defaults to 480s."
|
||||||
print "\t --clean \n\t\t- Clean the build output directory prior to creating build."
|
print "\t --clean \n\t\t- Clean the build output directory prior to creating build."
|
||||||
print "\t --no-get \n\t\t- Do not run `go get` before building."
|
print "\t --no-get \n\t\t- Do not run `go get` before building."
|
||||||
|
@ -708,7 +703,6 @@ def main():
|
||||||
# Fail if uncommited changes exist
|
# Fail if uncommited changes exist
|
||||||
no_stash = True
|
no_stash = True
|
||||||
elif '--generate' in arg:
|
elif '--generate' in arg:
|
||||||
# Run go generate services/admin
|
|
||||||
generate = True
|
generate = True
|
||||||
elif '--debug' in arg:
|
elif '--debug' in arg:
|
||||||
print "[DEBUG] Using debug output"
|
print "[DEBUG] Using debug output"
|
||||||
|
@ -767,7 +761,8 @@ def main():
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if run_get:
|
if run_get:
|
||||||
go_get(branch, update=update)
|
if not go_get(branch, update=update, no_stash=no_stash):
|
||||||
|
return 1
|
||||||
|
|
||||||
if test:
|
if test:
|
||||||
if not run_tests(race, parallel, timeout, no_vet):
|
if not run_tests(race, parallel, timeout, no_vet):
|
||||||
|
|
12
test.sh
12
test.sh
|
@ -132,35 +132,35 @@ fi
|
||||||
case $ENVIRONMENT_INDEX in
|
case $ENVIRONMENT_INDEX in
|
||||||
0)
|
0)
|
||||||
# 64 bit tests
|
# 64 bit tests
|
||||||
run_test_docker Dockerfile_build_ubuntu64 test_64bit --test
|
run_test_docker Dockerfile_build_ubuntu64 test_64bit --debug --test
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
# 64 bit tsm tests
|
# 64 bit tsm tests
|
||||||
INFLUXDB_DATA_ENGINE="tsm1"
|
INFLUXDB_DATA_ENGINE="tsm1"
|
||||||
run_test_docker Dockerfile_build_ubuntu64 test_64bit_tsm --test
|
run_test_docker Dockerfile_build_ubuntu64 test_64bit_tsm --debug --test
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
# 64 bit race tests
|
# 64 bit race tests
|
||||||
GORACE="halt_on_error=1"
|
GORACE="halt_on_error=1"
|
||||||
run_test_docker Dockerfile_build_ubuntu64 test_64bit_race --test --race
|
run_test_docker Dockerfile_build_ubuntu64 test_64bit_race --debug --test --race
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
# 32 bit tests
|
# 32 bit tests
|
||||||
run_test_docker Dockerfile_build_ubuntu32 test_32bit --test
|
run_test_docker Dockerfile_build_ubuntu32 test_32bit --debug --test
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
# 64 bit tests on golang tip
|
# 64 bit tests on golang tip
|
||||||
run_test_docker Dockerfile_build_ubuntu64_git test_64bit_gotip --test --no-vet
|
run_test_docker Dockerfile_build_ubuntu64_git test_64bit_gotip --debug --test --no-vet
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
# 64 bit tests on golang go1.6
|
# 64 bit tests on golang go1.6
|
||||||
GO_CHECKOUT=go1.6beta1
|
GO_CHECKOUT=go1.6beta1
|
||||||
run_test_docker Dockerfile_build_ubuntu64_git test_64bit_go1.6 --test --no-vet
|
run_test_docker Dockerfile_build_ubuntu64_git test_64bit_go1.6 --debug --test --no-vet
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
"save")
|
"save")
|
||||||
|
|
Loading…
Reference in New Issue