From 2e8536064b4fd30a75f12af181dd21f2d759a1e9 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Tue, 26 Oct 2021 14:41:26 +0200 Subject: [PATCH] Jenkinsfile: use checkout plugin instead of git clone command --- openvidu-test-e2e/jenkins/Jenkinsfile | 9 +++------ .../jenkins/commonFunctions.groovy | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/openvidu-test-e2e/jenkins/Jenkinsfile b/openvidu-test-e2e/jenkins/Jenkinsfile index 45d69553..80c1adf3 100644 --- a/openvidu-test-e2e/jenkins/Jenkinsfile +++ b/openvidu-test-e2e/jenkins/Jenkinsfile @@ -1,4 +1,7 @@ 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') 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') { 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 if [[ $KURENTO_JAVA_COMMIT != "default" ]]; then git clone https://github.com/Kurento/kurento-java.git diff --git a/openvidu-test-e2e/jenkins/commonFunctions.groovy b/openvidu-test-e2e/jenkins/commonFunctions.groovy index 3ce336a5..a2b8c388 100644 --- a/openvidu-test-e2e/jenkins/commonFunctions.groovy +++ b/openvidu-test-e2e/jenkins/commonFunctions.groovy @@ -3,6 +3,15 @@ def prepareTestingEnvironment() { println('Deleting folder /opt/openvidu') 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') sh(script: '''#!/bin/bash -xe declare -a arr=('openvidu/openvidu-test-e2e:', @@ -57,9 +66,9 @@ def prepareTestingEnvironment() { 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 + 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" + echo "File $FAKE_VIDEO already exists" fi sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/barcode.y4m '''.stripIndent()) @@ -68,9 +77,9 @@ def prepareTestingEnvironment() { 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 + 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" + echo "File $FAKE_AUDIO already exists" fi sudo cp /opt/openvidu-cache/barcode.y4m /opt/openvidu/fakeaudio.wav '''.stripIndent())