Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LHCData
lhc-sm-api
Commits
447d82e4
Commit
447d82e4
authored
Jun 27, 2022
by
Aleksandra Mnich
Browse files
[SIGMON-369] deployment changed
parent
cb41ac9b
Pipeline
#4151520
failed with stages
in 16 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CI/deploy_analysis.sh
View file @
447d82e4
#!/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 packag
es 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 repositori
es 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"
)
)
analysis_dirs
=(
$(
find lhc-sm-analysis
-maxdepth
1
-mindepth
1
-type
d |
grep
-v
'CI'
|
grep
-v
'git'
)
)
for
REPO
in
REPOS
;
do
EOS_PATH
=
/eos/project/l/lhcsm/venv_
${
CI_COMMIT_BRANCH
}
/lhcsmapi/api/
# extract the name
DIR
=(
$(
echo
$REPO
|
cut
-d
/
-f6
|
cut
-d
.
-f1
)
)
rsync
=
"/usr/bin/rsync"
if
[
!
-x
$rsync
]
then
echo
ERROR:
$rsync
not found
ex
it
1
fi
# 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"
ex
port
ANALYSIS_BRANCH
=
'master'
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
echo
ERROR:
$ssh
not found
exit
1
fi
git clone
--single-branch
--branch
$ANALYSIS_BRANCH
"
${
REPO
}
"
# Copy contents of each directory to EOS
EOS_PATH
=
/eos/project/l/lhcsm/venv_
${
CI_COMMIT_BRANCH
}
/lhcsmapi/api/
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
/
rsync
=
"/usr/bin/rsync"
if
[
!
-x
$rsync
]
then
echo
ERROR:
$rsync
not found
exit
1
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
echo
ERROR:
$ssh
not found
exit
1
fi
# 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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment