mirror of https://github.com/OpenVidu/openvidu.git
126 lines
5.3 KiB
Groovy
126 lines
5.3 KiB
Groovy
#!groovy
|
|
def prepareTestingEnvironment() {
|
|
println('Cleaning environment')
|
|
parallel (
|
|
'Deleting folder /opt/openvidu': {
|
|
sh 'sudo rm -rf /opt/openvidu/* || true'
|
|
},
|
|
'Deleting repository openvidu': {
|
|
sh 'sudo rm -rf openvidu || true'
|
|
},
|
|
'Deleting repository openvidu-pro': {
|
|
sh 'sudo rm -rf openvidu-pro || true'
|
|
},
|
|
'Deleting repository kurento-java': {
|
|
sh 'sudo rm -rf kurento-java || true'
|
|
},
|
|
'Deleting openvidu .m2 dependencies': {
|
|
sh 'sudo rm -rf /opt/openvidu-cache/.m2/repository/io/openvidu || true'
|
|
},
|
|
'Deleting kurento .m2 dependencies': {
|
|
sh 'sudo rm -rf /opt/openvidu-cache/.m2/repository/org/kurento || true'
|
|
},
|
|
'Removing stranded containers': {
|
|
removeStrandedContainers(true)
|
|
}
|
|
)
|
|
|
|
println('Pulling containers and downloading files')
|
|
parallel (
|
|
'Pull openvidu/openvidu-test-e2e': {
|
|
if (env.DISTRO) {
|
|
docker.image("openvidu/openvidu-test-e2e:${DISTRO}").pull()
|
|
}
|
|
},
|
|
'Pull openvidu/openvidu-pro-test-e2e': {
|
|
if (env.DISTRO) {
|
|
docker.image("openvidu/openvidu-pro-test-e2e:${DISTRO}").pull()
|
|
}
|
|
},
|
|
'Pull selenium/standalone-chrome': {
|
|
docker.image('selenium/standalone-chrome:latest').pull()
|
|
},
|
|
'Pull selenium/standalone-firefox': {
|
|
docker.image('selenium/standalone-firefox:latest').pull()
|
|
},
|
|
'Pull selenium/standalone-opera': {
|
|
docker.image('selenium/standalone-opera:latest').pull()
|
|
},
|
|
'Pull selenium/standalone-edge': {
|
|
docker.image('selenium/standalone-edge:latest').pull()
|
|
},
|
|
'Pull openvidu/mediasoup-controller': {
|
|
if (env.MEDIASOUP_CONTROLLER_VERSION) {
|
|
docker.image("openvidu/mediasoup-controller:${MEDIASOUP_CONTROLLER_VERSION}").pull()
|
|
}
|
|
},
|
|
'Pull kurento/kurento-media-server': {
|
|
if (env.KURENTO_MEDIA_SERVER_VERSION) {
|
|
docker.image("kurento/kurento-media-server:${KURENTO_MEDIA_SERVER_VERSION}").pull()
|
|
}
|
|
},
|
|
'Download fake video': {
|
|
sh(script: '''#!/bin/bash -xe
|
|
FAKE_VIDEO=/opt/openvidu-cache/barcode.y4m
|
|
if [ ! -f ${FAKE_VIDEO} ]; then
|
|
sudo curl --location https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/barcode.y4m --create-dirs --output /opt/openvidu-cache/barcode.y4m
|
|
else
|
|
echo "File ${FAKE_VIDEO} already exists"
|
|
fi
|
|
sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/barcode.y4m
|
|
'''.stripIndent())
|
|
},
|
|
'Download fake audio': {
|
|
sh(script: '''#!/bin/bash -xe
|
|
FAKE_AUDIO=/opt/openvidu-cache/fakeaudio.wav
|
|
if [ ! -f ${FAKE_AUDIO} ]; then
|
|
sudo curl --location https://github.com/OpenVidu/openvidu/raw/master/openvidu-test-e2e/docker/fakeaudio.wav --create-dirs --output /opt/openvidu-cache/fakeaudio.wav
|
|
else
|
|
echo "File ${FAKE_AUDIO} already exists"
|
|
fi
|
|
sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/fakeaudio.wav
|
|
'''.stripIndent())
|
|
},
|
|
'Download custom layout': {
|
|
sh 'sudo curl --location https://raw.githubusercontent.com/OpenVidu/openvidu/master/openvidu-test-e2e/docker/my-custom-layout/index.html --create-dirs --output /opt/openvidu-cache/test-layouts/layout1/index.html'
|
|
}
|
|
)
|
|
}
|
|
|
|
def removeStrandedContainers(removeTestingContainers) {
|
|
println('Removing stranded containers')
|
|
script {
|
|
env.removeTestingContainers = removeTestingContainers
|
|
sh(script: '''#!/bin/bash -xe
|
|
declare -a arr=("selenium/standalone-chrome:"
|
|
"selenium/standalone-firefox:"
|
|
"selenium/standalone-opera:"
|
|
"selenium/standalone-edge:"
|
|
"openvidu/mediasoup-controller:"
|
|
"openvidu/openvidu-server-pro:"
|
|
"openvidu/openvidu-redis:"
|
|
"openvidu/openvidu-coturn:"
|
|
"openvidu/openvidu-proxy:"
|
|
"openvidu/replication-manager:"
|
|
"docker.elastic.co/elasticsearch/elasticsearch:"
|
|
"docker.elastic.co/kibana/kibana:"
|
|
"docker.elastic.co/beats/metricbeat-oss:"
|
|
"docker.elastic.co/beats/filebeat-oss:"
|
|
"openvidu/openvidu-pro-dind-media-node:"
|
|
"kurento/kurento-media-server:"
|
|
"openvidu/media-node-controller:")
|
|
if [ "${removeTestingContainers}" == "true" ]; then
|
|
arr+=("openvidu/openvidu-test-e2e:")
|
|
arr+=("openvidu/openvidu-pro-test-e2e:")
|
|
fi
|
|
for image in "${arr[@]}"
|
|
do
|
|
docker ps -a | awk '{ print $1,$2 }' | grep "${image}" | awk '{ print $1 }' | xargs -I {} docker rm -f {} || true
|
|
done
|
|
docker ps -a
|
|
'''.stripIndent())
|
|
}
|
|
}
|
|
|
|
return this
|