forked from Percona-QA/package-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
95 lines (95 loc) · 3.81 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
pipeline {
agent {
label "pkgtest"
}
parameters {
string(name: 'UPSTREAM_VERSION', defaultValue: '8.0.18', description: 'Upstream MySQL version')
string(name: 'PS_VERSION', defaultValue: '9', description: 'Percona part of version')
string(name: 'PS_REVISION', defaultValue: '53e606f', description: 'Short git hash for release')
choice(name: 'TEST_DIST', choices: ['bento/ubuntu-18.04','bento/ubuntu-16.04','bento/debian-10','bento/debian-9','bento/centos-8','bento/centos-7','bento/centos-6'], description: 'On which image to run test.')
choice(name: 'INSTALL_REPO', choices: ['testing','main','experimental'], description: 'Repo to install packages from.')
}
stages {
stage('Prepare') {
steps {
script {
currentBuild.displayName = "#${BUILD_NUMBER}-${UPSTREAM_VERSION}-${PS_VERSION}-${TEST_DIST}"
currentBuild.description = "${PS_REVISION}-${INSTALL_REPO}"
env['PS_NODE1_IP'] = "192.168.33.50"
env['PS_NODE2_IP'] = "192.168.33.51"
env['PS_NODE3_IP'] = "192.168.33.52"
env['MYSQL_ROUTER_IP'] = "192.168.33.53"
}
sh '''
export PATH=${PATH}:~/.local/bin
python3 -m venv ${WORKSPACE}/python-venv-molecule
source ${WORKSPACE}/python-venv-molecule/bin/activate
pip3 install wheel
pip3 install molecule ansible python-vagrant testinfra pytest
rm -rf package-testing
git clone https://github.com/Percona-QA/package-testing.git --branch master --depth 1
'''
} //end steps
} //end Prepare stage
stage('Create instances') {
steps {
sh '''
source ${WORKSPACE}/python-venv-molecule/bin/activate
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-server
molecule create
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-router
molecule create
'''
} //end steps
} //end Create instances stage
stage('Install PS servers') {
steps {
sh '''
source ${WORKSPACE}/python-venv-molecule/bin/activate
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-server
molecule converge
'''
} //end steps
} //end Install PS servers
stage('Install router/shell and setup cluster') {
steps {
sh '''
source ${WORKSPACE}/python-venv-molecule/bin/activate
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-router
molecule converge
'''
} //end steps
} //end Install router/shell and setup cluster
stage('Verify PS setup') {
steps {
sh '''
source ${WORKSPACE}/python-venv-molecule/bin/activate
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-server
molecule verify
'''
junit 'package-testing/molecule/ps-innodb-cluster-server/molecule/default/report.xml'
} //end steps
} //end Install router/shell and setup cluster
stage('Verify router and cluster setup') {
steps {
sh '''
source ${WORKSPACE}/python-venv-molecule/bin/activate
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-router
molecule verify
'''
junit 'package-testing/molecule/ps-innodb-cluster-router/molecule/default/report.xml'
} //end steps
} //end Install router/shell and setup cluster
} //end stages
post {
always {
sh '''
source ${WORKSPACE}/python-venv-molecule/bin/activate
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-server
molecule destroy
cd ${WORKSPACE}/package-testing/molecule/ps-innodb-cluster-router
molecule destroy
'''
}
} //end post
} //end pipeline