Skip to content

Commit

Permalink
Executing test runs in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
ashahi1 committed Feb 12, 2018
1 parent 3b51ef1 commit 4a14f39
Showing 1 changed file with 203 additions and 89 deletions.
292 changes: 203 additions & 89 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,114 +1,228 @@
node("vdvs-slave-two") {
pipeline {
agent none

def app

dir('vsphere-storage-for-docker') {
sh "echo Deleting \\${JOB_NAME} "
deleteDir()
}

stages {
stage('Checkout code') {
/* Let's make sure we have the repository cloned to our workspace.*/
checkout scm
/* sh "cat Jenkinsfile" */
failFast true
parallel {
stage('Checkout on vdvs-slave-2') {
/* Let's make sure we have the repository cloned to our workspace. */
agent {
label "vdvs-slave-two"
}
steps {
// sh "printenv"
sh "echo ${env.GOVC_USERNAME}@$VM1"
checkout scm
}
}
stage('Checkout on vdvs-slave-3') {
/* Let's make sure we have the repository cloned to our workspace..*/
agent {
label "vdvs-slave-three"
}
steps {
sh "printenv"
sh "echo ${env.GOVC_USERNAME}@$VM1"
checkout scm
}
}
}
}

stage('Build binaries') {
/* This builds binaries */
failFast true
parallel {
stage('Build binaries on vdvs-slave-2') {
agent {
label "vdvs-slave-two"
}
steps {
sh "whoami"
sh "echo Building the VDVS binaries"
sh "export PKG_VERSION=$BUILD_NUMBER"
sh "make build-all"
}
}

sh "echo Building the VDVS binaries"
sh "export PKG_VERSION=$BUILD_NUMBER"
sh "make build-all"
stage('Build binaries on vdvs-slave-3') {
agent {
label "vdvs-slave-three"
}
steps {
sh "whoami"
sh "echo Building the VDVS binaries"
sh "export PKG_VERSION=$BUILD_NUMBER"
sh "make build-all"
}
}
}
}

stage('Deploy - 6.5 setup') {
/* This deploys the actual code */
stage('Deployment') {
failFast true
parallel {
stage('Deploy VDVS On 6.5 setup') {
agent {
label "vdvs-slave-two"
}
steps {
sh "echo Deployment On 6.5 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo deploying binaries"
sh "echo ESX = $ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3;"
sh "make deploy-all"
sh "echo finished deploying the binaries"
}
}

/*
* sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
* sh "echo deploying binaries"
* sh "echo ESX = $ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3;"
* sh "make deploy-all"
* sh "echo finished deploying the binaries"
*/
}

stage('vDVS Tests') {
/* This runs the vDVS tests */
/*
* sh "echo starting e2e tests"
* sh "make test-e2e"
* sh "make test-esx"
* sh "make test-vm"
*/
stage('Deploy On 6.0 setup') {
agent {
label "vdvs-slave-three"
}
steps {
sh "echo Deployment On 6.0 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo deploying binaries"
sh "echo ESX = $ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3;"
sh "make deploy-all"
sh "echo finished deploying the binaries"
}
}
}
}

stage('vFile Tests') {
/* This runs the vFile tests */
/*
* sh "echo Build, deploy and test vFile plugin"
* sh "make build-vfile-all ; make deploy-vfile-plugin; make test-e2e-vfile"
*/
}
/*
* stage('Test VDVS') {
* failFast true
* parallel {
* stage('Test On 6.5 setup') {
* agent {
* label "vdvs-slave-two"
* }
stage('Build Windows plugin') {
/* This build the windows binaries */
* steps {
* sh "echo Test VDVS On 6.5 setup"
* sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
* sh "echo starting e2e tests"
* sh "make test-e2e"
* sh "make test-esx"
* sh "make test-vm"
* }
* }
/*
* sh "echo building binaries for windows"
* sh "make build-windows-plugin"
* sh "echo Finished building binaries for windows"
*/
}
* stage('Test On 6.0 setup') {
* agent {
* label "vdvs-slave-three"
* }
stage('Deploy Windows plugin') {
/* This deploys the windows binaries */
* steps {
* sh "echo Test VDVS On 6.0 setup"
* sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
* sh "echo starting e2e tests"
* sh "make test-e2e"
* sh "make test-esx"
* sh "make test-vm"
* }
* }
* }
* }
*/

/*
* sh "echo deploying binaries for windows"
* sh "echo Windows-VM = $WIN_VM1"
* sh "make deploy-windows-plugin"
* sh "echo Finished building binaries for windows"
*/
}
stage('Test vFile') {
failFast true
parallel {
stage('Test vFile On 6.5 setup') {
agent {
label "vdvs-slave-two"
}

stage('Executing Windows Plugin Tests') {
/* This runs the windows tests. */

/*
* sh "echo Starting test for Windows"
* sh "make test-e2e-windows"
*/
}
steps {
script{
try{
echo "Build, deploy, and test vFile on 6.5 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo Build vFile binaries"
sh "echo ESX = $ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3;"
sh "make build-vfile-all"
sh "echo Deploy the vFile binaries"
sh "make deploy-vfile-plugin"
sh "echo Start the vFile tests"
sh "make test-e2e-vfile"
sh "echo vFile tests finished"
} finally{
sh "printenv"
sh "ssh ${env.GOVC_USERNAME}@$VM1 docker stop \$(docker ps -a -q) 2> /dev/null; docker rm \$(docker ps -a -q) 2> /dev/null; docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null"
sh "ssh ${env.GOVC_USERNAME}@$VM2 docker stop \$(docker ps -a -q) 2> /dev/null; docker rm \$(docker ps -a -q) 2> /dev/null; docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null"
sh "ssh ${env.GOVC_USERNAME}@$VM3 docker stop \$(docker ps -a -q) 2> /dev/null; docker rm \$(docker ps -a -q) 2> /dev/null; docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null"
sh "make clean-vfile"
sh "make clean-all"
}
}
}
}


stage('Deploy - 6.0 setup') {

sh "ESX=; VM1=; VM2=; VM3="
sh "echo ESX is ${env.ESX60} , VM1 is ${env.VM160}, VM2 is ${env.VM260} and VM3 is ${env.VM360}"
stage('Test vFile On 6.0 setup') {
agent {
label "vdvs-slave-three"
}

withEnv(["ESX=${env.ESX60}", "VM1=${env.VM160}", "VM2=${env.VM260}", "VM3=${env.VM360}", "MANAGER1=${env.MANAGER160}", "WORKER1=${env.WORKER160}", "WORKER2=${env.WORKER260}"]){
sh "printenv"
sh "echo deploying binaries to 6.0 setup"
sh "make deploy-all"
sh "echo finished deploying the binaries"
steps {
script{
try{
echo "Build, deploy, and test vFile on 6.0 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo Build vFile binaries"
sh "echo ESX = $ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3;"
sh "make build-vfile-all"
sh "echo Deploy the vFile binaries"
sh "make deploy-vfile-plugin"
sh "echo Run the vFile tests"
sh "make test-e2e-vfile"
sh "echo vFile tests finished"
}finally{
sh "ssh ${env.GOVC_USERNAME}@$VM1 docker stop \$(docker ps -a -q) 2> /dev/null; docker rm \$(docker ps -a -q) 2> /dev/null; docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null"
sh "ssh ${env.GOVC_USERNAME}@$VM2 docker stop \$(docker ps -a -q) 2> /dev/null; docker rm \$(docker ps -a -q) 2> /dev/null; docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null"
sh "ssh ${env.GOVC_USERNAME}@$VM3 docker stop \$(docker ps -a -q) 2> /dev/null; docker rm \$(docker ps -a -q) 2> /dev/null; docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null"
sh "make clean-vfile"
sh "make clean-all"

}
}

}
}
}
}

stage('Executing VDVS tests on 6.0 ESX') {

withEnv(["ESX=${env.ESX60}", "VM1=${env.VM160}", "VM2=${env.VM260}", "VM3=${env.VM360}", "MANAGER1=${env.MANAGER160}", "WORKER1=${env.WORKER160}", "WORKER2=${env.WORKER260}"]){
sh "echo starting e2e tests"
sh "make test-e2e"
sh "make test-esx"
sh "make test-vm"
}
}
stage('Windows plugin') {
/* This builds, deploys and tests the windows binaries */
agent {
label "vdvs-slave-two"
}

stage('Executing vFile tests on 6.0 ESX') {

withEnv(["ESX=${env.ESX60}", "VM1=${env.VM160}", "VM2=${env.VM260}", "VM3=${env.VM360}", "MANAGER1=${env.MANAGER160}", "WORKER1=${env.WORKER160}", "WORKER2=${env.WORKER260}"]){
sh "echo Build, deploy and test vFile plugin"
sh "make build-vfile-all ; make deploy-vfile-plugin; make test-e2e-vfile"
steps {
sh "echo Build, deploy, and test Windows plugin"
sh "echo Windows-VM = $WIN_VM1"
sh "echo Build Windows plugin binaries"
sh "make build-windows-plugin"
sh "echo Finished building binaries for windows"
sh "echo Deploy the Windows plugin binaries"
sh "make deploy-windows-plugin"
sh "echo Finished deploying binaries for windows"
sh "echo Run the Windows plugin tests"
sh "make test-e2e-windows"
sh "echo Windows plugin tests finished"
}
}
}
}

// The options directive is for configuration that applies to the whole job.
options {
// For example, we'd like to make sure we only keep 10 builds at a time, so
// we don't fill up our storage!
buildDiscarder(logRotator(numToKeepStr:'10'))
}
}

0 comments on commit 4a14f39

Please sign in to comment.