-
Notifications
You must be signed in to change notification settings - Fork 5
/
publish-milestone.sh
94 lines (78 loc) · 3.42 KB
/
publish-milestone.sh
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh
# ====================================================================
# Copyright (c) 2021 Obeo
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0
#
# Contributors:
# Obeo - initial API and implementation
# ====================================================================
# Exit on error
set -e
# The SSH account to use
export SSH_ACCOUNT="genie.emfcompare@projects-storage.eclipse.org"
NIGHTLIES_FOLDER="/home/data/httpd/download.eclipse.org/modeling/emf/compare/updates/nightly"
MILESTONES_FOLDER="/home/data/httpd/download.eclipse.org/modeling/emf/compare/updates/milestones"
DROPS_FOLDER="/home/data/httpd/download.eclipse.org/modeling/emf/compare/downloads/drops"
ZIP_PREFIX="emf-compare-update-"
GROUP="modeling.emfcompare"
if [[ ! ${QUALIFIER} =~ ^[0-9]\.[0-9]\.[0-9]+\.[0-9]{12}$ ]]
then
echo "$QUALIFIER doesn't match the expect format x.x.x.yyyyMMddhhmm"
exit 1
fi
if ssh ${SSH_ACCOUNT} "[ ! -d ${NIGHTLIES_FOLDER}/${QUALIFIER} ]"
then
echo "couldn't find build with qualifier $QUALIFIER in the promoted nightlies"
exit 1
fi
echo "promoting build $QUALIFIER as milestone $ALIAS"
IFS=. read MAJOR MINOR MICRO TIMESTAMP <<<"${QUALIFIER}"
VERSION_SHORT=${MAJOR}.${MINOR}
VERSION=${MAJOR}.${MINOR}.${MICRO}
UPDATE_ROOT_COMPOSITE=false
if ssh ${SSH_ACCOUNT} "[ ! -d ${MILESTONES_FOLDER}/${VERSION_SHORT} ]"
then
UPDATE_ROOT_COMPOSITE=true
fi
ssh ${SSH_ACCOUNT} << EOSSH
if ${UPDATE_ROOT_COMPOSITE}
then
mkdir -p ${MILESTONES_FOLDER}/${VERSION_SHORT}
chgrp ${GROUP} ${MILESTONES_FOLDER}/${VERSION_SHORT}
fi
## copy the nightly to its "milestones" location
cp -r ${NIGHTLIES_FOLDER}/${QUALIFIER} ${MILESTONES_FOLDER}/${VERSION_SHORT}/S${TIMESTAMP}
chgrp -R ${GROUP} ${MILESTONES_FOLDER}/${VERSION_SHORT}/S${TIMESTAMP}
## Create a compressed archive of this repository and place it in the drops folder
if [ ! -d ${DROPS_FOLDER}/${VERSION} ]
then
mkdir -p ${DROPS_FOLDER}/${VERSION}
chgrp ${GROUP} ${DROPS_FOLDER}/${VERSION}
fi
mkdir -p ${DROPS_FOLDER}/${VERSION}/S${TIMESTAMP}
pushd ${MILESTONES_FOLDER}/${VERSION_SHORT}/S${TIMESTAMP}
zip -2 -r ${DROPS_FOLDER}/${VERSION}/S${TIMESTAMP}/${ZIP_PREFIX}${ALIAS}.zip *
popd
md5sum ${DROPS_FOLDER}/${VERSION}/S${TIMESTAMP}/${ZIP_PREFIX}${ALIAS}.zip > ${DROPS_FOLDER}/${VERSION}/S${TIMESTAMP}/${ZIP_PREFIX}${ALIAS}.zip.md5
chgrp -R ${GROUP} ${DROPS_FOLDER}/${VERSION}/S${TIMESTAMP}
## Create the p2.index file for this milestone
cat <<EOF >${MILESTONES_FOLDER}/${VERSION_SHORT}/S${TIMESTAMP}/p2.index
version = 1
metadata.repository.factory.order = compositeContent.xml,\!
artifact.repository.factory.order = compositeArtifacts.xml,\!
EOF
chgrp -R ${GROUP} ${MILESTONES_FOLDER}/${VERSION_SHORT}/S${TIMESTAMP}/p2.index
## Update the composite update site with this new child
## The ant script we use for this requires Java 8
export JAVA_HOME=/shared/common/jdk1.8.0_x64-latest
cd ${MILESTONES_FOLDER}/${VERSION_SHORT}
/shared/common/apache-ant-latest/bin/ant -f /shared/modeling/tools/promotion/manage-composite.xml add -Dchild.repository=S${TIMESTAMP}
if [ "$UPDATE_ROOT_COMPOSITE" = true ]
then
cd ${MILESTONES_FOLDER}
/shared/common/apache-ant-latest/bin/ant -f /shared/modeling/tools/promotion/manage-composite.xml add -Dchild.repository=${VERSION_SHORT}
fi
EOSSH