Commit d6c579a3 authored by cpomies's avatar cpomies
Browse files

Minor changed

Used execute_rsync in BuildSlot.py
Created folder in execute_rsync
Used push_artifact in build_slot.sh
parent af8fd3d1
......@@ -9,7 +9,7 @@ function build_slot {
day=$(date +%a)
timestamp=$(date -I)
deploybase=$(dirname /data/${ARTIFACTS_DIR})
deploybase=$(dirname ${RSYNC_WORKDIR})
# special hack to get a dev version of the CMake configuration files
export CMAKE_PREFIX_PATH=/afs/cern.ch/work/m/marcocle/workspace/LbScripts/LbUtils/cmake:$CMAKE_PREFIX_PATH
......@@ -35,10 +35,10 @@ function build_slot {
if [ "$JENKINS_MOCK" != "true" ] ; then
# create moving symlinks in the artifacts deployment directory (ASAP)
# (ignore errors, see <https://its.cern.ch/jira/browse/LBCORE-153>)
ssh buildlhcb.cern.ch "mkdir -pv ${deploybase} ; ln -svfT ${slot_build_id} ${deploybase}/${day} ; ln -svfT ${slot_build_id} ${deploybase}/${timestamp}" || true
ssh "${RSYNC_SERVER}" "mkdir -pv ${deploybase} ; ln -svfT ${slot_build_id} ${deploybase}/${day} ; ln -svfT ${slot_build_id} ${deploybase}/${timestamp}" || true
submit_opt="--submit --flavour ${flavour}"
rsync_opt="--rsync-dest buildlhcb.cern.ch:${deploybase}/${slot_build_id}"
rsync_opt="--rsync-dest '${RSYNC_DIR}'"
fi
# Notify the system of the builds that need to be tested.
......@@ -58,7 +58,7 @@ function build_slot {
fi
if [ "$JENKINS_MOCK" != "true" ] ; then
rsync --archive --whole-file --partial-dir=.rsync-partial.$(hostname).$$ --delay-updates --rsh=ssh "${ARTIFACTS_DIR}/" "buildlhcb.cern.ch:${deploybase}/${slot_build_id}"
push_artifact
fi
# if possible and requested, generate glimpse indexes and upload them to buildlhcb
......@@ -71,7 +71,7 @@ function build_slot {
time lbn-rpm --glimpse --verbose --build-id "${slot}.${slot_build_id}" --artifacts-dir "${ARTIFACTS_DIR}" ${config_file}
fi
if [ "$JENKINS_MOCK" != "true" ] ; then
rsync --archive --whole-file --partial-dir=.rsync-partial.$(hostname).$$ --delay-updates --rsh=ssh "${ARTIFACTS_DIR}/" "buildlhcb.cern.ch:${deploybase}/${slot_build_id}"
push_artifact
fi
fi
fi
......
......@@ -5,7 +5,7 @@ function get_config_file {
exit 1
fi
lbn-manage-rsync --verbose --get-config --progress --source "${RSYNC_DIR}" --destination "${ARTIFACTS_DIR}"
lbn-manage-rsync --verbose --get-config --progress --source "${RSYNC_DIR}/" --destination "${ARTIFACTS_DIR}"
if [ -e ${ARTIFACTS_DIR}/${slot}.json ] ; then
export config_file=${ARTIFACTS_DIR}/${slot}.json
......
......@@ -5,7 +5,7 @@ function get_sources {
exit 1
fi
lbn-manage-rsync --verbose --get-sources --progress --source "${RSYNC_DIR}" --destination "${ARTIFACTS_DIR}"
lbn-manage-rsync --verbose --get-sources --progress --source "${RSYNC_DIR}/" --destination "${ARTIFACTS_DIR}"
export GET_SOURCES="true"
......
......@@ -5,6 +5,6 @@ function push_artifact {
exit 1
fi
lbn-manage-rsync --verbose --progress --source "${ARTIFACTS_DIR}" --destination "${RSYNC_DIR}"
lbn-manage-rsync --verbose --progress --source "${ARTIFACTS_DIR}/" --destination "${RSYNC_DIR}"
}
......@@ -30,9 +30,9 @@ function set_common {
export ARTIFACTS_DIR=${ARTIFACTS_DIR:-artifacts/${flavour}/${slot}/${slot_build_id}}
mkdir -p ${ARTIFACTS_DIR}
export RSYNC_SERVER=${RSYNC_SERVER:-*********} # TODO
export RSYNC_WORKDIR=${RSYNC_WORKDIR:-*********} # TODO
export RSYNC_DIR=${RSYNC_DIR:-${RSYNC_SERVER}:${RSYNC_WORKDIR}/${flavour}/${slot}/${slot_build_id}}
export RSYNC_SERVER=${RSYNC_SERVER:-buildlhcb.cern.ch}
export RSYNC_WORKDIR=${RSYNC_WORKDIR:-/data/${ARTIFACTS_DIR}}
export RSYNC_DIR=${RSYNC_DIR:-${RSYNC_SERVER}:${RSYNC_WORKDIR}}
export TMPDIR=${WORKSPACE}/tmp
mkdir -p ${TMPDIR}
......
......@@ -1007,12 +1007,6 @@ string(REPLACE "$${NIGHTLY_BUILD_ROOT}" "$${CMAKE_CURRENT_LIST_DIR}"
else:
self.retcode = 0
def run(self):
# create destination directory, if missing
if ':' in self.script.options.rsync_dest:
host, path = self.script.options.rsync_dest.split(':', 1)
call(['ssh', host, 'mkdir -pv "%s"' % path])
else:
ensureDirs([self.script.options.rsync_dest])
self.retcode = execute_rsync(self.script.artifacts_dir + '/',
self.script.options.rsync_dest)
......
......@@ -39,6 +39,13 @@ def execute_rsync(src, dest, includes = [], excludes = [], extra_param = []):
cmd.append(src)
cmd.append(dest)
# create destination directory, if missing
if ':' in dest:
host, path = dest.split(':', 1)
call(['ssh', host, 'mkdir -pv "%s"' % path])
else:
ensureDirs([dest])
logging.info("Rsync call : %s", cmd)
return call(cmd)
......@@ -114,12 +121,6 @@ class Script(LbUtils.Script.PlainScript):
if opts.progress:
extra_param = ['--progress']
if ':' in opts.destination:
host, path = opts.destination.split(':', 1)
call(['ssh', host, 'mkdir -pv "%s"' % path])
else:
ensureDirs([opts.destination])
return execute_rsync(
opts.source + '/',
opts.destination,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment