-
Notifications
You must be signed in to change notification settings - Fork 41
/
Jenkinsfile
50 lines (44 loc) · 1.32 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
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr:'5'))
}
stages {
stage('Checkout sources') {
steps {
checkout scm
}
}
stage('Build') {
agent {
dockerfile {
filename 'Dockerfile'
reuseNode true
}
}
steps {
sh 'cp /build/*.vsix .'
sh 'cp /build/spdx-report.json .'
sh 'cp /build/stats.txt .'
script {
def issues = sh(script: 'cat /build/total-issues.txt', returnStdout: true).trim().toInteger()
def lines = sh(script: 'cat /build/total-lines.txt', returnStdout: true).trim().toInteger()
def errorsPerThousandLines = (issues / lines) * 1000
echo "Total lines of code: ${lines}"
echo "Total issues: ${issues}"
echo "Errors per thousand lines: ${errorsPerThousandLines}"
}
}
}
stage('Archive Artifacts') {
steps {
archiveArtifacts artifacts: '*.vsix, spdx-report.json, stats.txt'
}
}
}
post {
always {
cleanWs()
}
}
}