forked from open-webrtc-toolkit/owt-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.jenkinsfile
106 lines (100 loc) · 5.33 KB
/
server.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
void setBuildStatus(String message, String state) {
step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "$env.REPO_URL/owt-server"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/server"],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr:'10', artifactNumToKeepStr:'10'))
}
stages {
stage('Build package') {
options { timeout(time:30,unit:'MINUTES') }
steps {
podTemplate(name: "pack-server-centos-"+env.GIT_BRANCH, label: "pack-server-centos-"+env.GIT_BRANCH,
volumes: [
persistentVolumeClaim(claimName: 'centos-package',mountPath: '/root/centos_package',readOnly: false),
persistentVolumeClaim(claimName: 'webrtc79',mountPath: '/root/owt-server/third_party/webrtc-m79',readOnly: false)
],
containers: [
containerTemplate(name: 'build-images', image: "$env.centos_build_images", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '5000m', resourceLimitCpu: '6000m', command: 'cat')
]){
node ("pack-server-centos-"+env.GIT_BRANCH) {
container ('build-images') {
sh "/root/startRun.sh * * centos build owt-server $env.GIT_BRANCH $env.GIT_COMMIT $env.CHANGE_ID"
}
}
}
}
}
stage('Start test') {
options { timeout(time:40,unit:'MINUTES') }
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
parallel {
stage('ConferenceClient API 1') {
steps {
podTemplate(name: 'api-server-centos--'+env.GIT_BRANCH, label: 'api-server-centos-'+env.GIT_BRANCH, cloud: 'kubernetes',
volumes: [
persistentVolumeClaim(claimName: 'centos-package', mountPath: '/root/centos_package', readOnly: false),
persistentVolumeClaim(claimName: 'centos-log', mountPath: '/root/centos_log', readOnly: false)
],
containers: [
containerTemplate(name: 'test-images', image: "$env.centos_test_images", ttyEnabled: true, alwaysPullImage: true, privileged: true,resourceRequestCpu: '3000m', resourceLimitCpu: '4000m', resourceRequestMemory: '2.0Gi', resourceLimitMemory: '3.0Gi', command: 'cat'),
]) {
node('api-server-centos-'+env.GIT_BRANCH) {
container('test-images') {
sh "/root/startRun.sh * * centos test ${env.GIT_COMMIT} ConferenceClient_API_1 $env.GIT_BRANCH"
}
}
}
}
}
stage('ConferenceClient API 2') {
steps {
podTemplate(name:'rest-server-centos-'+env.GIT_BRANCH, label: 'rest-server-centos-'+env.GIT_BRANCH, cloud: 'kubernetes',
volumes: [
persistentVolumeClaim(claimName: 'centos-package', mountPath: '/root/centos_package', readOnly: false),
persistentVolumeClaim(claimName: 'centos-log', mountPath: '/root/centos_log', readOnly: false)
],
containers: [
containerTemplate(name: 'test-images', image: "$env.centos_test_images", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '3000m', resourceLimitCpu: '4000m', resourceRequestMemory: '2.0Gi', resourceLimitMemory: '3.0Gi', command: 'cat'),
]) {
node('rest-server-centos-'+env.GIT_BRANCH) {
container('test-images') {
sh "/root/startRun.sh * * centos test ${env.GIT_COMMIT} ConferenceClient_API_2 $env.GIT_BRANCH"
}
}
}
}
}
}
}
}
post {
always {
script {
sh "curl -H \"Content-Type: application/json\" -X POST --data '{\"commit_id\":\"'$GIT_COMMIT'\",\"job_path\":\"'${env.MCU_CHECK_PATH}'\",\"job_name\":\"'$JOB_BASE_NAME'\",\"build_num\":\"'$BUILD_NUMBER'\",\"os_version\":\"'$env.CENTOS_VERSION'\"}' '${env.checkServerUrl}'/runServer/MCU_BUILD_STEPS"
}
}
success {
script {
if ("${GIT_BRANCH}" == 'master') {
sh "curl ${env.checkServerUrl}/copyNightly/0${GIT_COMMIT}/owt-server/1"
}
}
setBuildStatus("Build succeeded", "SUCCESS");
}
failure {
setBuildStatus("Build failed", "FAILURE");
}
}
}