Jenkinsfile: check env variables instead of parameterizing them

pull/658/head
pabloFuente 2021-10-26 15:21:08 +02:00
parent e80c17cc04
commit e867e7963d
2 changed files with 11 additions and 5 deletions

View File

@ -2,7 +2,7 @@ node('container') {
// Load and execute common functions Groovy script // Load and execute common functions Groovy script
sh 'curl -O https://raw.githubusercontent.com/OpenVidu/openvidu/master/openvidu-test-e2e/jenkins/commonFunctions.groovy' sh 'curl -O https://raw.githubusercontent.com/OpenVidu/openvidu/master/openvidu-test-e2e/jenkins/commonFunctions.groovy'
def commonFunctions = load 'commonFunctions.groovy' def commonFunctions = load 'commonFunctions.groovy'
commonFunctions.prepareTestingEnvironment("${DISTRO}", "${MEDIASOUP_CONTROLLER_DOCKER_VERSION}") commonFunctions.prepareTestingEnvironment()
// Clone and checkout OpenVidu/openvidu repository // Clone and checkout OpenVidu/openvidu repository
def commitId = "${OPENVIDU_COMMIT}" def commitId = "${OPENVIDU_COMMIT}"

View File

@ -1,5 +1,5 @@
#!groovy #!groovy
def prepareTestingEnvironment(def DISTRO, def MEDIASOUP_CONTROLLER_DOCKER_VERSION) { 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'
@ -41,10 +41,14 @@ def prepareTestingEnvironment(def DISTRO, def MEDIASOUP_CONTROLLER_DOCKER_VERSIO
println('Pulling containers') println('Pulling containers')
parallel ( parallel (
'Pull openvidu/openvidu-test-e2e': { 'Pull openvidu/openvidu-test-e2e': {
docker.image('openvidu/openvidu-test-e2e:$DISTRO').pull() if (env.DISTRO) {
docker.image('openvidu/openvidu-test-e2e:$DISTRO').pull()
}
}, },
'Pull openvidu/openvidu-pro-test-e2e': { 'Pull openvidu/openvidu-pro-test-e2e': {
docker.image('openvidu/openvidu-pro-test-e2e:$DISTRO').pull() if (env.DISTRO) {
docker.image('openvidu/openvidu-pro-test-e2e:$DISTRO').pull()
}
}, },
'Pull selenium/standalone-chrome': { 'Pull selenium/standalone-chrome': {
docker.image('selenium/standalone-chrome:latest').pull() docker.image('selenium/standalone-chrome:latest').pull()
@ -56,7 +60,9 @@ def prepareTestingEnvironment(def DISTRO, def MEDIASOUP_CONTROLLER_DOCKER_VERSIO
docker.image('selenium/standalone-opera:latest').pull() docker.image('selenium/standalone-opera:latest').pull()
}, },
'Pull openvidu/mediasoup-controller': { 'Pull openvidu/mediasoup-controller': {
docker.image('openvidu/mediasoup-controller:$MEDIASOUP_CONTROLLER_DOCKER_VERSION').pull() if (env.MEDIASOUP_CONTROLLER_DOCKER_VERSION) {
docker.image('openvidu/mediasoup-controller:$MEDIASOUP_CONTROLLER_DOCKER_VERSION').pull()
}
} }
) )