Jenkinsfile: use checkout plugin instead of git clone command

pull/658/head
pabloFuente 2021-10-26 14:41:26 +02:00
parent a55ad8cd22
commit 2e8536064b
2 changed files with 16 additions and 10 deletions

View File

@ -1,4 +1,7 @@
node('container') { node('container') {
def commitId = "${OPENVIDU_COMMIT}"
checkout([$class: 'GitSCM', branches: [[name: commitId]], userRemoteConfigs: [[url: 'https://github.com/OpenVidu/openvidu']]])
def commonFunctions = load('openvidu-test-e2e/jenkins/commonFunctions.groovy') def commonFunctions = load('openvidu-test-e2e/jenkins/commonFunctions.groovy')
commonFunctions.prepareTestingEnvironment() commonFunctions.prepareTestingEnvironment()
@ -10,12 +13,6 @@ node('container') {
docker.image('openvidu/openvidu-test-e2e:$DISTRO').inside('--name e2e -p 4200:4200 -p 4443:4443 -p 5555:5555 -u root -e MY_UID=0 ' + "${bindsArray}" + ' --privileged') { docker.image('openvidu/openvidu-test-e2e:$DISTRO').inside('--name e2e -p 4200:4200 -p 4443:4443 -p 5555:5555 -u root -e MY_UID=0 ' + "${bindsArray}" + ' --privileged') {
stage('Preparation') { stage('Preparation') {
sh 'rm -rf ~/.m2/repository/io/openvidu || true'
sh 'rm -rf ~/.m2/repository/org/kurento || true'
sh 'rm -rf openvidu || true'
sh 'rm -rf kurento-java || true'
sh 'git clone https://github.com/OpenVidu/openvidu.git'
sh 'cd openvidu && git fetch --all && git checkout $OPENVIDU_COMMIT'
sh(script: '''#!/bin/bash -xe sh(script: '''#!/bin/bash -xe
if [[ $KURENTO_JAVA_COMMIT != "default" ]]; then if [[ $KURENTO_JAVA_COMMIT != "default" ]]; then
git clone https://github.com/Kurento/kurento-java.git git clone https://github.com/Kurento/kurento-java.git

View File

@ -3,6 +3,15 @@ def prepareTestingEnvironment() {
println('Deleting folder /opt/openvidu') println('Deleting folder /opt/openvidu')
sh 'sudo rm -rf /opt/openvidu/* || true' sh 'sudo rm -rf /opt/openvidu/* || true'
println('Deleting repositories')
sh 'sudo rm -rf openvidu-pro || true'
sh 'sudo rm -rf openvidu || true'
sh 'sudo rm -rf kurento-java || true'
println('Deleting OpenVidu related .m2 dependencies')
sh 'sudo rm -rf /opt/openvidu-cache/.m2/repository/io/openvidu || true'
sh 'sudo rm -rf /opt/openvidu-cache/.m2/repository/org/kurento || true'
println('Removing stranded containers') println('Removing stranded containers')
sh(script: '''#!/bin/bash -xe sh(script: '''#!/bin/bash -xe
declare -a arr=('openvidu/openvidu-test-e2e:', declare -a arr=('openvidu/openvidu-test-e2e:',
@ -57,9 +66,9 @@ def prepareTestingEnvironment() {
sh(script: '''#!/bin/bash -xe sh(script: '''#!/bin/bash -xe
FAKE_VIDEO=/opt/openvidu-cache/barcode.y4m FAKE_VIDEO=/opt/openvidu-cache/barcode.y4m
if [ ! -f $FAKE_VIDEO ]; then 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 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 else
echo "File $FAKE_VIDEO already exists" echo "File $FAKE_VIDEO already exists"
fi fi
sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/barcode.y4m sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/barcode.y4m
'''.stripIndent()) '''.stripIndent())
@ -68,9 +77,9 @@ def prepareTestingEnvironment() {
sh(script: '''#!/bin/bash -xe sh(script: '''#!/bin/bash -xe
FAKE_AUDIO=/opt/openvidu-cache/fakeaudio.wav FAKE_AUDIO=/opt/openvidu-cache/fakeaudio.wav
if [ ! -f $FAKE_AUDIO ]; then 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 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 else
echo "File $FAKE_AUDIO already exists" echo "File $FAKE_AUDIO already exists"
fi fi
sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/fakeaudio.wav sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/fakeaudio.wav
'''.stripIndent()) '''.stripIndent())