mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-01 02:37:02 +08:00
move global variables into function args/local variables, build both regular and debug images by default
This commit is contained in:
parent
0559bd3c6f
commit
ca1b606d70
@ -2,12 +2,17 @@
|
|||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
|
||||||
reset=$(tput sgr0)
|
reset=$(tput sgr0)
|
||||||
|
red=$(tput setaf 1)
|
||||||
blue=$(tput setaf 4)
|
blue=$(tput setaf 4)
|
||||||
|
|
||||||
function logg() {
|
function logg () {
|
||||||
printf "${blue}##### $(date +"%H:%M:%S") # %-56.55s #####${reset}\n" "${1}"
|
printf "${blue}##### $(date +"%H:%M:%S") # %-56.55s #####${reset}\n" "${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loge () {
|
||||||
|
printf "${red}##### $(date +"%H:%M:%S") # %-56.55s #####${reset}\n" "${1}"
|
||||||
|
}
|
||||||
|
|
||||||
function pushd () {
|
function pushd () {
|
||||||
command pushd "$@" > /dev/null
|
command pushd "$@" > /dev/null
|
||||||
}
|
}
|
||||||
@ -16,7 +21,19 @@ function popd () {
|
|||||||
command popd > /dev/null
|
command popd > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_fake_website_directory() {
|
function error_exit () {
|
||||||
|
echo "${red}################################################################################${reset}"
|
||||||
|
loge "${0} FAILED"
|
||||||
|
echo "${red}################################################################################${reset}"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap error_exit ERR
|
||||||
|
|
||||||
|
function create_fake_website_directory () {
|
||||||
|
if [ ${#} -ne 1 ]; then
|
||||||
|
loge "INCORRECT NUMBER OF ARGS FOR ${FUNCNAME[0]}"
|
||||||
|
fi
|
||||||
|
local stripped_binaries_and_from_where="${1}"
|
||||||
fdb_binaries=( 'fdbbackup' 'fdbcli' 'fdbserver' 'fdbmonitor' )
|
fdb_binaries=( 'fdbbackup' 'fdbcli' 'fdbserver' 'fdbmonitor' )
|
||||||
logg "PREPARING WEBSITE"
|
logg "PREPARING WEBSITE"
|
||||||
website_directory="${script_dir}/website"
|
website_directory="${script_dir}/website"
|
||||||
@ -112,7 +129,7 @@ function create_fake_website_directory() {
|
|||||||
fdb_website="file:///tmp/website"
|
fdb_website="file:///tmp/website"
|
||||||
}
|
}
|
||||||
|
|
||||||
function compile_ycsb() {
|
function compile_ycsb () {
|
||||||
logg "COMPILING YCSB"
|
logg "COMPILING YCSB"
|
||||||
if [ "${use_development_java_bindings}" == "true" ]; then
|
if [ "${use_development_java_bindings}" == "true" ]; then
|
||||||
logg "INSTALL JAVA BINDINGS"
|
logg "INSTALL JAVA BINDINGS"
|
||||||
@ -150,7 +167,13 @@ function compile_ycsb() {
|
|||||||
popd || exit 128
|
popd || exit 128
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_and_push_images(){
|
function build_and_push_images () {
|
||||||
|
if [ ${#} -ne 3 ]; then
|
||||||
|
loge "INCORRECT NUMBER OF ARGS FOR ${FUNCNAME[0]}"
|
||||||
|
fi
|
||||||
|
local dockerfile_name="${1}"
|
||||||
|
local use_development_java_bindings="${2}"
|
||||||
|
local push_docker_images="${3}"
|
||||||
declare -a tags_to_push=()
|
declare -a tags_to_push=()
|
||||||
for image in "${image_list[@]}"; do
|
for image in "${image_list[@]}"; do
|
||||||
logg "BUILDING ${image}"
|
logg "BUILDING ${image}"
|
||||||
@ -237,11 +260,6 @@ image_list=(
|
|||||||
)
|
)
|
||||||
registry=""
|
registry=""
|
||||||
tag_base="foundationdb/"
|
tag_base="foundationdb/"
|
||||||
# THESE CONTROL THE PATH OF FUNCTIONS THAT ARE CALLED BELOW
|
|
||||||
stripped_binaries_and_from_where="stripped_local" # MUST BE ONE OF ( "unstripped_artifactory" "stripped_artifactory" "unstripped_local" "stripped_local" )
|
|
||||||
dockerfile_name="Dockerfile"
|
|
||||||
use_development_java_bindings="false"
|
|
||||||
push_docker_images="false"
|
|
||||||
|
|
||||||
if [ -n "${OKTETO_NAMESPACE+x}" ]; then
|
if [ -n "${OKTETO_NAMESPACE+x}" ]; then
|
||||||
logg "RUNNING IN OKTETO/AWS"
|
logg "RUNNING IN OKTETO/AWS"
|
||||||
@ -258,19 +276,24 @@ if [ -n "${OKTETO_NAMESPACE+x}" ]; then
|
|||||||
else
|
else
|
||||||
tag_postfix="${OKTETO_NAME:-dev}"
|
tag_postfix="${OKTETO_NAME:-dev}"
|
||||||
fi
|
fi
|
||||||
stripped_binaries_and_from_where="unstripped_local" # MUST BE ONE OF ( "unstripped_artifactory" "stripped_artifactory" "unstripped_local" "stripped_local" )
|
|
||||||
dockerfile_name="Dockerfile.eks"
|
# build regular images
|
||||||
use_development_java_bindings="true"
|
create_fake_website_directory stripped_local
|
||||||
push_docker_images="true"
|
build_and_push_images Dockerfile true true
|
||||||
|
|
||||||
|
# build debug images
|
||||||
|
create_fake_website_directory unstripped_local
|
||||||
|
build_and_push_images Dockerfile.eks true true
|
||||||
else
|
else
|
||||||
echo "Dear ${USER}, you probably need to edit this file before running it. "
|
echo "Dear ${USER}, you probably need to edit this file before running it. "
|
||||||
echo "${0} has a very narrow set of situations where it will be successful,"
|
echo "${0} has a very narrow set of situations where it will be successful,"
|
||||||
echo "or even useful, when executed unedited"
|
echo "or even useful, when executed unedited"
|
||||||
exit 1
|
exit 1
|
||||||
|
# this set of options will creat standard images from a local build
|
||||||
|
# create_fake_website_directory stripped_local
|
||||||
|
# build_and_push_images Dockerfile false false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
create_fake_website_directory
|
|
||||||
build_and_push_images
|
|
||||||
|
|
||||||
echo "${blue}################################################################################${reset}"
|
echo "${blue}################################################################################${reset}"
|
||||||
logg "COMPLETED ${0}"
|
logg "COMPLETED ${0}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user