-
Notifications
You must be signed in to change notification settings - Fork 49
/
Jenkinsfile
137 lines (119 loc) · 3.1 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
pipeline {
agent {
docker {
image 'ubuntu'
args '-u root:root'
}
}
stages {
stage('Setup Env') {
steps {
sh '''apt-get update
apt-get install -y python3-pip python3-psycopg2 rsync
pip3 install configobj
pip3 install 'pylint>=2.17.0,<3.0.0'
pip3 install six
python3 --version'''
}
}
stage('Install holland') {
steps {
sh '''# Move over to tmp to prevent file permissions issues
mkdir -p /tmp/holland
rsync -art $WORKSPACE/ /tmp/holland/
cd /tmp/holland
# Install Holland
python3 setup.py install
# Install Plugins
for i in `ls -d plugins/holland.*`
do
cd /tmp/holland/${i}
python3 setup.py install
exit_code=$?
if [ $exit_code -ne 0 ]
then
echo "Failed installing $i"
exit $exit_code
fi
done
# Install Commvault script
cd /tmp/holland/contrib/holland-commvault/
python3 setup.py install'''
}
}
stage('pylint holland') {
parallel {
stage('pylint holland') {
steps {
sh '''pylint holland
'''
}
}
stage('pylint plugins') {
steps {
sh '''pylint_failed=0
for d in $(ls -d ./plugins/*/holland ./contrib/holland-commvault/holland_commvault)
do
echo $d
pylint $d
if [ $? -ne 0 ] && [ $pylint_failed -ne 1 ]
then
pylint_failed=1
fi
done
if [ $pylint_failed -ne 0 ]
then
echo "Pylint failed; please review above output."
exit $pylint_failed
fi'''
}
}
}
}
stage('Setup holland') {
parallel {
stage('Setup holland') {
steps {
sh '''mkdir -p /etc/holland/providers /etc/holland/backupsets /var/log/holland /var/spool/holland
cp ${WORKSPACE}/config/holland.conf /etc/holland/
cp ${WORKSPACE}/config/providers/* /etc/holland/providers/
'''
}
}
stage('Setup Database') {
steps {
sh '''DEBIAN_FRONTEND=noninteractive apt-get -yq install mysql-server python3-mysqldb|| echo "Ignore errors"
mkdir -p /var/log/mysql/
touch /var/log/mysql/error.log
chown -R mysql:mysql /var/log/mysql
rm -rf /var/lib/mysql/*
mysqld --initialize-insecure --user=mysql 2>>/dev/null >>/dev/null
mkdir -p /var/run/mysqld
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
mysqld_safe --user=mysql 2>>/dev/null >>/dev/null &
sleep 20
'''
}
}
}
}
stage('Test holland') {
steps {
sh '''holland mc --name mysqldump mysqldump
holland mc -f /tmp/mysqldump.conf mysqldump
holland bk mysqldump --dry-run
holland bk mysqldump
holland_cvmysqlsv -bkplevel 1 -attempt 1 -job 123456 -cn 957072-661129 -vm Instance001 --bkset mysqldump
holland mc --name default mysqldump
holland_cvmysqlsv -bkplevel 1 -attempt 1 -job 123456 -cn 957072-661129 -vm Instance001
# Stopgap measure to check for issue 213
sed -i \'s|^estimate-method = plugin$|estimate-method = const:1K|\' /etc/holland/backupsets/mysqldump.conf
holland bk mysqldump
# test that split command is working as expected
sed -i \'s|^split = no|split = yes|\' /etc/holland/backupsets/mysqldump.conf
holland bk mysqldump
'''
}
}
}
}