2020-11-30 05:18:44 +08:00
#!/usr/bin/env groovy
2021-09-18 18:34:02 +08:00
int total_timeout_minutes = 120
2021-07-21 14:04:11 +08:00
int e2e_timeout_seconds = 30 * 60
2021-07-07 18:38:01 +08:00
2020-11-30 05:18:44 +08:00
pipeline {
agent none
options {
timestamps()
2021-07-21 14:04:11 +08:00
timeout(time: total_timeout_minutes, unit: 'MINUTES')
2021-06-04 17:24:34 +08:00
buildDiscarder logRotator(artifactDaysToKeepStr: '30')
2021-09-23 15:11:55 +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'
2021-08-20 11:00:56 +08:00
values 'pymilvus'
2021-07-03 14:52:28 +08:00
}
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-08-03 15:13:24 +08:00
container('etcd') {
script {
sh 'ETCDCTL_API=3 etcdctl del "" --from-key=true'
}
}
2021-04-29 16:45:17 +08:00
container('main') {
dir ('tests/scripts') {
script {
2021-08-04 11:11:24 +08:00
sh 'printenv'
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" \
2021-08-03 07:51:24 +08:00
--install-extra-arg "--set etcd.enabled=false --set externalEtcd.enabled=true --set externalEtcd.endpoints={\$KRTE_POD_IP:2379}" \
2021-07-22 20:20:12 +08:00
--skip-export-logs \
--skip-cleanup \
2021-09-01 19:43:59 +08:00
--test-extra-arg "-x --tags L0 L1" \
2021-07-21 14:04:11 +08:00
--test-timeout ${e2e_timeout_seconds}
2021-07-03 14:52:28 +08:00
"""
} 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-07-23 20:11:34 +08:00
always {
container('main') {
script {
sh "./tests/scripts/export_logs.sh"
dir("${env.ARTIFACTS}") {
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"
2021-08-27 12:19:57 +08:00
if ("${MILVUS_CLIENT}" == "pymilvus") {
2021-07-23 20:11:34 +08:00
sh "tar -zcvf artifacts-${PROJECT_NAME}-${MILVUS_SERVER_TYPE}-${MILVUS_CLIENT}-pytest-logs.tar.gz ./tests/pytest_logs --remove-files || true"
}
archiveArtifacts artifacts: "**.tar.gz", allowEmptyArchive: true
}
}
}
}
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-07-22 20:20:12 +08:00
cleanup {
2021-04-29 16:45:17 +08:00
container('main') {
script {
2021-07-22 20:20:12 +08:00
sh "kind delete cluster --name kind -v9 || true"
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
}
}