1 |
6657531f
|
Andreas Kohlbecker
|
#!/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 |
|
|
echo "do not run this script - only kept for reference."
|
12 |
|
|
exit 0
|
13 |
|
|
|
14 |
|
|
#------------------
|
15 |
|
|
|
16 |
|
|
WORKSPACE=$1
|
17 |
|
|
JOB_NAME=$2
|
18 |
|
|
dbUser=$3
|
19 |
|
|
dbPassword=$4
|
20 |
|
|
|
21 |
|
|
dbName="jenkins_$JOB_NAME"
|
22 |
|
|
|
23 |
|
|
drupalBaseURL=http://160.45.63.201/dataportal/
|
24 |
|
|
drupalRoot=/var/www/drupal/
|
25 |
|
|
drupalSiteName="jenkins"
|
26 |
|
|
drupalInstallationProfile="CDM_DataPortal_Testing"
|
27 |
|
|
|
28 |
|
|
cdmServerURL=http://160.45.63.201:8080/cichorieae/
|
29 |
|
|
cdmClassificationUUID=534e190f-3339-49ba-95d9-fa27d5493e3e
|
30 |
|
|
|
31 |
|
|
# copy installation profiles
|
32 |
|
|
echo ">>> copying installation profiles to ${drupalRoot}profiles/"
|
33 |
|
|
svn export ${WORKSPACE}/profile/ /tmp/drupal_profiles
|
34 |
|
|
cp -R /tmp/drupal_profiles/* ${drupalRoot}profiles/
|
35 |
|
|
rm -R /tmp/drupal_profiles
|
36 |
|
|
|
37 |
|
|
# copy module
|
38 |
|
|
#echo ">>> copying module ${drupalRoot}profiles/"
|
39 |
|
|
#rm -R ${drupalRoot}sites/all/modules/cdm_dataportal
|
40 |
|
|
#svn export ${WORKSPACE} ${drupalRoot}/sites/all/modules/
|
41 |
|
|
|
42 |
|
|
# drop all tables in database
|
43 |
|
|
echo ">>> clearing database ..."
|
44 |
|
|
MYSQLCMD="mysql --user=$dbUser --password=$dbPassword -D $dbName"
|
45 |
|
|
$MYSQLCMD -BNe "show tables" | awk '{print "set foreign_key_checks=0; drop table `" $1 "`;"}' | $MYSQLCMD
|
46 |
|
|
unset MYSQLCMD
|
47 |
|
|
|
48 |
|
|
# install drupal site
|
49 |
|
|
echo ">>> installing drupal site ..."
|
50 |
|
|
cd $drupalRoot
|
51 |
|
|
DRUSH="drush --uri=${drupalBaseURL}jenkins/"
|
52 |
|
|
## drush si only works with drupal 7 so the folowing does not yet work
|
53 |
|
|
#yes | drush si --profile=${drupalInstallationProfile} --clean-url=0 --sites-subdir=${drupalSiteName} --db-url=mysql://${dbUser}:${dbPassword}@localhost/${dbName}
|
54 |
|
|
# and we will use a preset sub site directory and ur own install script:
|
55 |
|
|
wget -O /tmp/jenkins-drupal-install ${drupalBaseURL}jenkins/install.php?profile=$drupalInstallationProfile
|
56 |
|
|
rm /tmp/jenkins-drupal-install
|
57 |
|
|
|
58 |
|
|
$DRUSH vset --yes cdm_webservice_url $cdmServerURL
|
59 |
|
|
$DRUSH vset --yes cdm_taxonomictree_uuid $cdmClassificationUUID
|