Compare commits
No commits in common. "729778043a90be5f14a7582e4bf3ef63500866ed" and "c229f7072cf91988114f5af8a7acfe20ae130fa9" have entirely different histories.
729778043a
...
c229f7072c
27
git_helpers
27
git_helpers
@ -89,8 +89,7 @@ clone_customer_repository () {
|
|||||||
# a "git pull" will automatically fetched files in the
|
# a "git pull" will automatically fetched files in the
|
||||||
# corresponding sytem-folders.
|
# corresponding sytem-folders.
|
||||||
if cd ${CUSTOMER_ID_BASE_DIR}; then
|
if cd ${CUSTOMER_ID_BASE_DIR}; then
|
||||||
# configure hooks directory
|
# local res=$(exec_git_command git --git-dir=.git --work-tree=/ init)
|
||||||
exec_git_command git config core.hooksPath .githooks
|
|
||||||
exec_git_command git checkout "$LOCAL_BRANCH"
|
exec_git_command git checkout "$LOCAL_BRANCH"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
log_debug "$func:${LINENO} checked out local branch $LOCAL_BRANCH"
|
log_debug "$func:${LINENO} checked out local branch $LOCAL_BRANCH"
|
||||||
@ -103,6 +102,11 @@ clone_customer_repository () {
|
|||||||
exec_git_command git reset --hard "$LOCAL_BRANCH"
|
exec_git_command git reset --hard "$LOCAL_BRANCH"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
log_debug "$func:${LINENO} reset --hard $LOCAL_BRANCH"
|
log_debug "$func:${LINENO} reset --hard $LOCAL_BRANCH"
|
||||||
|
# re-initialized. copy post-merge (a hook called
|
||||||
|
# when 'git pull' is executed and changed data
|
||||||
|
# are received).
|
||||||
|
if cp ".githooks/post-merge" ".git/hooks"; then
|
||||||
|
log_debug "$func:${LINENO} copied post-merge to .git/hooks"
|
||||||
CLONE_CUSTOMER_REPOSITORY=true
|
CLONE_CUSTOMER_REPOSITORY=true
|
||||||
log_debug "$func:${LINENO} re-init of ${1} done"
|
log_debug "$func:${LINENO} re-init of ${1} done"
|
||||||
cd_home; return 0
|
cd_home; return 0
|
||||||
@ -112,6 +116,7 @@ clone_customer_repository () {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
cd_home; return 1
|
cd_home; return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -219,20 +224,4 @@ changed_file_names () {
|
|||||||
"while in $PWD"
|
"while in $PWD"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# fi
|
||||||
get_blob () { # get the blob of the file(name) passed as $1
|
|
||||||
# note: this can be used for any file in the filesystem
|
|
||||||
echo $(git hash-object $1)
|
|
||||||
}
|
|
||||||
|
|
||||||
get_commit_for_blob () {
|
|
||||||
blob=$(get_blob $1)
|
|
||||||
if [ ! -z $blob ]; then
|
|
||||||
# search for the blob in all commits for the file(name) $1
|
|
||||||
echo $(echo $(git log --all --pretty=format:%H -- $1) |
|
|
||||||
xargs -I{} sh -c "git ls-tree {} -- $1 |
|
|
||||||
grep -q $blob && echo {}")
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,12 +28,11 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|||||||
readonly PROGRAM=`basename $0`
|
readonly PROGRAM=`basename $0`
|
||||||
readonly WORKSPACE_DIR=workspace
|
readonly WORKSPACE_DIR=workspace
|
||||||
|
|
||||||
|
GIT_CLONE_EXECUTED=0
|
||||||
|
|
||||||
EXITCODE=$RC_SUCCESS
|
EXITCODE=$RC_SUCCESS
|
||||||
CLONE_CUSTOMER_REPOSITORY=false
|
CLONE_CUSTOMER_REPOSITORY=false
|
||||||
|
|
||||||
GIT_CLONE_EXECUTED=0
|
|
||||||
APISM_RUNNING=0
|
|
||||||
|
|
||||||
# read config file (JSON syntax)
|
# read config file (JSON syntax)
|
||||||
read_config() {
|
read_config() {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
|
@ -64,9 +64,6 @@ if cd "$WORKING_DIRECTORY"; then
|
|||||||
|
|
||||||
if read_config
|
if read_config
|
||||||
then
|
then
|
||||||
check_default_route
|
|
||||||
check_route_to_repository "185.191.219.134" # git.mimbach.de
|
|
||||||
check_for_running_apism
|
|
||||||
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}
|
if clone_customer_repository ${CUSTOMER_REPOSITORY_PATH}
|
||||||
then
|
then
|
||||||
check_sanity_of_repository
|
check_sanity_of_repository
|
||||||
|
@ -373,37 +373,8 @@ cleanup_previous_version() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_running_apism () {
|
check_for_apism () {
|
||||||
local func="${FUNCNAME[0]}"
|
nc localhost 7778
|
||||||
if nc localhost 7778
|
|
||||||
then
|
|
||||||
APISM_RUNNING=1
|
|
||||||
log_debug "$func:${LINENO}: APISM running..."
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
log_fatal "$func:${LINENO}: !!! APISM NOT RUNNING !!!"
|
|
||||||
}
|
|
||||||
|
|
||||||
check_default_route () {
|
|
||||||
local func="${FUNCNAME[0]}"
|
|
||||||
if ip route | head -n 1 | grep -q '^default'
|
|
||||||
then
|
|
||||||
log_debug "$func:${LINENO}: default route set"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
log_fatal "$func:${LINENO}: !!! NO DEFAULT ROUTE SET !!!"
|
|
||||||
}
|
|
||||||
|
|
||||||
check_route_to_repository () {
|
|
||||||
local func="${FUNCNAME[0]}"
|
|
||||||
# ip_address=$1, e.g. git.mimbach.de (185.191.219.134)
|
|
||||||
# 185.191.219.134 via 192.168.5.254 ...
|
|
||||||
if test "$#" -eq 1 && ip route get "$1" | head -n 1 | grep -q "^$1"
|
|
||||||
then
|
|
||||||
log_debug "$func:${LINENO}: route to repository available"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
log_fatal "$func:${LINENO}: !!! NO ROUTE TO REPO SET !!!"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_customer_id () {
|
get_customer_id () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user