-
Notifications
You must be signed in to change notification settings - Fork 11
/
Jenkinsfile
62 lines (62 loc) · 1.15 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
pipeline {
agent {
docker {
image 'docker:20.10.24-cli-alpine3.18'
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}
environment {
HOME = '.'
}
stages {
stage('Debug info') {
steps {
sh 'docker compose --version'
}
}
stage('Build images') {
steps {
sh 'docker compose build'
}
}
stage('Static code analysis') {
steps {
sh 'docker compose run --rm api pycodestyle --config=.pycodestylerc .'
}
}
stage('Unit tests') {
steps {
sh 'docker compose run --rm api python manage.py test'
}
}
stage('deploy QA') {
when{
expression {
return env.BRANCH_NAME == 'develop';
}
}
steps {
sh '''
# No deploy QA
'''
}
}
stage('Store official image') {
when{
expression {
return env.BRANCH_NAME == 'master';
}
}
steps {
sh '''
# No image repository
'''
}
}
stage("Final Cleanup") {
steps {
cleanWs deleteDirs: true, notFailBuild: true
}
}
}
}