Subversion Repositories SmartDukaan

Rev

Rev 5964 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4894 phani.kuma 1
#!/bin/bash
2
 
3
FROMEMAIL="build@shop2020.in"
4
FROMPASSWORD="cafe@nes"
7229 amit.gupta 5
TOEMAIL="rajveer.singh@shop2020.in,anupam.singh@shop2020.in,amar.kumar@shop2020.in"
4894 phani.kuma 6
MESSAGE=""
7
FILE="/var/log/build.log"
8
 
9
build()
10
{
11
  /opt/apache-maven-3.0.3/bin/mvn clean install -P minify -Ddomain.name=saholic.com -Denv=prod >>$FILE 2>&1;
12
  OUT=$?
13
  if [ $OUT -eq 0 ];then
14
     buildpythonpackages
15
  else
16
     MESSAGE="Maven build failed"
17
     sendmail
18
  fi
19
}
20
 
21
buildpythonpackages()
22
{
23
  cd /root/code/trunk/PyProj/src;
24
  python setup.py bdist_egg;
25
  OUT=$?
26
  if [ $OUT -eq 0 ];then
27
    copycontent
28
  else
29
    MESSAGE="Python egg packing failed"
30
    sendmail
31
  fi
32
}
33
 
34
copycontent()
35
{
36
  cd /root/code/trunk/runutils;
37
  ./copy-wars-to-production.sh >>$FILE
38
  OUT=$?
39
  if [ $OUT -eq 0 ];then
40
     MESSAGE="Build process completed"
41
  else
42
     MESSAGE="Copying content failed"
43
  fi
44
  sendmail
45
}
46
 
47
sendmail()
48
{
49
  if [ $OUT -eq 0 ];then
50
    SUBJECT="Build Successful"
51
  else
52
    SUBJECT="Build failed"
53
  fi
54
 
55
  sendEmail -f "$FROMEMAIL" -s smtp.gmail.com:587 -xu "$FROMEMAIL" -xp "$FROMPASSWORD" -t $TOEMAIL -o tls=yes -u "$SUBJECT" -m "$MESSAGE" -a $FILE
56
}
57
 
58
cd /root/code/trunk;
59
svn up;
60
OUT=$?
61
if [ $OUT -eq 0 ];then
62
  build
63
else
64
  MESSAGE="Svn update failed"
65
  sendmail
66
fi
67