milvus/tests/benchmark/ci/main_jenkinsfile

149 lines
6.0 KiB
Plaintext
Raw Normal View History

pipeline {
agent none
options {
timestamps()
}
parameters{
string defaultValue: '0.11.1', description: 'server image version', name: 'IMAGE_VERSION', trim: true
choice choices: ['single', 'shards'], description: 'server deploy mode', name: 'DEPLOY_MODE'
string defaultValue: '011_data.json', description: 'test suite config yaml', name: 'CONFIG_FILE', trim: true
string defaultValue: 'shards.json', description: 'shards test suite config yaml', name: 'SHARDS_CONFIG_FILE', trim: true
string defaultValue: '09509e53-9125-4f5d-9ce8-42855987ad67', description: 'git credentials', name: 'GIT_USER', trim: true
}
environment {
HELM_URL = "https://github.com/milvus-io/milvus-helm.git"
HELM_BRANCH = "0.11.1"
TEST_URL = "git@192.168.1.105:Test/milvus_benchmark.git"
TEST_BRANCH = "0.11.1"
TEST_LIB_URL = "http://192.168.1.105:6060/Test/milvus_metrics.git"
HELM_RELEASE_NAME = "milvus-benchmark-test-${env.BUILD_NUMBER}"
HELM_SHARDS_RELEASE_NAME = "milvus-shards-benchmark-test-${env.BUILD_NUMBER}"
}
stages {
stage("Setup env") {
agent {
kubernetes {
label "test-benchmark-${env.JOB_NAME}-${env.BUILD_NUMBER}"
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
app: milvus
componet: test
spec:
containers:
- name: milvus-test-env
image: registry.zilliz.com/milvus/milvus-test-env:v0.3
command:
- cat
tty: true
volumeMounts:
- name: kubeconf
mountPath: /root/.kube/
readOnly: true
- name: db-data-path
mountPath: /test
readOnly: false
nodeSelector:
kubernetes.io/hostname: idc-sh002
tolerations:
- key: worker
operator: Equal
value: performance
effect: NoSchedule
volumes:
- name: kubeconf
secret:
secretName: test-cluster-config
- name: db-data-path
flexVolume:
driver: "fstab/cifs"
fsType: "cifs"
secretRef:
name: "cifs-test-secret"
options:
networkPath: "//172.16.70.249/test"
mountOptions: "vers=1.0"
"""
}
}
stages {
stage("Publish Daily Docker images") {
steps {
container('milvus-test-env') {
script {
boolean isNightlyTest = isTimeTriggeredBuild()
if (isNightlyTest) {
build job: 'milvus-publish-daily-docker', parameters: [string(name: 'LOCAL_DOKCER_REGISTRY_URL', value: 'registry.zilliz.com'), string(name: 'REMOTE_DOKCER_REGISTRY_URL', value: 'registry-1.docker.io'), string(name: 'REMOTE_DOCKER_CREDENTIALS_ID', value: 'milvus-docker-access-token'), string(name: 'BRANCH', value: String.valueOf(IMAGE_VERSION))], wait: false
} else {
echo "Skip publish daily docker images ..."
}
}
}
}
}
stage("Deploy Test") {
steps {
container('milvus-test-env') {
script {
print "In Deploy Test Stage"
if ("${params.DEPLOY_MODE}" == "single") {
load "${env.WORKSPACE}/ci/jenkinsfile/deploy_test.groovy"
} else {
load "${env.WORKSPACE}/ci/jenkinsfile/deploy_shards_test.groovy"
}
}
}
}
}
stage ("Cleanup Env") {
steps {
container('milvus-test-env') {
script {
if ("${params.DEPLOY_MODE}" == "single") {
load "${env.WORKSPACE}/ci/jenkinsfile/cleanup.groovy"
} else {
load "${env.WORKSPACE}/ci/jenkinsfile/cleanupShards.groovy"
}
}
}
}
}
}
post {
success {
script {
echo "Milvus benchmark test success !"
}
}
aborted {
script {
echo "Milvus benchmark test aborted !"
}
}
failure {
script {
echo "Milvus benchmark test failed !"
}
}
}
}
}
}
boolean isTimeTriggeredBuild() {
if (currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause').size() != 0) {
return true
}
return false
}