-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
executable file
·104 lines (104 loc) · 2.89 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
pipeline {
agent {
docker {
image 'integritee/integritee-dev:0.2.2'
args '''
-u root
--privileged
'''
}
}
options {
timeout(time: 2, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '14'))
}
stages {
stage('Init rust') {
steps {
sh 'cargo --version'
sh 'rustup show'
sh 'env'
}
}
stage('Build') {
steps {
sh 'export SGX_SDK=/opt/intel/sgxsdk'
sh 'make'
}
}
stage('Archive build output') {
steps {
archiveArtifacts artifacts: 'bin/enclave.signed.so, bin/integritee-*', caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
}
}
stage('Test') {
steps {
sh 'cd cli && cargo test 2>&1 | tee ${WORKSPACE}/test_client.log'
sh 'cd service && cargo test 2>&1 | tee ${WORKSPACE}/test_server.log'
sh 'cd enclave-runtime && cargo test 2>&1 | tee ${WORKSPACE}/test_enclave.log'
}
}
stage('Clippy') {
steps {
sh 'cargo clean'
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'cd cli && cargo clippy 2>&1 | tee ${WORKSPACE}/clippy_client.log'
}
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'cd worker && cargo clippy 2>&1 | tee ${WORKSPACE}/clippy_worker.log'
}
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'cd enclave && cargo clippy 2>&1 | tee ${WORKSPACE}/clippy_enclave.log'
}
}
}
stage('Formatter') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh 'cargo fmt -- --check > ${WORKSPACE}/fmt.log'
}
}
}
stage('Results') {
steps {
recordIssues(
aggregatingResults: true,
enabledForFailure: true,
qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]],
tools: [
groovyScript(
parserId:'clippy-warnings',
pattern: 'clippy_*.log',
reportEncoding: 'UTF-8'
),
groovyScript(
parserId:'clippy-errors',
pattern: 'clippy_*.log',
reportEncoding: 'UTF-8'
)
]
)
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh './ci/check_fmt_log.sh'
}
}
}
stage('Archive logs') {
steps {
archiveArtifacts artifacts: '*.log'
}
}
}
post {
unsuccessful {
emailext (
subject: "Jenkins Build '${env.JOB_NAME} [${env.BUILD_NUMBER}]' is ${currentBuild.currentResult}",
body: "${env.JOB_NAME} build ${env.BUILD_NUMBER} is ${currentBuild.currentResult}\n\nMore info at: ${env.BUILD_URL}",
to: "${env.RECIPIENTS_SUBSTRATEE}"
)
}
always {
cleanWs()
}
}
}