mirror of https://github.com/OpenVidu/openvidu.git
Jenkinsfile: return if error in script
parent
67ea4f0491
commit
b7f492fead
|
@ -19,7 +19,7 @@
|
||||||
"ts-node": "9.0.0",
|
"ts-node": "9.0.0",
|
||||||
"tslint": "6.1.3",
|
"tslint": "6.1.3",
|
||||||
"typedoc": "0.19.2",
|
"typedoc": "0.19.2",
|
||||||
"typescript": "3.8.3"
|
"typescript": "3.9.2"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|
|
@ -11,162 +11,134 @@ node('container') {
|
||||||
def mycontainer = docker.image('openvidu/openvidu-test-e2e:$DISTRO')
|
def mycontainer = docker.image('openvidu/openvidu-test-e2e:$DISTRO')
|
||||||
mycontainer.pull()
|
mycontainer.pull()
|
||||||
mycontainer.inside('--name e2e -p 4200:4200 -p 4443:4443 -p 5555:5555 -u root -e MY_UID=0 -v /var/run/docker.sock:/var/run/docker.sock:rw -v /dev/shm:/dev/shm -v /opt/openvidu:/opt/openvidu --privileged') {
|
mycontainer.inside('--name e2e -p 4200:4200 -p 4443:4443 -p 5555:5555 -u root -e MY_UID=0 -v /var/run/docker.sock:/var/run/docker.sock:rw -v /dev/shm:/dev/shm -v /opt/openvidu:/opt/openvidu --privileged') {
|
||||||
try {
|
|
||||||
stage('Preparation') {
|
stage('Preparation') {
|
||||||
sh 'rm -rf ~/.m2 || true'
|
sh 'rm -rf ~/.m2 || true'
|
||||||
sh 'rm -rf openvidu || true'
|
sh 'rm -rf openvidu || true'
|
||||||
sh 'rm -rf kurento-java || true'
|
sh 'rm -rf kurento-java || true'
|
||||||
sh 'git clone https://github.com/OpenVidu/openvidu.git'
|
sh 'git clone https://github.com/OpenVidu/openvidu.git'
|
||||||
sh 'cd openvidu && git fetch --all && git checkout $OPENVIDU_COMMIT'
|
sh 'cd openvidu && git fetch --all && git checkout $OPENVIDU_COMMIT'
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
if $KURENTO_JAVA_SNAPSHOT ; then
|
if $KURENTO_JAVA_SNAPSHOT ; then
|
||||||
git clone https://github.com/Kurento/kurento-java.git
|
git clone https://github.com/Kurento/kurento-java.git
|
||||||
cd kurento-java && MVN_VERSION=$(mvn --batch-mode -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
cd kurento-java && MVN_VERSION=$(mvn --batch-mode -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
||||||
cd ../openvidu && mvn --batch-mode versions:set-property -Dproperty=version.kurento -DnewVersion=$MVN_VERSION
|
cd ../openvidu && mvn --batch-mode versions:set-property -Dproperty=version.kurento -DnewVersion=$MVN_VERSION
|
||||||
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-client:$MVN_VERSION
|
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-client:$MVN_VERSION
|
||||||
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-jsonrpc-client-jetty:$MVN_VERSION
|
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-jsonrpc-client-jetty:$MVN_VERSION
|
||||||
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-jsonrpc-server:$MVN_VERSION
|
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-jsonrpc-server:$MVN_VERSION
|
||||||
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-test:$MVN_VERSION
|
mvn dependency:get -DrepoUrl=https://maven.openvidu.io/repository/snapshots/ -Dartifact=org.kurento:kurento-test:$MVN_VERSION
|
||||||
fi
|
fi
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
if $KURENTO_MEDIA_SERVER_DEV ; then
|
if $KURENTO_MEDIA_SERVER_DEV ; then
|
||||||
echo "Upgrading KMS to dev version"
|
echo "Upgrading KMS to dev version"
|
||||||
sudo apt-get update && sudo apt-get install -y aptitude
|
sudo apt-get update && sudo apt-get install -y aptitude
|
||||||
sudo aptitude remove -y kurento-media-server
|
sudo aptitude remove -y kurento-media-server
|
||||||
DISTRO=`lsb_release --codename | cut -f2`
|
DISTRO=`lsb_release --codename | cut -f2`
|
||||||
sudo echo "deb [arch=amd64] http://ubuntu.openvidu.io/dev $DISTRO kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
|
sudo echo "deb [arch=amd64] http://ubuntu.openvidu.io/dev $DISTRO kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
|
||||||
sudo apt-get update && sudo apt-get --yes -o Dpkg::Options::="--force-confnew" install kurento-media-server
|
sudo apt-get update && sudo apt-get --yes -o Dpkg::Options::="--force-confnew" install kurento-media-server
|
||||||
fi
|
fi
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu Browser build') {
|
stage('OpenVidu Browser build') {
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
cd openvidu
|
cd openvidu
|
||||||
if [[ $OPENVIDU_BROWSER_COMMIT != "default" ]]; then
|
if [[ $OPENVIDU_BROWSER_COMMIT != "default" ]]; then
|
||||||
git checkout -f $OPENVIDU_BROWSER_COMMIT
|
git checkout -f $OPENVIDU_BROWSER_COMMIT
|
||||||
fi
|
fi
|
||||||
cd openvidu-browser
|
cd openvidu-browser
|
||||||
npm install --unsafe-perm && npm run build && npm pack
|
npm install --unsafe-perm && npm run build && npm pack
|
||||||
cp openvidu-browser-*.tgz /opt/openvidu
|
cp openvidu-browser-*.tgz /opt/openvidu
|
||||||
cd ..
|
cd ..
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu Node Client build') {
|
stage('OpenVidu Node Client build') {
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
cd openvidu
|
cd openvidu
|
||||||
if [[ $OPENVIDU_NODE_CLIENT_COMMIT != "default" ]]; then
|
if [[ $OPENVIDU_NODE_CLIENT_COMMIT != "default" ]]; then
|
||||||
git checkout -f $OPENVIDU_NODE_CLIENT_COMMIT
|
git checkout -f $OPENVIDU_NODE_CLIENT_COMMIT
|
||||||
fi
|
fi
|
||||||
cd openvidu-node-client
|
cd openvidu-node-client
|
||||||
npm install --unsafe-perm && npm run build && npm pack
|
npm install --unsafe-perm && npm run build && npm pack
|
||||||
cp openvidu-node-client-*.tgz /opt/openvidu
|
cp openvidu-node-client-*.tgz /opt/openvidu
|
||||||
cd ..
|
cd ..
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu TestApp build') {
|
stage('OpenVidu TestApp build') {
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
cd openvidu
|
set -e
|
||||||
if [[ $OPENVIDU_TESTAPP_COMMIT != "default" ]]; then
|
cd openvidu
|
||||||
git checkout -f $OPENVIDU_TESTAPP_COMMIT
|
if [[ $OPENVIDU_TESTAPP_COMMIT != "default" ]]; then
|
||||||
fi
|
git checkout -f $OPENVIDU_TESTAPP_COMMIT
|
||||||
cd openvidu-testapp
|
fi
|
||||||
npm install --unsafe-perm
|
cd openvidu-testapp
|
||||||
npm install /opt/openvidu/openvidu-browser-*.tgz
|
npm install --unsafe-perm
|
||||||
npm install /opt/openvidu/openvidu-node-client-*.tgz
|
npm install /opt/openvidu/openvidu-browser-*.tgz
|
||||||
export NG_CLI_ANALYTICS="false" && ./node_modules/@angular/cli/bin/ng build --prod --output-path=/opt/openvidu/testapp
|
npm install /opt/openvidu/openvidu-node-client-*.tgz
|
||||||
cd ..
|
export NG_CLI_ANALYTICS="false" && ./node_modules/@angular/cli/bin/ng build --prod --output-path=/opt/openvidu/testapp
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
cd ..
|
||||||
'''.stripIndent())
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
}
|
'''.stripIndent())
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu Java Client build') {
|
stage('OpenVidu Java Client build') {
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
cd openvidu
|
cd openvidu
|
||||||
if [[ $OPENVIDU_JAVA_CLIENT_COMMIT != "default" ]]; then
|
if [[ $OPENVIDU_JAVA_CLIENT_COMMIT != "default" ]]; then
|
||||||
git checkout -f $OPENVIDU_JAVA_CLIENT_COMMIT
|
git checkout -f $OPENVIDU_JAVA_CLIENT_COMMIT
|
||||||
fi
|
fi
|
||||||
cd openvidu-java-client
|
cd openvidu-java-client
|
||||||
mvn --batch-mode versions:set -DnewVersion=TEST
|
mvn --batch-mode versions:set -DnewVersion=TEST
|
||||||
mvn clean compile package
|
mvn clean compile package
|
||||||
mvn install:install-file -Dfile=target/openvidu-java-client-TEST.jar -DgroupId=io.openvidu -DartifactId=openvidu-java-client -Dversion=TEST -Dpackaging=jar
|
mvn install:install-file -Dfile=target/openvidu-java-client-TEST.jar -DgroupId=io.openvidu -DartifactId=openvidu-java-client -Dversion=TEST -Dpackaging=jar
|
||||||
git checkout -f $OPENVIDU_COMMIT
|
git checkout -f $OPENVIDU_COMMIT
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu parent build') {
|
stage('OpenVidu parent build') {
|
||||||
sh 'cd openvidu && mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST'
|
sh 'cd openvidu && mvn --batch-mode versions:set-property -Dproperty=version.openvidu.java.client -DnewVersion=TEST'
|
||||||
sh 'cd openvidu && mvn --batch-mode -DskipTests=true clean install'
|
sh 'cd openvidu && mvn --batch-mode -DskipTests=true clean install'
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu Server unit tests') {
|
stage('OpenVidu Server unit tests') {
|
||||||
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.unit.*Test test'
|
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.unit.*Test test'
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu Server integration tests') {
|
stage('OpenVidu Server integration tests') {
|
||||||
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.integration.*Test test'
|
sh 'cd openvidu/openvidu-server && mvn --batch-mode -Dtest=io.openvidu.server.test.integration.*Test test'
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage('OpenVidu Server build') {
|
stage('OpenVidu Server build') {
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
cd openvidu/openvidu-server/src/dashboard && npm install --unsafe-perm && npm install /opt/openvidu/openvidu-browser-*.tgz && export NG_CLI_ANALYTICS="false" && npm run build-prod
|
cd openvidu/openvidu-server/src/dashboard && npm install --unsafe-perm && npm install /opt/openvidu/openvidu-browser-*.tgz && export NG_CLI_ANALYTICS="false" && npm run build-prod
|
||||||
cd ../..
|
cd ../..
|
||||||
mvn --batch-mode package
|
mvn --batch-mode package
|
||||||
cp target/openvidu-server*.jar /opt/openvidu
|
cp target/openvidu-server*.jar /opt/openvidu
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
stage ('Environment Launch') {
|
stage ('Environment Launch') {
|
||||||
sh 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/CN=www.mydom.com/O=My Company LTD./C=US" -keyout /opt/openvidu/testapp/key.pem -out /opt/openvidu/testapp/cert.pem'
|
sh 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/CN=www.mydom.com/O=My Company LTD./C=US" -keyout /opt/openvidu/testapp/key.pem -out /opt/openvidu/testapp/cert.pem'
|
||||||
sh 'cd /opt/openvidu/testapp && http-server -S -p 4200 &> /opt/openvidu/testapp.log &'
|
sh 'cd /opt/openvidu/testapp && http-server -S -p 4200 &> /opt/openvidu/testapp.log &'
|
||||||
sh '/usr/bin/kurento-media-server &> /kms.log &'
|
sh '/usr/bin/kurento-media-server &> /kms.log &'
|
||||||
sh 'until $(curl --insecure --output /dev/null --silent http://127.0.0.1:8888/kurento); do echo "Waiting for KMS..."; sleep 1; done'
|
sh 'until $(curl --insecure --output /dev/null --silent http://127.0.0.1:8888/kurento); do echo "Waiting for KMS..."; sleep 1; done'
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then
|
if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then
|
||||||
echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION"
|
echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION"
|
||||||
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
||||||
else
|
else
|
||||||
echo "Using default openvidu-recording tag"
|
echo "Using default openvidu-recording tag"
|
||||||
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
java -jar -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
|
||||||
fi
|
fi
|
||||||
'''.stripIndent())
|
'''.stripIndent())
|
||||||
sh 'until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:4443/); do echo "Waiting for openvidu-server..."; sleep 2; done'
|
sh 'until $(curl --insecure --output /dev/null --silent --head --fail https://OPENVIDUAPP:MY_SECRET@localhost:4443/); do echo "Waiting for openvidu-server..."; sleep 2; done'
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
currentBuild.result = 'FAILURE'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage ('OpenVidu E2E tests') {
|
stage ('OpenVidu E2E tests') {
|
||||||
try {
|
try {
|
||||||
sh(script: '''#!/bin/bash
|
sh(script: '''#!/bin/bash
|
||||||
|
|
Loading…
Reference in New Issue