-
Notifications
You must be signed in to change notification settings - Fork 186
/
Jenkinsfile
150 lines (150 loc) · 5.56 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// Copyright (c) 2022 DisplayLink (UK) Ltd.
pipeline {
agent {
dockerfile {
filename 'Dockerfile'
label 'linux && big && docker'
}
}
environment {
EVDI_VERSION = sh(script: '''(. ./ci/deb_config; echo $evdi_version)''', returnStdout: true).trim()
}
stages {
stage ('Init') {
steps {
sh '''
EVDI_VERSION_SHORT=$(echo ${EVDI_VERSION} | awk -F '.' '{printf("%d.%d", $1, $2)}')
'''
buildName "evdi-${EVDI_VERSION}-${BUILD_NUMBER}"
}
}
stage ('Style check') {
steps {
sh '''make clean'''
sh '''./ci/run_style_check'''
}
}
stage ('Shellcheck') {
steps {
sh '''find ci module -type f -exec file '{}' + | grep shell | sed 's/:.*$//' | xargs shellcheck'''
}
}
stage('BlackDuck Scan') {
when { anyOf { branch 'main'; branch pattern: "release/v*" } }
environment {
DETECT_JAR_DOWNLOAD_DIR = "${env.WORKSPACE}/synopsys_download"
}
steps {
synopsys_detect detectProperties: "--detect.project.name='Evdi' --detect.project.version.name='${env.GIT_BRANCH}' --detect.excluded.directories=tmp,bd_evdi,synopsys_download --detect.output.path='${env.WORKSPACE}/bd_evdi'", downloadStrategyOverride: [$class: 'ScriptOrJarDownloadStrategy']
}
}
stage ('Build evdi-amd64.deb') {
steps {
dir('publish') {
sh '''../ci/prepare_deb_package amd64 ${BUILD_NUMBER}'''
sh '''../ci/test_deb_package evdi-${EVDI_VERSION}-${BUILD_NUMBER}_amd64.deb'''
}
}
}
stage ('Build evdi-armhf.deb') {
steps {
dir('publish') {
sh '''../ci/prepare_deb_package armhf ${BUILD_NUMBER}'''
sh '''../ci/test_deb_package evdi-${EVDI_VERSION}-${BUILD_NUMBER}_armhf.deb'''
}
}
}
stage ('Build evdi-arm64.deb') {
steps {
dir('publish') {
sh '''../ci/prepare_deb_package arm64 ${BUILD_NUMBER}'''
sh '''../ci/test_deb_package evdi-${EVDI_VERSION}-${BUILD_NUMBER}_arm64.deb'''
}
}
}
stage ('Build pyevdi') {
steps {
sh '''make clean'''
sh '''make -C library'''
sh '''make -C pyevdi'''
}
}
stage('SonarQube Scan') {
steps {
sh '''#!/usr/bin/env bash
make clean
bear -- make all-with-rc-linux
'''
withSonarQubeEnv('SonarQube') {
sh '''
sonar-scanner \
-D sonar.cfamily.compile-commands=compile_commands.json \
-D sonar.projectVersion="${BUILD_NUMBER}"
'''
}
}
}
stage ('Build against released kernels') {
steps {
sh '''#!/usr/bin/env bash
set -e
./ci/build_against_kernel --repo-ci all'''
}
}
stage ('Build against latest rc kernel') {
steps {
sh '''#!/usr/bin/env bash
set -e
./ci/build_against_kernel --repo-ci rc'''
}
}
stage ('Run KUnit tests') {
steps {
sh '''#!/usr/bin/env bash
[ -d tmp/linux ] && (cd tmp/linux; git checkout -f master; git reset --hard origin/master)
./ci/run_kunit'''
}
}
stage ('Publish') {
when { anyOf { branch 'main'; branch pattern: "release/v*" } }
steps {
rtBuildInfo (
captureEnv: true,
maxBuilds: 2048,
maxDays: 1095, // 3 years
deleteBuildArtifacts: true)
rtUpload (
serverId: 'Artifactory',
spec: '''{
"files": [
{
"pattern": "publish/evdi-${EVDI_VERSION}-${BUILD_NUMBER}_amd64.deb",
"target": "swbuilds-scratch/linux/evdi/amd64/${BUILD_DISPLAY_NAME}_amd64.deb"
},
{
"pattern": "publish/evdi-${EVDI_VERSION}-${BUILD_NUMBER}_armhf.deb",
"target": "swbuilds-scratch/linux/evdi/armhf/${BUILD_DISPLAY_NAME}_armhf.deb"
},
{
"pattern": "publish/evdi-${EVDI_VERSION}-${BUILD_NUMBER}_arm64.deb",
"target": "swbuilds-scratch/linux/evdi/arm64/${BUILD_DISPLAY_NAME}_arm64.deb"
}
]}''',
failNoOp: true)
rtPublishBuildInfo (
serverId: 'Artifactory')
}
}
stage ( 'Run job: promote build' )
{
when { anyOf { branch 'main'; branch pattern: "release/v*" } }
steps {
build (
job: 'PPD-POSIX/promote build',
parameters: [string(name: 'SERVER', value: 'DEVELOPMENT'),
string(name: 'buildName', value: "${env.JOB_NAME}".replaceAll('/', " :: ").replaceAll('%2F', " :: ")),
string(name: 'buildNumber', value: "${env.BUILD_NUMBER}")])
}
}
}
}