milvus/build/ci/jenkins/Jenkinsfile
quicksilver 5b85bda30f
Cleanup workspace after jenkins ci build (#5850)
Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
2021-06-18 11:56:05 +08:00

96 lines
4.4 KiB
Groovy

#!/usr/bin/env groovy
pipeline {
agent none
options {
timestamps()
timeout(time: 30, unit: 'MINUTES')
buildDiscarder logRotator(artifactDaysToKeepStr: '30')
// This is required if you want to clean before build
skipDefaultCheckout(true)
// parallelsAlwaysFailFast()
}
stages {
stage ('E2E Test') {
matrix {
axes {
axis {
name 'MILVUS_SERVER_TYPE'
values 'standalone', 'distributed'
}
}
agent {
kubernetes {
label "milvus-e2e-test-kind"
defaultContainer 'main'
yamlFile "build/ci/jenkins/pod/krte.yaml"
customWorkspace '/home/jenkins/agent/workspace'
// We allow this pod to remain active for a while, later jobs can
// reuse cache in previous created nodes.
idleMinutes 120
}
}
environment {
PROJECT_NAME = "milvus"
SEMVER = "${BRANCH_NAME.contains('/') ? BRANCH_NAME.substring(BRANCH_NAME.lastIndexOf('/') + 1) : BRANCH_NAME}"
IMAGE_REPO = "dockerhub-mirror-sh.zilliz.cc/milvusdb"
DOCKER_BUILDKIT = 1
CUSTOM_THIRDPARTY_PATH = "/tmp/third_party"
ARTIFACTS = "${env.WORKSPACE}/artifacts"
}
stages {
stage('Test') {
steps {
container('main') {
dir ('tests/scripts') {
script {
def standaloneEnabled = "true"
if ("${MILVUS_SERVER_TYPE}" == "distributed") {
standaloneEnabled = "false"
}
sh "MILVUS_STANDALONE_ENABLED=${standaloneEnabled} ./e2e-k8s.sh --node-image registry.zilliz.com/kindest/node:v1.20.2 --test-extra-arg \"--tags=smoke\""
}
}
}
}
}
}
post {
unsuccessful {
container('jnlp') {
script {
def authorEmail = sh returnStdout: true, script: 'git --no-pager show -s --format=\'%ae\' HEAD'
emailext subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [developers(), culprits()],
replyTo: '$DEFAULT_REPLYTO',
to: "${authorEmail}"
}
}
}
always {
container('main') {
script {
dir("${env.ARTIFACTS}") {
sh "find ./kind -path '*/history/*' -type f | xargs tar -zcvf artifacts-${PROJECT_NAME}-${MILVUS_SERVER_TYPE}-${SEMVER}-${env.BUILD_NUMBER}-e2e-logs.tar.gz --transform='s:^[^/]*/[^/]*/[^/]*/[^/]*/::g' || true"
archiveArtifacts artifacts: "**.tar.gz", allowEmptyArchive: true
sh 'rm -rf ./*'
sh 'docker rm -f \$(docker network inspect -f \'{{ range \$key, \$value := .Containers }}{{ printf "%s " \$key}}{{ end }}\' kind) || true'
sh 'docker network rm kind 2>&1 > /dev/null || true'
}
cleanWs(cleanWhenNotBuilt: false,
deleteDirs: true,
disableDeferredWipeout: true,
notFailBuild: true,
patterns: [[pattern: '.gitignore', type: 'INCLUDE']])
}
}
}
}
}
}
}
}