-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
151 lines (136 loc) · 5.4 KB
/
Jenkinsfile
File metadata and controls
151 lines (136 loc) · 5.4 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
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
151
@Library("islog-helper") _
pipeline {
agent none
options {
disableConcurrentBuilds()
}
triggers {
gitlab(triggerOnPush: true,
triggerOnMergeRequest: true,
branchFilterType: 'All')
}
environment {
// Fix MSBuild issue for Windows builds.
MSBUILDDISABLENODEREUSE = 1
PACKAGE_NAME = "cppkcs11/1.1"
}
stages {
stage('Docker build') {
agent {
docker {
alwaysPull true
image 'artifacts.linq.hidglobal.com:5000/debian_build:latest'
}
}
steps {
sh 'mkdir build'
sh 'cd build && conan install ..'
sh 'cd build && conan build ..'
script {
tokenSlot = initSoftHSM()
echo "Token slot to use: ${tokenSlot}"
withEnv(['CPPKCS11_UNDERLYING_LIBRARY=/usr/lib/softhsm/libsofthsm2.so',
"CPPKCS11_UNITTEST_TOKEN_SLOT=${tokenSlot}",
'CPPKCS11_UNITTEST_PIN=titi',
'SOFTHSM2_CONF=/tmp/softhsm.cfg']) {
sh "cd build && ctest -V"
}
}
}
}
stage('Build Conan Package') {
// Build packages for various configuration we use at Islog.
parallel {
stage('Linux 64 Release GCC 10') {
agent { docker { image 'artifacts.linq.hidglobal.com:5000/debian_build:latest' } }
steps {
script {
conan.installIslogProfiles("$HOME/.conan")
sh "conan create -pr compilers/x64_gcc10_release ."
sh "conan upload ${PACKAGE_NAME} -r islog-test --all --confirm --check --force"
}
}
}
stage('Linux 64 Debug GCC 10') {
agent { docker { image 'artifacts.linq.hidglobal.com:5000/debian_build:latest' } }
steps {
script {
conan.installIslogProfiles("$HOME/.conan")
sh "conan create -pr compilers/x64_gcc10_debug ."
sh "conan upload ${PACKAGE_NAME} -r islog-test --all --confirm --check --force"
}
}
}
stage('Windows 64 Release') {
agent { label 'win2016' }
steps {
script {
conan.withFreshWindowsConanCache {
bat "conan create -pr compilers/x64_msvc_release ."
bat "conan upload ${PACKAGE_NAME} -r islog-test --all --confirm --check --force"
}
}
}
}
stage('Windows 64 Debug') {
agent { label 'win2016' }
steps {
script {
conan.withFreshWindowsConanCache {
bat "conan create -pr compilers/x64_msvc_debug ."
bat "conan upload ${PACKAGE_NAME} -r islog-test --all --confirm --check --force"
}
}
}
}
stage('Windows 32 Release') {
agent { label 'win2016' }
steps {
script {
conan.withFreshWindowsConanCache {
bat "conan create -pr compilers/x86_msvc_release ."
bat "conan upload ${PACKAGE_NAME} -r islog-test --all --confirm --check --force"
}
}
}
}
stage('Windows 32 Debug') {
agent { label 'win2016' }
steps {
script {
conan.withFreshWindowsConanCache {
bat "conan create -pr compilers/x86_msvc_debug ."
bat "conan upload ${PACKAGE_NAME} -r islog-test --all --confirm --check --force"
}
}
}
}
}
}
}
}
def initSoftHSM() {
script {
// Write the softhsm config file...
writeFile(file: 'softhsm.cfg',
text: """#SoftHSM v2 configuration file
directories.tokendir = /tmp/
objectstore.backend = file
# ERROR, WARNING, INFO, DEBUG
log.level = ERROR
# If CKF_REMOVABLE_DEVICE flag should be set
slots.removable = false
""")
// Now move it... apparently writeFile cannot write absolute file...
sh 'mv softhsm.cfg /tmp'
sh 'cat /tmp/softhsm.cfg'
withEnv(['SOFTHSM2_CONF=/tmp/softhsm.cfg']) {
output = sh(script: '/usr/bin/softhsm2-util --init-token --label "Toto" --pin "titi" --so-pin "tata" --slot 0',
returnStdout: true)
// Sample output: "The token has been initialized and is reassigned to slot 68347983"
String[] parsed
parsed = output.split(' ')
return parsed[10]
}
}
}