This repository was archived by the owner on May 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
executable file
·81 lines (71 loc) · 1.95 KB
/
Jenkinsfile
File metadata and controls
executable file
·81 lines (71 loc) · 1.95 KB
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
#!groovy
pipeline {
agent {
label 'master'
}
stages {
stage('Pull Docker Parent Image') {
steps {
img_parent_pull()
}
}
stage('Execute unit tests') {
agent {
docker {
image 'smartlab/flask-dataviz:latest'
args '-u root:root'
reuseNode true
}
}
environment {
PYTHONPATH = "${pwd()}/app:$PYTHONPATH"
PYTHONDONTWRITEBYTECODE = 1
}
steps {
executeUnitTests()
}
post {
always {
junit 'app/test/report.xml'
step([$class: 'CoberturaPublisher', coberturaReportFile: 'app/test/coverage/coverage.xml'])
}
}
}
// stage('SonarQube analysis') {
// steps {
// sonarScanner()
// }
// }
stage('Build and Register Image') {
steps {
buildAndRegisterImage()
}
}
}
}
def img_parent_pull() {
//pull img docker
def img_flask = docker.image('smartlab/flask-dataviz:latest')
img_flask.pull()
}
def executeUnitTests() {
//dir ("app") {
sh "pip3 install -r requirements.txt"
sh "pip3 install nose2"
sh "nose2 --config app/test/nose2.cfg --with-cov --coverage-report xml --coverage-config app/test/coverage/.coveragerc"
//}
}
def sonarScanner() {
//dir ("app") {
def scannerHome = tool 'sonar'
withSonarQubeEnv('Sonar - MPT') {
sh "${scannerHome}/bin/sonar-scanner -Dproject.settings=./sonar-project.properties"
}
//}
}
def buildAndRegisterImage() {
docker.withRegistry("${DOCKER_REGISTRY}", 'docker-registry.mpt') {
def img = docker.build("${NOME_IMAGEM_DOCKER}", "--no-cache --pull --rm .")
img.push("${VERSAO}")
}
}