Compare commits

...

4 Commits

4 changed files with 29 additions and 14 deletions

View File

@ -81,12 +81,14 @@ clone_customer_repository () {
$(exec_git_command git clone "$1")
if [ $? -eq 0 ]; then
log_debug "$func:${LINENO} cloning ${1} done"
GIT_CLONE_EXECUTED=1
# after cloning, cd into repository, and re-initialize,
# setting the work-tree as "/". This has the effect that
# a "git pull" will automatically fetched files in the
# corresponding sytem-folders.
if cd ${CUSTOMER_ID_BASE_DIR}; then
# local res=$(exec_git_command git --git-dir=.git --work-tree=/ init)
exec_git_command git checkout "$LOCAL_BRANCH"
exec_git_command git config core.worktree "/"
if [[ $? -eq 0 ]]; then
# re-initialized. copy post-merge (a hook called

View File

@ -28,6 +28,8 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly PROGRAM=`basename $0`
readonly WORKSPACE_DIR=workspace
GIT_CLONE_EXECUTED=0
EXITCODE=$RC_SUCCESS
CLONE_CUSTOMER_REPOSITORY=false
@ -91,6 +93,16 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly ZONE_GROUPS=(${__zone_groups[@]})
assert_a ZONE_GROUPS
# TODO
# TODO: falls mehrere gruppen/zonen auftauchen hier anpassen
# TODO
# Zone aus /etc/zone_nr auslesen
#
readonly ZONE_GROUP=1
readonly ZONE=1
readonly LOCAL_BRANCH="$(cat "$cf" | jq -r .local_branches[$ZONE])"
return 0
}
@ -151,13 +163,7 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
# readonly CUST_BASE_DIRS=(${__customer_base_dirs[@]})
# assert_a CUST_BASE_DIRS
# TODO
# TODO: falls mehrere gruppen/zonen auftauchen hier anpassen
# TODO
# Zone aus /etc/zone_nr auslesen
#
readonly ZONE_GROUP=1
readonly ZONE=1
readonly CUST_BASE_DIR="$CUSTOMER_ID_BASE_DIR"
#readonly CUST_BASE_DIR="${CUST_BASE_DIRS[$ZONE]}"
#assert_d CUST_BASE_DIR

View File

@ -11,6 +11,10 @@
"" : "zone file for PSA",
"zone" : "/etc/zone_nr",
"" : "local branches",
"local_branches" : ["master",
"zg1/zone1", "zg1/zone2", "zg1/zone3"],
"" : "customer number of PSA",
"customer_id_" : "/etc/cust_nr",

View File

@ -41,13 +41,16 @@ update_psa() {
log_debug "$func:${LINENO}: fetch/merge updates..."
# Fetch new updates (using git)
if ! fetch_customer_updates; then
log_error "$func:${LINENO}: fetch no data for $customer_id"\
"-> no files to update -> no psa update"
update_psa_false_alarm \
"update request, but no change in $CUSTOMER_REPOSITORY_PATH"
# TODO
# Fetch new updates (using git). but only when repository has already been
# cloned.
if [ $GIT_CLONE_EXECUTED -eq 0 ]; then
if ! fetch_customer_updates; then
log_error "$func:${LINENO}: fetch no data for $customer_id"\
"-> no files to update -> no psa update"
update_psa_false_alarm \
"update request, but no change in $CUSTOMER_REPOSITORY_PATH"
# TODO
fi
fi
update_psa_pull_customer_repository # message to ISMAS