forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-deploy-afs
executable file
·71 lines (59 loc) · 2.38 KB
/
release-deploy-afs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh -ex
# the following are set up by jenkins
# CMSSW_X_Y_Z
# ARCHITECTURE
# RELEASE_TYPE
# PRODUCTION_ARCHITECTURE
RELEASE_SERIES=`echo $CMSSW_X_Y_Z | sed 's/^\(CMSSW_[0-9][0-9]*_[0-9][0-9]*_\).*/\1X/'`
prodarch=0
if [ "X$PRODUCTION_ARCHITECTURE" = "XDefault" ]; then
#here it gets the SCRAM_ARCH value for the production arch
eval `cat config.map | grep "RELEASE_QUEUE=$RELEASE_SERIES" | grep 'PROD_ARCH=1'`
if [ "$SCRAM_ARCH" = "$ARCHITECTURE" ]; then
prodarch=1
fi
elif [ "X$PRODUCTION_ARCHITECTURE" = "XYes" ]; then
prodarch=1
fi
if [ "X$RELEASE_TYPE" = "XDefault" ]; then
RELEASE_TYPE=Development
if [ X`echo $CMSSW_X_Y_Z | grep -e '_pre[0-9][0-9]*'` = X ] ; then
RELEASE_TYPE=Production
fi
fi
RPM_NAME=cmssw
case $CMSSW_X_Y_Z in
*patch*) RPM_NAME=cmssw-patch ;;
esac
BASERELEASE=$(echo $CMSSW_X_Y_Z | sed -e 's/_[a-zA-Z0-9]*patch[0-9].*//')
while ! fs lq /afs/.cern.ch/cms/$ARCHITECTURE/cms/cmssw/$BASERELEASE | grep -E '[2-9]000000'; do
echo Waiting for volume ; sleep 10
done
source /afs/cern.ch/cms/cmsset_default.sh
find /afs/cern.ch/cms/$ARCHITECTURE/external/apt/ -name init.sh | tail -n 1
source $(find /afs/cern.ch/cms/$ARCHITECTURE/external/apt/ -name init.sh | tail -n 1)
apt-get update
apt-get install -y $(apt-cache search $CMSSW_X_Y_Z | sed -e 's|[ ].*||' | grep -e "^cms[+]$RPM_NAME[+]$CMSSW_X_Y_Z\$") && touch /afs/.cern.ch/cms/$ARCHITECTURE/tmp/$CMSSW_X_Y_Z
cd $WORKSPACE
git clone git@github.com:cms-sw/cms-bot
pushd cms-bot
if [ X`grep -e "architecture=$ARCHITECTURE;" releases.map | grep -e "label=$CMSSW_X_Y_Z;"` = X ]; then
if [ `grep -e "label=$CMSSW_X_Y_Z;" releases.map | sed -e's/.*type=//;s/;.*//' | grep -v -e "$RELEASE_TYPE" | sort -u | wc -l` -ge 1 ]; then
echo "Too many release types." && exit 1
fi
if [ "X$prodarch" = "X1" ] ; then
if [ `grep -e "label=$CMSSW_X_Y_Z;" releases.map | grep -e ";prodarch=1;" | wc -l` -ge 1 ]; then
echo "Too many production architectures for release." && exit 1
fi
fi
echo "architecture=$ARCHITECTURE;label=$CMSSW_X_Y_Z;type=$RELEASE_TYPE;state=Announced;prodarch=$prodarch;" >> releases.map
git commit -m "Add $CMSSW_X_Y_Z for $ARCHITECTURE as $RELEASE_TYPE." releases.map
git pull --rebase
git push
if [ "X$ANNOUNCE_RELEASE" = Xtrue ]; then
echo "Here we should announce the release"
fi
else
echo "Release already announced."
fi
popd