forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag-and-schedule-ibs
executable file
·66 lines (58 loc) · 2.58 KB
/
tag-and-schedule-ibs
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
#!/bin/sh -ex
aklog
cd $WORKSPACE
CONFIG_MAP_PATH="$WORKSPACE/cms-bot/config.map"
RELEASE_FILTER=${RELEASE_FILTER-.*}
ARCHITECTURE_FILTER=${ARCHITECTURE_FILTER-.*}
RELEASE_QUEUES="`cat $CONFIG_MAP_PATH | grep -v "DISABLED=" | grep -e \"SCRAM_ARCH=$ARCHITECTURE_FILTER;\" | grep -e \"RELEASE_QUEUE=$RELEASE_FILTER;\" | sed -e's/.*RELEASE_QUEUE=//;s/;.*//' | sort -u`"
if [ "X$RELEASE_QUEUES" = X ]; then
echo No releases found to build.
exit 1
fi
rm -rf cmssw
git clone --reference /afs/cern.ch/cms/git-cmssw-mirror/cmssw.git [email protected]:cms-sw/cmssw.git cmssw
cd cmssw
for QUEUE in $RELEASE_QUEUES; do
unset RELEASE_BRANCH
eval `cat $CONFIG_MAP_PATH | grep -v "DISABLED=" | grep "RELEASE_QUEUE=$QUEUE;"`
RELEASE_BRANCH=${RELEASE_BRANCH-$RELEASE_QUEUE}
git checkout $RELEASE_BRANCH
RELEASE_NAME=`date +${QUEUE}_${DATE}`
DAY=`date +%Y-%m-%d`
HOUR=`echo $RELEASE_NAME | sed -e's|.*-\([0-9][0-9]\)00|\1|'`
# find old tag, if any
OLD_HASH=`git show-ref $RELEASE_NAME | cut -f1 -d\ `
NEW_HASH=`git rev-list -n 1 --before="$DAY $HOUR:00" $RELEASE_BRANCH`
# If there is no new hash, we have a problem.
# If there is no old hash, we simply tag.
# If there is an old hash, we use the old one.
if [ "X$NEW_HASH" = X ]; then
exit 1
fi
if [ "X$OLD_HASH" = X ]; then
git tag $RELEASE_NAME $NEW_HASH
git push origin --tags
fi
RELEASE_LIST="`git show --pretty='%d' HEAD | tr '[ ,()]' '[\n ]'| { grep \"^${QUEUE}_20\" || true; }`"
for ARCH_CONFIG in `cat $CONFIG_MAP_PATH | grep -v "DISABLED=" | grep "RELEASE_QUEUE=$QUEUE;" | grep "SCRAM_ARCH=$ARCHITECTURE_FILTER;"`; do
eval $ARCH_CONFIG
echo "RELEASE_NAME=$RELEASE_NAME" > $WORKSPACE/properties-$RELEASE_NAME-$SCRAM_ARCH.txt
echo "DATE_FORMAT=$DATE" >> $WORKSPACE/properties-$RELEASE_NAME-$SCRAM_ARCH.txt
echo "REPOSITORY=cms.${CMS_REPOSITORY}" >> $WORKSPACE/properties-$RELEASE_NAME-$SCRAM_ARCH.txt
echo "RELEASE_QUEUE=${QUEUE}" >> $WORKSPACE/properties-$RELEASE_NAME-$SCRAM_ARCH.txt
echo "ARCHITECTURE=${SCRAM_ARCH}" >> $WORKSPACE/properties-$RELEASE_NAME-$SCRAM_ARCH.txt
if [ "X$ALWAYS_BUILD" = X ]; then
echo "RELEASE_LIST=`echo ${RELEASE_LIST} | tr \\n \\ `" >> $WORKSPACE/properties-$RELEASE_NAME-$SCRAM_ARCH.txt
else
echo "RELEASE_LIST=" >> $WORKSPACE/properties-$RELEASE_NAME-$SCRAM_ARCH.txt
fi
done
done
ls $WORKSPACE
# Delete all files after having created them so that we do not build unless
# requested.
if [ "X$SCHEDULE_BUILDS" = Xfalse ]; then
mkdir -p $WORKSPACE/not-scheduled
touch $WORKSPACE/properties-x.txt
mv $WORKSPACE/properties-*.txt $WORKSPACE/not-scheduled
fi