|
|
|
@ -10,6 +10,18 @@ error_exit() {
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assign_version() {
|
|
|
|
|
if [[ -z "${VERSION:-}" ]]; then
|
|
|
|
|
VERSION=$(version_from_git)
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assign_ldflags() {
|
|
|
|
|
if [[ -z "${LDFLAGS:-}" ]]; then
|
|
|
|
|
LDFLAGS="-s -X ${REPO}/pkg/version.DeploymentManagerVersion=${VERSION}"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
version_from_git() {
|
|
|
|
|
local git_tag=$(git describe --tags --abbrev=0 2>/dev/null)
|
|
|
|
|
local git_commit=$(git rev-parse --short HEAD)
|
|
|
|
@ -29,13 +41,19 @@ build_binary_cross() {
|
|
|
|
|
|
|
|
|
|
build_binaries() {
|
|
|
|
|
local -a targets=($@)
|
|
|
|
|
#TODO: accept specific os/arch
|
|
|
|
|
local build_cross="${BUILD_CROSS:-}"
|
|
|
|
|
|
|
|
|
|
if [[ ${#targets[@]} -eq 0 ]]; then
|
|
|
|
|
targets=("${ALL_TARGETS[@]}")
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
for t in "${targets[@]}"; do
|
|
|
|
|
if [[ -n "$build_cross" ]]; then
|
|
|
|
|
build_binary_cross "$t"
|
|
|
|
|
else
|
|
|
|
|
build_binary "$t"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|