forked from jenkins-docs/simple-python-pyinstaller-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
95 lines (90 loc) · 2.74 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 none
stages {
stage('Build') {
agent {
docker {
image 'python:2-alpine'
}
}
steps {
sh 'pip install flask'
sh 'python -m py_compile sources/webapp.py'
}
}
stage('Test') {
parallel {
stage('on centos') {
agent {
docker {
image 'qnib/pytest'
}
}
steps {
sh 'ls -la'
sh 'pip install flask'
sh 'py.test --verbose --junit-xml test-reports/results.xml sources/test_webapp.py || true'
}
post {
always {
junit 'test-reports/results.xml'
}
}
}
stage('on debian') {
agent {
docker {
image 'qnib/pytest'
}
}
steps {
sh 'pip install flask'
sh 'py.test --verbose --junit-xml test-reports/results.xml sources/test_webapp.py || true'
}
post {
always {
junit 'test-reports/results.xml'
}
}
}
}
}
stage('Create Artifacts') {
agent {
docker {
image 'cdrx/pyinstaller-linux:python2'
}
}
steps {
sh 'pip install flask'
sh 'pyinstaller --paths=/usr/lib64/python2.7/site-packages/ --onefile sources/webapp.py'
stash includes: 'dist/webapp', name: 'exec_files'
}
post {
success {
archiveArtifacts 'dist/webapp'
}
}
}
stage('Deploy') {
when {
branch 'kjug'
}
agent { label 'master' }
steps {
input message: 'Are you sure to deploy?'
unstash 'exec_files'
sh 'scp -r -o StrictHostKeyChecking=no dist/webapp [email protected]:/var/'
}
}
stage('Smoke Test') {
when {
branch 'kjug'
}
agent { label 'master' }
steps {
sh 'ssh -o StrictHostKeyChecking=no [email protected] ls -la /var/webapp'
}
}
}
}