-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
37 lines (37 loc) · 1.16 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
pipeline {
agent any
environment {
ID = "${env.GIT_BRANCH}-${env.BUILD_ID}";
}
stages {
stage('Build') {
steps {
sh 'docker-compose -p $ID build'
}
}
stage('Test') {
steps {
sh 'mkdir reports && chmod 777 reports'
sh 'docker-compose -p $ID run -v $WORKSPACE/reports:/sentinel/reports interfaceserver ./run_tests.sh || true'
junit 'reports/junit.xml'
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'reports/coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
}
}
stage('Publish') {
when {
branch 'master'
}
steps {
sh 'docker tag seandooher/sentinel-iot:$ID seandooher/sentinel-iot:latest'
sh 'docker push seandooher/sentinel-iot:latest'
}
}
}
post {
always {
sh 'docker-compose -p $ID down -v'
sh 'docker container prune -f'
sh 'docker network prune -f'
}
}
}