2020-11-30 05:18:44 +08:00
#!/usr/bin/env groovy
pipeline {
agent none
options {
timestamps()
2021-06-07 14:17:38 +08:00
timeout(time: 30, unit: 'MINUTES')
2021-06-04 17:24:34 +08:00
buildDiscarder logRotator(artifactDaysToKeepStr: '30')
2021-03-30 16:30:28 +08:00
// parallelsAlwaysFailFast()
2021-06-18 11:56:05 +08:00
2020-11-30 05:18:44 +08:00
}
stages {
2021-04-29 16:45:17 +08:00
stage ('E2E Test') {
2021-02-27 18:32:23 +08:00
matrix {
axes {
axis {
2021-04-29 16:45:17 +08:00
name 'MILVUS_SERVER_TYPE'
2021-03-11 12:01:05 +08:00
values 'standalone', 'distributed'
2021-02-27 18:32:23 +08:00
}
2021-07-03 14:52:28 +08:00
axis {
name 'MILVUS_CLIENT'
values 'pymilvus', 'pymilvus-orm'
}
2021-02-27 18:32:23 +08:00
}
agent {
2021-03-11 12:01:05 +08:00
kubernetes {
2021-04-29 16:45:17 +08:00
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.
2021-05-14 22:09:40 +08:00
idleMinutes 120
2021-03-11 12:01:05 +08:00
}
2021-02-27 18:32:23 +08:00
}
2021-04-29 16:45:17 +08:00
environment {
2021-06-03 23:54:39 +08:00
PROJECT_NAME = "milvus"
SEMVER = "${BRANCH_NAME.contains('/') ? BRANCH_NAME.substring(BRANCH_NAME.lastIndexOf('/') + 1) : BRANCH_NAME}"
2021-05-15 10:13:17 +08:00
IMAGE_REPO = "dockerhub-mirror-sh.zilliz.cc/milvusdb"
2021-04-29 16:45:17 +08:00
DOCKER_BUILDKIT = 1
2021-07-03 14:52:28 +08:00
ARTIFACTS = "${env.WORKSPACE}/_artifacts"
2021-04-29 16:45:17 +08:00
}
2021-02-27 18:32:23 +08:00
stages {
stage('Test') {
steps {
2021-04-29 16:45:17 +08:00
container('main') {
dir ('tests/scripts') {
script {
2021-06-21 12:00:06 +08:00
def clusterEnabled = "false"
2021-04-29 16:45:17 +08:00
if ("${MILVUS_SERVER_TYPE}" == "distributed") {
2021-06-21 12:00:06 +08:00
clusterEnabled = "true"
2021-04-29 16:45:17 +08:00
}
2021-07-03 14:52:28 +08:00
if ("${MILVUS_CLIENT}" == "pymilvus") {
sh """
MILVUS_CLUSTER_ENABLED=${clusterEnabled} \
./e2e-k8s.sh \
--node-image registry.zilliz.com/kindest/node:v1.20.2 \
--kind-config "${env.WORKSPACE}/build/config/topology/trustworthy-jwt-ci.yaml" \
--test-extra-arg "--tags=smoke"
"""
} else if ("${MILVUS_CLIENT}" == "pymilvus-orm") {
sh """
MILVUS_CLUSTER_ENABLED=${clusterEnabled} \
./e2e-k8s.sh \
--node-image registry.zilliz.com/kindest/node:v1.20.2 \
--kind-config "${env.WORKSPACE}/build/config/topology/trustworthy-jwt-ci.yaml" \
--test-extra-arg "--tags L0 L1"
"""
} else {
error "Error: Unsupported Milvus client: ${MILVUS_CLIENT}"
}
2021-04-29 16:45:17 +08:00
}
}
}
2021-02-27 18:32:23 +08:00
}
}
}
post {
2021-06-07 19:16:36 +08:00
unsuccessful {
container('jnlp') {
script {
2021-06-10 16:44:49 +08:00
def authorEmail = sh returnStdout: true, script: 'git --no-pager show -s --format=\'%ae\' HEAD'
2021-06-07 19:16:36 +08:00
emailext subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [developers(), culprits()],
replyTo: '$DEFAULT_REPLYTO',
to: "${authorEmail}"
}
}
}
2021-04-29 16:45:17 +08:00
always {
container('main') {
script {
dir("${env.ARTIFACTS}") {
2021-07-03 14:52:28 +08:00
sh "find ./kind -path '*/history/*' -type f | xargs tar -zcvf artifacts-${PROJECT_NAME}-${MILVUS_SERVER_TYPE}-${SEMVER}-${env.BUILD_NUMBER}-${MILVUS_CLIENT}-e2e-logs.tar.gz --transform='s:^[^/]*/[^/]*/[^/]*/[^/]*/::g' || true"
if ("${MILVUS_CLIENT}" == "pymilvus-orm") {
sh "tar -zcvf artifacts-${PROJECT_NAME}-${MILVUS_SERVER_TYPE}-${MILVUS_CLIENT}-pytest-logs.tar.gz ./tests/pytest_logs --remove-files || true"
}
2021-05-26 22:28:10 +08:00
archiveArtifacts artifacts: "**.tar.gz", allowEmptyArchive: true
2021-05-14 22:09:40 +08:00
sh 'docker rm -f \$(docker network inspect -f \'{{ range \$key, \$value := .Containers }}{{ printf "%s " \$key}}{{ end }}\' kind) || true'
2021-06-07 14:17:38 +08:00
sh 'docker network rm kind 2>&1 > /dev/null || true'
2021-04-29 16:45:17 +08:00
}
2021-06-19 13:28:07 +08:00
}
}
}
cleanup {
container('main') {
script {
2021-06-18 18:56:07 +08:00
sh 'find . -name . -o -prune -exec rm -rf -- {} +' /* clean up our workspace */
2021-04-29 16:45:17 +08:00
}
}
2021-02-27 18:32:23 +08:00
}
2020-12-03 19:00:11 +08:00
}
}
}
2020-11-30 05:18:44 +08:00
}
}