#!/usr/bin/env groovy int timeout_minutes = 30 int delay_minutes = 5 int ci_timeout = (timeout_minutes - delay_minutes) * 60 pipeline { agent none options { timestamps() timeout(time: timeout_minutes, unit: 'MINUTES') buildDiscarder logRotator(artifactDaysToKeepStr: '30') // parallelsAlwaysFailFast() } stages { stage ('E2E Test') { matrix { axes { axis { name 'MILVUS_SERVER_TYPE' values 'standalone', 'distributed' } axis { name 'MILVUS_CLIENT' values 'pymilvus', 'pymilvus-orm' } } 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 ARTIFACTS = "${env.WORKSPACE}/_artifacts" } stages { stage('Test') { steps { container('main') { dir ('tests/scripts') { script { def clusterEnabled = "false" if ("${MILVUS_SERVER_TYPE}" == "distributed") { clusterEnabled = "true" } if ("${MILVUS_CLIENT}" == "pymilvus") { sh """ MILVUS_CLUSTER_ENABLED=${clusterEnabled} \ timeout -v ${ci_timeout} \ ./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} \ timeout -v ${ci_timeout} \ ./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}" } } } } } } } 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}-${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" } archiveArtifacts artifacts: "**.tar.gz", allowEmptyArchive: true 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' } } } } cleanup { container('main') { script { sh 'find . -name . -o -prune -exec rm -rf -- {} +' /* clean up our workspace */ } } } } } } } }