|
| 1 | +void setBuildStatus(String jsUrl, String message, String state) { |
| 2 | + step([ |
| 3 | + $class: "GitHubCommitStatusSetter", |
| 4 | + reposSource: [$class: "ManuallyEnteredRepositorySource", url: jsUrl], |
| 5 | + contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/p2p"], |
| 6 | + errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], |
| 7 | + statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] |
| 8 | + ]); |
| 9 | +} |
| 10 | + |
| 11 | +pipeline { |
| 12 | + agent any |
| 13 | + options { |
| 14 | + disableConcurrentBuilds() |
| 15 | + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) |
| 16 | + } |
| 17 | + stages { |
| 18 | + stage('runJsCI') { |
| 19 | + options { timeout(time: 30, unit: 'MINUTES') } |
| 20 | + steps { |
| 21 | + podTemplate(name: 'p2ptest-ubuntu-'+env.GIT_BRANCH, label: 'p2ptest-ubuntu-'+env.GIT_BRANCH, |
| 22 | + containers: [ |
| 23 | + containerTemplate(name: 'p2ptest-images', image: "$env.ubuntu_p2p_images", ttyEnabled: true, privileged: true, resourceRequestCpu: '5000m', resourceLimitCpu: '6000m' , command: 'cat') |
| 24 | + ]){ |
| 25 | + node('p2ptest-ubuntu-'+env.GIT_BRANCH) { |
| 26 | + checkout scm |
| 27 | + container('p2ptest-images') { |
| 28 | + sh "python ${env.startServerScript} --p2p-server-path ${env.p2pServerPath} \ |
| 29 | + --owner open-webrtc-toolkit --repo owt-client-javascript --commit-id ${GIT_COMMIT} \ |
| 30 | + --git-branch ${GIT_BRANCH} --github-script ${env.GithubScriptPath} --mode p2p --workspace ${WORKSPACE}" |
| 31 | + sh "python ${env.jsCiScriptPath}/runTest.py --mode ci --source-path ${WORKSPACE} \ |
| 32 | + --browsers chrome --mode ci --owner open-webrtc-toolkit --repo owt-client-javascript \ |
| 33 | + --git-branch ${GIT_BRANCH} --github-script ${env.GithubScriptPath}" |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + } |
| 40 | + |
| 41 | + post { |
| 42 | + success { |
| 43 | + setBuildStatus("${env.jsUrl}", "Build succeeded", "SUCCESS"); |
| 44 | + } |
| 45 | + failure { |
| 46 | + setBuildStatus("${env.jsUrl}", "Build failed", "FAILURE"); |
| 47 | + } |
| 48 | + } |
| 49 | +} |
| 50 | + |
0 commit comments