Project

General

Profile

« Previous | Next » 

Revision 03e53b89

Added by Andreas Kohlbecker almost 8 years ago

#4979 delpoy.sh script adapted and splitted

View differences:

modules/cdm_dataportal/jenkins-ci/deploy.sh
1 1
#!/bin/bash
2 2

  
3
#
4
#
5
#
6
#
7 3
DRUPAL_VERSION="7"
8
SVN_USER="edit-jenkins"
9 4

  
10 5
GIT_REPO_URL="edit-git:/var/git/cdm-dataportal.git"
11 6

  
7
DO_CREATE_DRUPAL_INSTALLER=false
8

  
12 9

  
13 10
##############################################################
14 11
# NOTE: the ssh host should be configured in the ~/.ssh/config:
......
18 15
# 
19 16
# At the server to be delpoyed to you need to setup and configure the 
20 17

  
21
# 1. crate the <deployment-user> 
18
# 1. create the <deployment-user> 
22 19
#
23 20
# 2. assuming you are logged in as the <deployment-user>:
24 21
#
......
46 43
  exit -1
47 44
fi
48 45

  
49
TAG_EXISTS=$(git ls-remote --heads --tags $GIT_REPO_URL | grep "refs/tags/$VERSION")
50

  
51
if [ -z "$TAG_EXISTS" ]; then
52
  # it is a new release
53

  
54
  #
55
  # compile the sass files to css in the zen_dataportal theme
56
  # this will create the versions needed for production
57
  #
58
  if [ -x "$COMPASS" ]; then  
59
    $COMPASS clean $WORKSPACE/themes/zen_dataportal/
60
    $COMPASS compile $WORKSPACE/themes/zen_dataportal/
61
    svn --username=$SVN_USER ci -m "sass compiled for production purposes prior release"
62
  else 
63
    echo "ERROR on sass compilation since the evnvironment variable COMPASS is either missing or not the file "$COMPASS" is not executable"
64
    exit 1
65
  fi
66

  
67
	# create release tag and branch for the module
68
	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
69
	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
70

  
71
	#create release tag and branch for the themes
72
	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
73
	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
74
fi
75

  
76

  
77 46
#
78 47
# pack and deploy the cdm_dataportal module
79 48
#
80
cd $WORKSPACE/cdm_dataportal
81
#create the target folder
82
if [ ! -d target ]; then
83
	mkdir target
84
fi
85
cd target
86
rm -rf *
87 49

  
88
# create the module-cdm_dataportal archive
89
svn --username=$SVN_USER export http://dev.e-taxonomy.eu/svn/tags/drupal/module-cdm_dataportal/$VERSION ./cdm_dataportal
90
tar czf cdm_dataportal-$VERSION.tar.gz ./cdm_dataportal
50
mkdir -p target
91 51

  
92
# create the drupal${DRUPAL_VERSION}-cdm_dataportal archive ...
52
echo "creating the module-cdm_dataportal archive: cdm_dataportal-$VERSION.tar.gz"
53
tar czf target/cdm_dataportal-$VERSION.tar.gz $WORKSPACE/modules/cdm_dataportal
93 54

  
94
# downlod latest and unpack
95
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"`)
55
if $DO_CREATE_DRUPAL_INSTALLER ; then  
96 56

  
97
if [ -z "$ARCHIVE_URL" ]; then
98
  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"
99
  exit -1;
100
fi
57
  echo "creating the drupal${DRUPAL_VERSION}-cdm_dataportal archive ..."
58
  
59
  # TODO better use drush for the assembly
101 60

  
102
curl --output drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz $ARCHIVE_URL
103
tar xzf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz
61
  # downlod latest and unpack
62
  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"`)
63

  
64
  if [ -z "$ARCHIVE_URL" ]; then
65
    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"
66
    exit -1;
67
  fi
104 68

  
105
# update the update script update-to.sh
106
rsync -r --exclude=.svn ../jenkins-ci/dataportal-version-update/ drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all
69
  curl --output drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz $ARCHIVE_URL
70
  tar xzf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz
