mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 12:59:23 +08:00
dab38f6c3d
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
110 lines
5.2 KiB
Groovy
110 lines
5.2 KiB
Groovy
#!/usr/bin/env groovy
|
|
|
|
String cron_timezone = "TZ=Asia/Shanghai"
|
|
String cron_string = BRANCH_NAME == "master" ? "50 20,22,0,6,11,16 * * * " : ""
|
|
|
|
pipeline {
|
|
agent none
|
|
triggers {
|
|
cron """${cron_timezone}
|
|
${cron_string}"""
|
|
}
|
|
options {
|
|
timestamps()
|
|
timeout(time: 1, unit: 'HOURS')
|
|
// 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 {
|
|
IMAGE_REPO = "registry.zilliz.com/milvus"
|
|
DOCKER_BUILDKIT = 1
|
|
DOCKER_VOLUME_DIRECTORY = "/mnt/disk/.docker"
|
|
ARTIFACTS = "${env.WORKSPACE}/artifacts"
|
|
DOCKER_CREDENTIALS_ID = "ba070c98-c8cc-4f7c-b657-897715f359fc"
|
|
DOKCER_REGISTRY_URL = "registry.zilliz.com"
|
|
TARGET_REPO = "${DOKCER_REGISTRY_URL}/milvus"
|
|
}
|
|
stages {
|
|
stage('Test') {
|
|
steps {
|
|
container('main') {
|
|
dir ('tests/scripts') {
|
|
script {
|
|
def standaloneEnabled = "true"
|
|
if ("${MILVUS_SERVER_TYPE}" == "distributed") {
|
|
standaloneEnabled = "false"
|
|
}
|
|
|
|
if (isTimeTriggeredBuild()) {
|
|
echo "This is Cron Job!"
|
|
sh "MILVUS_STANDALONE_ENABLED=${standaloneEnabled} ./e2e-k8s.sh --node-image registry.zilliz.com/kindest/node:v1.20.2"
|
|
} else {
|
|
sh "MILVUS_STANDALONE_ENABLED=${standaloneEnabled} ./e2e-k8s.sh --node-image registry.zilliz.com/kindest/node:v1.20.2 --test-extra-arg \"--tags=smoke\""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
container('main') {
|
|
script {
|
|
if ( env.CHANGE_ID == null ){
|
|
def date = sh(returnStdout: true, script: 'date +%Y%m%d').trim()
|
|
def gitShortCommit = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
|
|
|
|
withCredentials([usernamePassword(credentialsId: "${env.DOCKER_CREDENTIALS_ID}", usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
|
|
sh 'docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} ${DOKCER_REGISTRY_URL}'
|
|
sh """
|
|
docker tag localhost:5000/milvus:latest ${TARGET_REPO}/milvus:${env.BRANCH_NAME}-${date}-${gitShortCommit}
|
|
docker tag localhost:5000/milvus:latest ${TARGET_REPO}/milvus:${env.BRANCH_NAME}-latest
|
|
docker push ${TARGET_REPO}/milvus:${env.BRANCH_NAME}-${date}-${gitShortCommit}
|
|
docker push ${TARGET_REPO}/milvus:${env.BRANCH_NAME}-latest
|
|
"""
|
|
sh 'docker logout ${DOKCER_REGISTRY_URL}'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
always {
|
|
container('main') {
|
|
script {
|
|
dir("${env.ARTIFACTS}") {
|
|
sh "tar -zcvf artifacts-milvus-${MILVUS_SERVER_TYPE}-e2e-kind.tar.gz ./kind --remove-files || true"
|
|
archiveArtifacts artifacts: "artifacts-milvus-${MILVUS_SERVER_TYPE}-e2e-kind.tar.gz", allowEmptyArchive: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
boolean isTimeTriggeredBuild() {
|
|
return (currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause').size() != 0) ? true : false;
|
|
}
|