-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
85 lines (85 loc) · 2.63 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
pipeline {
agent { label 'appBuilder' }
stages {
stage('Clone Service') {
steps {
git branch: 'master', url: 'https://github.com/alivx/urless.git'
sh label: 'Get current commit', script: 'git log --name-status HEAD^..HEAD > current_commit.meta'
sh label: 'Save Build Meta Data', script: 'echo "${JOBNAME} - ${BUILD_ID}" > build.meta'
}
}
stage("Unit test"){
agent {
// Equivalent to "docker build -f Dockerfile.build --build-arg version=1.0.2 ./build/
dockerfile {
filename 'Dockerfile'
dir 'build'
label 'my-defined-label'
args '-v /tmp:/tmp'
}
}
steps{
sh 'cd api;nosetests --with-xunit'
}
}
stage('Check Code') {
parallel {
stage('safety check') {
steps {
sh 'docker run --rm --volume $(pwd) pyupio/safety:latest safety check'
}
}
stage('bandit') {
steps {
sh 'docker run --rm --volume $(pwd) secfigo/bandit:latest'
}
}
stage('python-taint check') {
steps {
sh 'docker run --rm --volume $(pwd) vickyrajagopal/python-taint-docker pyt .'
}
}
stage('flake8 check') {
steps {
sh 'docker run -i --rm -v $(pwd):/apps alpine/flake8:3.5.0 .'
}
}
}
}
stage('Build') {
steps {
sh 'bash build.sh build'
}
}
stage('Push') {
steps {
sh 'bash build.sh push'
}
}
stage('Pull') {
steps {
sh 'bash build.sh pull'
}
}
stage('Deploy') {
parallel {
stage('RUN') {
steps {
sh 'ssh [email protected] "docker stop urless; docker run --rm -d --name urless -p 8000:8000 alivx/urless:latest"'
}
}
stage('Stop') {
steps {
sleep 10
sh 'ssh [email protected] "docker stop urless "'
}
}
}
}
}
post {
always {
junit 'api/*.xml'
}
}
}