forked from fido-device-onboard/client-sdk-fidoiot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.yml
123 lines (113 loc) · 3.83 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
node('ccode'){
withEnv([
'REPO_Safestring=https://github.com/intel/safestringlib.git',
'REPO_TinyCBOR=https://github.com/intel/tinycbor.git',
"TEST_DIR=${WORKSPACE}/test-fidoiot",
"MANUFACTURER_DB_CONNECT_STRING=jdbc:mariadb://127.0.0.1:3306/sdo",
"RESELLER_DB_CONNECT_STRING=jdbc:mariadb://127.0.0.1:4306/sdo"
])
{
stage('Clone Client-SDK'){
cleanWs()
dir('client-sdk'){
checkout scm
}
sh 'git clone "${REPO_Safestring}"'
sh 'git clone "${REPO_TinyCBOR}"'
}
stage('Build safestring'){
sh '''
cd $WORKSPACE/safestringlib
echo 'Building safestring'
mkdir obj
make
'''
}
stage('Build TinyCBOR'){
sh '''
cd $WORKSPACE/tinycbor
echo 'Building TinyCBOR'
git checkout v0.5.3
make
'''
}
stage('Build ClientSDK'){
sh '''
export SAFESTRING_ROOT=$WORKSPACE/safestringlib
echo $SAFESTRING_ROOT
export TINYCBOR_ROOT=$WORKSPACE/tinycbor
echo $TINYCBOR_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 .
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/
'''
// 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
}
}