1
|
#!/bin/bash
|
2
|
###
|
3
|
# Continous intergration build with jenkins
|
4
|
# call this script from within jenkins with:
|
5
|
# > bash -ex $WORKSPACE/jenkins-ci/integration.sh $WORKSPACE $JOB_NAME $dbUser $dbPassword
|
6
|
#
|
7
|
# references:
|
8
|
# http://thinkshout.com/blog/2010/09/sean/beginners-guide-using-hudson-continuous-integration-drupal
|
9
|
# http://drush.ws/help/3
|
10
|
|
11
|
WORKSPACE=$1
|
12
|
JOB_NAME=$2
|
13
|
dbUser=$3
|
14
|
dbPassword=$4
|
15
|
|
16
|
dbName="jenkins_$JOB_NAME"
|
17
|
|
18
|
drupalBaseURL=http://160.45.63.201/dataportal/
|
19
|
drupalRoot=/var/www/drupal/
|
20
|
drupalSiteName="jenkins"
|
21
|
drupalInstallationProfile="CDM_DataPortal_Testing"
|
22
|
|
23
|
cdmServerURL=http://160.45.63.201:8080/cichorieae/
|
24
|
cdmClassificationUUID=534e190f-3339-49ba-95d9-fa27d5493e3e
|
25
|
|
26
|
# copy installation profiles
|
27
|
echo ">>> copying installation profiles to ${drupalRoot}profiles/"
|
28
|
svn export ${WORKSPACE}/profile/ /tmp/drupal_profiles
|
29
|
cp -R /tmp/drupal_profiles/* ${drupalRoot}profiles/
|
30
|
rm -R /tmp/drupal_profiles
|
31
|
|
32
|
# copy module
|
33
|
#echo ">>> copying module ${drupalRoot}profiles/"
|
34
|
#rm -R ${drupalRoot}sites/all/modules/cdm_dataportal
|
35
|
#svn export ${WORKSPACE} ${drupalRoot}/sites/all/modules/
|
36
|
|
37
|
# drop all tables in database
|
38
|
echo ">>> clearing database ..."
|
39
|
MYSQLCMD="mysql --user=$dbUser --password=$dbPassword -D $dbName"
|
40
|
$MYSQLCMD -BNe "show tables" | awk '{print "set foreign_key_checks=0; drop table `" $1 "`;"}' | $MYSQLCMD
|
41
|
unset MYSQLCMD
|
42
|
|
43
|
# install drupal site
|
44
|
echo ">>> installing drupal site ..."
|
45
|
cd $drupalRoot
|
46
|
DRUSH="drush --uri=${drupalBaseURL}jenkins/"
|
47
|
## drush si only works with drupal 7 so the folowing does not yet work
|
48
|
#yes | drush si --profile=${drupalInstallationProfile} --clean-url=0 --sites-subdir=${drupalSiteName} --db-url=mysql://${dbUser}:${dbPassword}@localhost/${dbName}
|
49
|
# and we will use a preset sub site directory and ur own install script:
|
50
|
wget -O /tmp/jenkins-drupal-install ${drupalBaseURL}jenkins/install.php?profile=$drupalInstallationProfile
|
51
|
rm /tmp/jenkins-drupal-install
|
52
|
|
53
|
$DRUSH vset --yes cdm_webservice_url $cdmServerURL
|
54
|
$DRUSH vset --yes cdm_taxonomictree_uuid $cdmClassificationUUID
|