Commit 447d82e4 authored by Aleksandra Mnich's avatar Aleksandra Mnich
Browse files

[SIGMON-369] deployment changed

parent cb41ac9b
Pipeline #4151520 failed with stages
in 16 minutes and 53 seconds
#!/bin/bash
# This script is triggered by CI to clone a chosen branch of lhc-sm-analysis and copy it's contents to the venv on EOS.
# The project lhc-sm-analysis consists of several packages with sigmon analysis.
# This script is triggered by CI to clone a chosen branch of the lhc-sm-analysis repositories and copy their contents to the venv on EOS.
# The lhc-sm-analysis group contains several repositories with sigmon analysis packages.
# Contents of each package are copied to be accessible under a path /eos/project/l/lhcsm/venv_${CI_COMMIT_BRANCH}/lhcsmapi/api/
# set ANALYSIS_BRANCH if not set
export ANALYSIS_BRANCH="${ANALYSIS_BRANCH:$CI_COMMIT_BRANCH}"
# check if branch exists
git ls-remote --exit-code --heads https://:@gitlab.cern.ch:8443/LHCData/lhc-sm-analysis.git "${ANALYSIS_BRANCH}"
if [ "$?" == "2" ]; then
echo "Branch '${ANALYSIS_BRANCH}' not found in lhc-sm-analysis, using 'master' instead"
export ANALYSIS_BRANCH='master'
fi;
git clone --single-branch --branch $ANALYSIS_BRANCH https://:@gitlab.cern.ch:8443/LHCData/lhc-sm-analysis.git
REPOS=($(curl -s https://gitlab.cern.ch/api/v4/groups/152156 | jq -r ".projects[].http_url_to_repo"))
for REPO in REPOS; do
# extract the name
DIR=($(echo $REPO | cut -d/ -f6 | cut -d. -f1))
# check if branch exists
git ls-remote --exit-code --heads "${REPO}" "${ANALYSIS_BRANCH}"
if [ "$?" == "2" ]; then
echo "Branch '${ANALYSIS_BRANCH}' not found in ${DIR}, using 'master' instead"
export ANALYSIS_BRANCH='master'
fi;
analysis_dirs=($(find lhc-sm-analysis -maxdepth 1 -mindepth 1 -type d | grep -v 'CI' | grep -v 'git'))
git clone --single-branch --branch $ANALYSIS_BRANCH "${REPO}"
EOS_PATH=/eos/project/l/lhcsm/venv_${CI_COMMIT_BRANCH}/lhcsmapi/api/
EOS_PATH=/eos/project/l/lhcsm/venv_${CI_COMMIT_BRANCH}/lhcsmapi/api/
rsync="/usr/bin/rsync"
if [ ! -x $rsync ]
then
rsync="/usr/bin/rsync"
if [ ! -x $rsync ]
then
echo ERROR: $rsync not found
exit 1
fi
fi
# SSH will be used to connect to LXPLUS and there check if the EOS folder exists
ssh="/usr/bin/ssh"
if [ ! -x $ssh ]
then
# SSH will be used to connect to LXPLUS and there check if the EOS folder exists
ssh="/usr/bin/ssh"
if [ ! -x $ssh ]
then
echo ERROR: $ssh not found
exit 1
fi
# Copy contents of each directory to EOS
fi
for dir in "${analysis_dirs[@]}"; do
$rsync -abvuz -e "ssh -o StrictHostKeyChecking=no -o GSSAPIAuthentication=yes -o GSSAPITrustDNS=yes -o GSSAPIDelegateCredentials=yes" $dir/lhcsmapi/api/analysis $EOS_ACCOUNT_USERNAME@lxplus.cern.ch:$EOS_PATH/
# Copy contents to EOS
$rsync -abvuz -e "ssh -o StrictHostKeyChecking=no -o GSSAPIAuthentication=yes -o GSSAPITrustDNS=yes -o GSSAPIDelegateCredentials=yes" $DIR/lhcsmapi/api/analysis $EOS_ACCOUNT_USERNAME@lxplus.cern.ch:$EOS_PATH/
if [ $? -ne 0 ]
then
echo ERROR: Rsync to \"$EOS_PATH\" via lxplus.cern.ch, failed
......
Supports Markdown
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