From 4dec44c8079b44b3424b4690a78a0a1182936554 Mon Sep 17 00:00:00 2001
From: lijinxia <13636630844@163.com>
Date: Thu, 27 May 2021 13:20:17 +0800
Subject: [PATCH] add jenkinsfile for p2ptest on k8s (#502)
---
test/ubuntu_p2p.jenkinsfile | 50 +++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 test/ubuntu_p2p.jenkinsfile
diff --git a/test/ubuntu_p2p.jenkinsfile b/test/ubuntu_p2p.jenkinsfile
new file mode 100644
index 00000000..d3073e2e
--- /dev/null
+++ b/test/ubuntu_p2p.jenkinsfile
@@ -0,0 +1,50 @@
+void setBuildStatus(String jsUrl, String message, String state) {
+ step([
+ $class: "GitHubCommitStatusSetter",
+ reposSource: [$class: "ManuallyEnteredRepositorySource", url: jsUrl],
+ contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/p2p"],
+ errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
+ statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
+ ]);
+}
+
+pipeline {
+ agent any
+ options {
+ disableConcurrentBuilds()
+ buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
+ }
+ stages {
+ stage('runJsCI') {
+ options { timeout(time: 30, unit: 'MINUTES') }
+ steps {
+ podTemplate(name: 'p2ptest-ubuntu-'+env.GIT_BRANCH, label: 'p2ptest-ubuntu-'+env.GIT_BRANCH,
+ containers: [
+ containerTemplate(name: 'p2ptest-images', image: "$env.ubuntu_p2p_images", ttyEnabled: true, privileged: true, resourceRequestCpu: '5000m', resourceLimitCpu: '6000m' , command: 'cat')
+ ]){
+ node('p2ptest-ubuntu-'+env.GIT_BRANCH) {
+ checkout scm
+ container('p2ptest-images') {
+ sh "python ${env.startServerScript} --p2p-server-path ${env.p2pServerPath} \
+ --owner open-webrtc-toolkit --repo owt-client-javascript --commit-id ${GIT_COMMIT} \
+ --git-branch ${GIT_BRANCH} --github-script ${env.GithubScriptPath} --mode p2p --workspace ${WORKSPACE}"
+ sh "python ${env.jsCiScriptPath}/runTest.py --mode ci --source-path ${WORKSPACE} \
+ --browsers chrome --mode ci --owner open-webrtc-toolkit --repo owt-client-javascript \
+ --git-branch ${GIT_BRANCH} --github-script ${env.GithubScriptPath}"
+ }
+ }
+ }
+ }
+ }
+ }
+
+ post {
+ success {
+ setBuildStatus("${env.jsUrl}", "Build succeeded", "SUCCESS");
+ }
+ failure {
+ setBuildStatus("${env.jsUrl}", "Build failed", "FAILURE");
+ }
+ }
+}
+