forked from fido-device-onboard/client-sdk-fidoiot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.yml
159 lines (147 loc) · 4.84 KB
/
Jenkinsfile.yml
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
152
153
154
155
156
157
158
159
node('ccode'){
withEnv([
'REPO_Safestring=https://github.com/intel/safestringlib.git',
'REPO_TinyCBOR=https://github.com/intel/tinycbor.git',
'REPO_METEE=https://github.com/intel/metee.git',
"TEST_DIR=${WORKSPACE}/test-fidoiot"
])
{
stage('Clone Client-SDK'){
cleanWs()
dir('client-sdk'){
checkout scm
}
sh 'git clone -b v1.2.0 "${REPO_Safestring}"'
sh 'git clone "${REPO_TinyCBOR}"'
sh 'git clone "${REPO_METEE}"'
}
stage('Build safestring'){
sh '''
cd $WORKSPACE/safestringlib
echo 'Building safestring'
git checkout v1.2.0
mkdir obj
make
'''
}
stage('Build TinyCBOR'){
sh '''
cd $WORKSPACE/tinycbor
echo 'Building TinyCBOR'
git checkout v0.6.0
make
'''
}
stage('Build METEE'){
sh '''
cd $WORKSPACE/metee
echo 'Building METEE'
git checkout 3.2.3
cmake .
make -j$(nproc)
sudo make install
'''
}
stage('Build ClientSDK'){
sh '''
export SAFESTRING_ROOT=$WORKSPACE/safestringlib
echo $SAFESTRING_ROOT
export TINYCBOR_ROOT=$WORKSPACE/tinycbor
echo $TINYCBOR_ROOT
export METEE_ROOT=$WORKSPACE/metee
echo $METEE_ROOT
export OPENSSL3_ROOT=/opt/openssl
echo $OPENSSL3_ROOT
export CURL_ROOT=/opt/curl
echo $CURL_ROOT
cd $WORKSPACE/client-sdk
$WORKSPACE/client-sdk/build.sh
mkdir client-sdk-binaries
cd client-sdk-binaries
cp -r ../x86_ecdsa256_gcm_bin .
cp -r ../x86_ecdsa256_ccm_bin .
cp -r ../x86_ecdsa384_gcm_bin .
cp -r ../x86_ecdsa384_ccm_bin .
cp -r ../tpm_ecdsa256_gcm_bin .
cp -r ../tpm_ecdsa256_ccm_bin .
cp -r ../tpm_ecdsa384_gcm_bin .
cp -r ../tpm_ecdsa384_ccm_bin .
cp -r ../cse_ecdsa384_gcm_bin .
cp -r ../cse_ecdsa384_ccm_bin .
mkdir utils
cp ../utils/tpm_make_ready_ecdsa.sh utils/
cp ../utils/install_tpm_libs.sh utils/
cp ../utils/install_tpm_libs_rhel.sh utils/
cp ../utils/keys_gen.sh utils/
cd ..
tar -cvzf client-sdk-binaries.tar.gz client-sdk-binaries
'''
print "Archive the artifacts"
archiveArtifacts artifacts: 'client-sdk/client-sdk-binaries.tar.gz', fingerprint: true, allowEmptyArchive: false
}
try
{
stage('Run Smoketest')
{
// Checking out the smoke test code
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'test-fidoiot']], userRemoteConfigs: [[credentialsId: 'sdo-automationgithubtoken', url: 'https://github.com/secure-device-onboard/test-fidoiot']]])
// Creating the required directories
sh '''
mkdir -p test-fidoiot/binaries/pri-fidoiot
mkdir -p test-fidoiot/binaries/client-sdk-fidoiot
'''
// Copying the contents to the folder
print "Copying PRI and Client-SDK artifacts"
copyArtifacts filter: 'demo.tar.gz', fingerprintArtifacts: true, projectName: 'pri-fidoiot/master', selector: lastSuccessful(), target: 'test-fidoiot/binaries/pri-fidoiot/'
print "Extracting PRI and Client-SDK artifacts"
sh '''
tar -xvzf test-fidoiot/binaries/pri-fidoiot/demo.tar.gz
cp -r demo/* test-fidoiot/binaries/pri-fidoiot/
cp client-sdk/x86_ecdsa256_gcm_bin/linux-client test-fidoiot/binaries/client-sdk-fidoiot/
cp -r client-sdk/x86_ecdsa256_gcm_bin/data test-fidoiot/
bash client-sdk/utils/keys_gen.sh test-fidoiot/
'''
// Generating Keys and Copying it back.
sh '''
cd test-fidoiot/binaries/pri-fidoiot/scripts
bash demo_ca.sh
bash web_csr_req.sh
bash user_csr_req.sh
bash keys_gen.sh
chmod -R 777 secrets/
cp -r service.env secrets/ ../aio/
cp -r secrets/ ../db/
sed -i '/<security-constraint>/,/<.security-constraint>/d' ../aio/WEB-INF/web.xml
sed -i '/^innodb/d' ../db/custom/config-file.cnf
'''
// Updating the manufacturer address
sh '''
cd test-fidoiot/data
sed -i 's/8039/8080/g' manufacturer_addr.bin
'''
// Setting the TEST_DIR and executing smoke test
sh'''
cd test-fidoiot/
export TEST_DIR=`pwd`
mvn clean test -Dgroups=fdo_clientsdk_smoketest
'''
}
}
finally
{
// Remove the files
print "Removing the files"
sh'''
rm -f test-fidoiot/linux64.sh
rm -f test-fidoiot/payload.bin
rm -f test-fidoiot/result.txt
rm -rf test-fidoiot/data
'''
print "Pruning docker containers"
sh'''
docker system prune -a -f
'''
}
cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, notFailBuild: true
}
}