107 71

  
108
# update the module and themes
109
cd drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all
110
./update-to.sh $VERSION
72
  # update the update script update-to.sh
73
  rsync -r --exclude=.svn ../jenkins-ci/dataportal-version-update/ drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all
111 74

  
112
# copy the profiles
113
cd ../../
114
rsync -r --exclude=.svn sites/all/modules/cdm_dataportal/profile/ profiles/
75
  # update the module and themes
76
  cd drupal${DRUPAL_VERSION}-cdm_dataportal/sites/all
77
  ./update-to.sh $VERSION
115 78

  
116
# make tar
117
cd ../
118
tar czf drupal${DRUPAL_VERSION}-cdm_dataportal-$VERSION.tar.gz drupal${DRUPAL_VERSION}-cdm_dataportal
119
rm -rf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz
79
  # copy the profiles
80
  cd ../../
81
  rsync -r --exclude=.svn sites/all/modules/cdm_dataportal/profile/ profiles/
82

  
83
  # make tar
84
  cd ../
85
  tar czf drupal${DRUPAL_VERSION}-cdm_dataportal-$VERSION.tar.gz drupal${DRUPAL_VERSION}-cdm_dataportal
86
  rm -rf drupal${DRUPAL_VERSION}-cdm_dataportal.tar.gz
87
fi
120 88

  
121 89
# create the new folder on the server and upload everything
122 90
ssh ${SSH_HOST} "rm -rf /var/www/download/dataportal/$VERSION"
......
124 92
ssh ${SSH_HOST} "rm -r /var/www/download/dataportal/stable"
125 93
ssh ${SSH_HOST} "ln -s /var/www/download/dataportal/$VERSION /var/www/download/dataportal/stable"
126 94
scp cdm_dataportal-${VERSION}.tar.gz ${SSH_HOST}:/var/www/download/dataportal/${VERSION}/
127
scp drupal${DRUPAL_VERSION}-cdm_dataportal-${VERSION}.tar.gz ${SSH_HOST}:/var/www/download/dataportal/${VERSION}/
128

  
95
if $DO_CREATE_DRUPAL_INSTALLER ; then
96
  scp drupal${DRUPAL_VERSION}-cdm_dataportal-${VERSION}.tar.gz ${SSH_HOST}:/var/www/download/dataportal/${VERSION}/
97
fi
98
  
129 99
# DONE
130 100
echo "cdm_dataportal deployment done!"
131 101

  
modules/cdm_dataportal/jenkins-ci/release-prepare.sh
1
#!/bin/bash
2

  
3
###############################################################################
4
#
5
# Performes preparation tasks for the release of the cdm-dataportal project:
6
# 
7
# 1. compile the SASS code to css without development features
8
# 2. commit and push the the production ready css
9
#
10
###############################################################################
11

  
12

  
13

  
14
if [ -z "$1" ]; then
15
	echo "version parameter missing\nUsage: deploy.sh <version-number>"
16
  exit -1
17
fi
18
VERSION=$1
19

  
20
# $WORKSPACE is an environment variable set by jenkins
21
if [ -z "$WORKSPACE" ]; then
22
  echo "ERROR: environment variable WORKSPACE should be set by jenkins but is missing."
23
  exit -1
24
fi
25

  
26

  
27
#
28
# compile the sass files to css in the zen_dataportal theme
29
# this will create the versions needed for production
30
#
31
if [ -x "$COMPASS" ]; then 
32
  
33
  git checkout release/$VERSION
34
  git pull --rebase
35

  
36
  $COMPASS clean $WORKSPACE/themes/zen_dataportal/
37
  $COMPASS compile $WORKSPACE/themes/zen_dataportal/
38
  
39
  git push origin release/$VERSION
40
  
41
else 
42
  echo "ERROR on sass compilation since the evnvironment variable COMPASS is either missing or not the file "$COMPASS" is not executable."
43
  exit 1
44
fi
45

  
46
echo "cdm_dataportal release preparation done!"
47

  
48

  
49

  
50

  
51

  
52

  
53

  
54

  
55

  
56

  

Also available in: Unified diff