Skip to content

Commit

Permalink
[mgmt] Add canary KVM tests for sonic-mgmt repo (sonic-net#108)
Browse files Browse the repository at this point in the history
Signed-off-by: Danny Allen <daall@microsoft.com>
  • Loading branch information
daall authored Jun 8, 2020
1 parent 91c5c67 commit 7cca8ff
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
53 changes: 53 additions & 0 deletions jenkins/mgmt/sonic-mgmt-canary/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
pipeline {
agent {
node { label 'jenkins-kvmtest-workers' }
}

options {
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '30'))
}

triggers {
pollSCM('@midnight')
}

stages {
stage('Prepare') {
steps {
dir('sonic-mgmt') {
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
userRemoteConfigs: [[url: 'https://github.com/Azure/sonic-mgmt']]])
}
copyArtifacts(projectName: 'bldenv/docker-sonic-mgmt', filter: '**/docker-sonic-mgmt.gz', target: 'mgmt', flatten: true)
copyArtifacts(projectName: 'vs/buildimage-vs-image', filter: '**/sonic-vs.img.gz', target: 'vsimage', flatten: true)
}
}

stage('Test') {
steps {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
lock(resource: "kvmtest_${env.NODE_NAME}") {
withCredentials([sshUserPrivateKey(credentialsId: '2b6b6afe-4892-41d1-967c-d683e7773727', keyFileVariable: 'VM_USER_PRIVATE_KEY'), \
usernamePassword(credentialsId: 'sonicdev-cr', usernameVariable: 'REGISTRY_USERNAME', passwordVariable: 'REGISTRY_PASSWD')]) {
sh './scripts/mgmt/test.sh'
}
}
}
}

post {
always {
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml')
archiveArtifacts(artifacts: 'sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**')
}
}
}
}

post {
cleanup {
cleanWs(disableDeferredWipeout: false, deleteDirs: true, notFailBuild: true)
}
}
}
23 changes: 23 additions & 0 deletions scripts/mgmt/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -xe

echo ${JOB_NAME##*/}.${BUILD_NUMBER}

docker login -u $REGISTRY_USERNAME -p $REGISTRY_PASSWD sonicdev-microsoft.azurecr.io:443
docker pull sonicdev-microsoft.azurecr.io:443/docker-sonic-mgmt:latest

cat $VM_USER_PRIVATE_KEY > pkey.txt

ls -l vsimage

mkdir -p $HOME/sonic-vm/images
cp vsimage/sonic-vs.img.gz $HOME/sonic-vm/images/
gzip -fd $HOME/sonic-vm/images/sonic-vs.img.gz

ls -l $HOME/sonic-vm/images

pushd sonic-mgmt/ansible
sed -i s:use_own_value:johnar: veos.vtb
echo abc > password.txt
popd

docker run --rm=true -v $(pwd):/data -w /data -i sonicdev-microsoft.azurecr.io:443/docker-sonic-mgmt ./scripts/vs/buildimage-vs-image/runtest.sh

0 comments on commit 7cca8ff

Please sign in to comment.