Revision 1f719b97
Added by Andreas Kohlbecker over 11 years ago
5.x/modules/cdm_dataportal/jenkins-ci/deploy.sh | ||
---|---|---|
1 | 1 |
#!/bin/bash |
2 | 2 |
|
3 | 3 |
# |
4 |
# |
|
5 | 4 |
# |
6 |
# |
|
5 |
# |
|
6 |
# |
|
7 | 7 |
DRUPAL_VERSION="5" |
8 | 8 |
SVN_USER="edit-jenkins" |
9 | 9 |
|
10 | 10 |
if [ -z "$1" ]; then |
11 | 11 |
echo "version parameter missing\nUsage: deploy.sh <version-number>" |
12 | 12 |
exit -1 |
13 |
fi
|
|
13 |
fi |
|
14 | 14 |
VERSION=$1 |
15 | 15 |
|
16 | 16 |
# $WORKSPACE is an environment variable set by jenkins |
17 | 17 |
if [ -n "$WORKSPACE" ]; then |
18 | 18 |
cd $WORKSPACE |
19 |
fi
|
|
19 |
fi |
|
20 | 20 |
|
21 | 21 |
# check if tag exists |
22 | 22 |
TAG_EXISTS=(`svn info http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION 2> /dev/null | grep URL`) |
23 |
if [ -z "$TAG_EXISTS" ]; then
|
|
23 |
if [ -z "$TAG_EXISTS" ]; then |
|
24 | 24 |
# it is a new version number ... |
25 | 25 |
|
26 |
# create release tag and branch for the module
|
|
26 |
# create release tag and branch for the module |
|
27 | 27 |
svn --username=$SVN_USER copy -m "release tag for cdm_dataportal $VERSION" http://dev.e-taxonomy.eu/svn/trunk/drupal/${DRUPAL_VERSION}.x/modules/cdm_dataportal http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION |
28 | 28 |
svn --username=$SVN_USER copy -m "branch for cdm_dataportal $VERSION" http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION http://dev.e-taxonomy.eu/svn/branches/drupal/module-cdm_dataportal-RELEASE-$VERSION |
29 | 29 |
|
30 |
#create release tag and branch for the themes
|
|
30 |
#create release tag and branch for the themes |
|
31 | 31 |
svn --username=$SVN_USER copy -m "release tag for drupal themes $VERSION" http://dev.e-taxonomy.eu/svn/trunk/drupal/${DRUPAL_VERSION}.x/themes http://dev.e-taxonomy.eu/svn/tags/drupal/themes/$VERSION |
32 | 32 |
svn --username=$SVN_USER copy -m "branch for drupal themes $VERSION" http://dev.e-taxonomy.eu/svn/tags/drupal/themes/$VERSION http://dev.e-taxonomy.eu/svn/branches/drupal/themes-RELEASE-$VERSION |
33 |
fi
|
|
33 |
fi |
|
34 | 34 |
|
35 | 35 |
#create the target folder |
36 |
if [ ! -d target ]; then
|
|
37 |
mkdir target
|
|
36 |
if [ ! -d target ]; then |
|
37 |
mkdir target |
|
38 | 38 |
fi |
39 | 39 |
cd target |
40 | 40 |
rm -rf * |
41 | 41 |
|
42 |
# create the module-cdm_dataportal archive
|
|
42 |
# create the module-cdm_dataportal archive |
|
43 | 43 |
svn --username=$SVN_USER export http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION ./cdm_dataportal |
44 |
tar czf cdm_dataportal-$VERSION.tar.gz ./cdm_dataportal
|
|
44 |
tar czf cdm_dataportal-$VERSION.tar.gz ./cdm_dataportal |
|
45 | 45 |
|
46 | 46 |
# create the drupal${DRUPAL_VERSION}-cdm_dataportal archive ... |
47 | 47 |
|
48 | 48 |
# downlod latest and unpack |
49 |
ARCHIVE_URL=(`lynx -dump http://wp5.e-taxonomy.eu/download/dataportal/stable/ | grep "download/dataportal/stable/drupal${DRUPAL_VERSION}-cdm_dataportal" | head -n 1 | sed -e "s/.*\(http.*\)/\1/g"`) |
|
49 |
ARCHIVE_URL=(`lynx -dump http://wp5.e-taxonomy.eu/download/dataportal/stable/ | grep "download/dataportal/stable/drupal${DRUPAL_VERSION}-cdm_dataportal" | head -n 1 | sed -e "s/.*\(http.*\)/\1/g"`) |
|
50 |
|
|
51 |
if [ -z "$ARCHIVE_URL" ]; then |
|
52 |
echo "http://wp5.e-taxonomy.eu/download/dataportal/stable/ does not contain drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz file, please check this symling on the server" |
|
53 |
exit -1; |
|
54 |
fi |
|
55 |
|
|
50 | 56 |
curl --output drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz $ARCHIVE_URL |
51 | 57 |
tar xzf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz |
52 | 58 |
|
... | ... | |
54 | 60 |
rsync -r --exclude=.svn ../jenkins-ci/dataportal-version-update/ drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all |
55 | 61 |
|
56 | 62 |
# update the module and themes |
57 |
cd drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all
|
|
63 |
cd drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all |
|
58 | 64 |
./update-to.sh $VERSION |
59 | 65 |
|
60 | 66 |
# copy the profiles |
61 | 67 |
cd ../../ |
62 | 68 |
rsync -r --exclude=.svn sites/all/modules/cdm_dataportal/profile/ profiles/ |
63 | 69 |
|
64 |
# make tar
|
|
70 |
# make tar |
|
65 | 71 |
cd ../ |
66 | 72 |
tar czf drupal${DRUPAL_VERSION}-cdm_dataportal-$VERSION.tar.gz drupal${DRUPAL_VERSION}-cdm_dataportal |
67 |
rm -rf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz drupal${DRUPAL_VERSION}-cdm_dataportal/
|
|
73 |
rm -rf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz |
|
68 | 74 |
|
69 | 75 |
# create the new folder on the server and upload everything |
70 | 76 |
ssh root@160.45.63.172 "mkdir /var/www/download/dataportal/$VERSION" |
71 | 77 |
ssh root@160.45.63.172 "rm -r /var/www/download/dataportal/stable" |
72 | 78 |
ssh root@160.45.63.172 "ln -s /var/www/download/dataportal/$VERSION /var/www/download/dataportal/stable" |
73 | 79 |
scp cdm_dataportal-${VERSION}.tar.gz root@wp5.e-taxonomy.eu:/var/www/download/dataportal/${VERSION}/ |
74 |
scp drupal${DRUPAL_VERSION}-cdm_dataportal-${VERSION}.tar.gz root@wp5.e-taxonomy.eu:/var/www/download/dataportal/${VERSION}/
|
|
80 |
scp drupal${DRUPAL_VERSION}-cdm_dataportal-${VERSION}.tar.gz root@wp5.e-taxonomy.eu:/var/www/download/dataportal/${VERSION}/ |
|
75 | 81 |
ssh root@160.45.63.172 "chown -R www-data:www-data /var/www/download/dataportal/${VERSION}" |
76 | 82 |
ssh root@160.45.63.172 "chown -R www-data:www-data /var/www/download/dataportal/stable" |
77 | 83 |
|
Also available in: Unified diff
catching problem in dataportal deploy.sh