forked from fido-device-onboard/pri-fidoiot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile.yml
67 lines (59 loc) · 1.92 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
// This job will be restricted to run only on 'ubuntu18.04-OnDemand' Build machine
node('ubuntu18.04-OnDemand'){
// Stage for checking out the source code
stage('scm checkout'){
cleanWs()
checkout scm
}
// Stage to build the project
stage('build'){
sh 'mvn clean install'
print "Archive the artifacts"
sh 'cd component-samples && tar -czvf demo.tar.gz demo && mv demo.tar.gz ..'
archiveArtifacts artifacts: 'demo.tar.gz', fingerprint: true, allowEmptyArchive: false
}
try
{
// Run the smoke test
stage('Run Smoke test')
{
// 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
mkdir -p test-fidoiot/binaries/pri-fidoiot
'''
// Extract and copy the demo.tar content to the location
sh '''
cp -r component-samples/demo/* test-fidoiot/binaries/pri-fidoiot
cp -r test-fidoiot/binaries/pri-fidoiot/device/* test-fidoiot/
'''
// Setting the TEST_DIR and executing smoke test
sh'''
cd test-fidoiot
export TEST_DIR=`pwd`
mvn clean test -Dgroups=fdo_pri_smoketest
'''
}
}
finally
{
// Remove the files
print "Removing the files"
sh'''
rm -f test-fidoiot/credential.bin
rm -f test-fidoiot/ext_voucher
rm -f test-fidoiot/guid
rm -f test-fidoiot/linux64.sh
rm -f test-fidoiot/payload.bin
rm -f test-fidoiot/result.txt
'''
print "Pruning docker containers"
sh'''
docker system prune -a -f
'''
}
//Clean workspace after build is successfull
cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, notFailBuild: true
}