diff --git a/build/ci/jenkins/Nightly.groovy b/build/ci/jenkins/Nightly.groovy index ab914a2f29..e4e3a432bf 100644 --- a/build/ci/jenkins/Nightly.groovy +++ b/build/ci/jenkins/Nightly.groovy @@ -6,7 +6,7 @@ String cron_timezone = 'TZ=Asia/Shanghai' String cron_string = BRANCH_NAME == "master" ? "50 22 * * * " : "" int total_timeout_minutes = 660 - +def imageTag='' pipeline { triggers { cron """${cron_timezone} @@ -17,6 +17,7 @@ pipeline { timeout(time: total_timeout_minutes, unit: 'MINUTES') buildDiscarder logRotator(artifactDaysToKeepStr: '30') // parallelsAlwaysFailFast() + preserveStashes(buildCount: 5) } agent { kubernetes { @@ -50,10 +51,11 @@ pipeline { script { sh 'printenv' def date = sh(returnStdout: true, script: 'date +%Y%m%d').trim() - def gitShortCommit = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim() + def gitShortCommit = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim() + imageTag="${env.BRANCH_NAME}-${date}-${gitShortCommit}" withCredentials([usernamePassword(credentialsId: "${env.CI_DOCKER_CREDENTIAL_ID}", usernameVariable: 'CI_REGISTRY_USERNAME', passwordVariable: 'CI_REGISTRY_PASSWORD')]){ sh """ - TAG="${env.BRANCH_NAME}-${date}-${gitShortCommit}" \ + TAG="${imageTag}" \ ./e2e-k8s.sh \ --skip-export-logs \ --skip-install \ @@ -61,7 +63,9 @@ pipeline { --skip-setup \ --skip-test """ - + // stash imageTag info for rebuild install & E2E Test only + sh "echo ${imageTag} > imageTag.txt" + stash includes: 'imageTag.txt', name: 'imageTag' } } } @@ -96,14 +100,21 @@ pipeline { clusterEnabled = "true" // setMemoryResourceLimitArgs="--set queryNode.resources.limits.memory=4Gi" } - - def date = sh(returnStdout: true, script: 'date +%Y%m%d').trim() - def gitShortCommit = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim() if ("${MILVUS_CLIENT}" == "pymilvus") { + if ("${imageTag}"==''){ + dir ("imageTag"){ + try{ + unstash 'imageTag' + imageTag=sh(returnStdout: true, script: 'cat imageTag.txt | tr -d \'\n\r\'') + }catch(e){ + print "No Image Tag info remained ,please rerun build to build new image." + exit 1 + } + } withCredentials([usernamePassword(credentialsId: "${env.CI_DOCKER_CREDENTIAL_ID}", usernameVariable: 'CI_REGISTRY_USERNAME', passwordVariable: 'CI_REGISTRY_PASSWORD')]){ sh """ MILVUS_CLUSTER_ENABLED=${clusterEnabled} \ - TAG="${env.BRANCH_NAME}-${date}-${gitShortCommit}" \ + TAG="${imageTag}" \ ./e2e-k8s.sh \ --skip-export-logs \ --skip-cleanup \ diff --git a/build/ci/jenkins/PR.groovy b/build/ci/jenkins/PR.groovy index 78cebdd258..ea40185257 100644 --- a/build/ci/jenkins/PR.groovy +++ b/build/ci/jenkins/PR.groovy @@ -10,6 +10,7 @@ pipeline { timeout(time: total_timeout_minutes, unit: 'MINUTES') buildDiscarder logRotator(artifactDaysToKeepStr: '30') parallelsAlwaysFailFast() + preserveStashes(buildCount: 5) } agent { @@ -58,6 +59,10 @@ pipeline { --skip-test """ + // stash imageTag info for rebuild install & E2E Test only + sh "echo ${imageTag} > imageTag.txt" + stash includes: 'imageTag.txt', name: 'imageTag' + } } } @@ -92,6 +97,17 @@ pipeline { } if ("${MILVUS_CLIENT}" == "pymilvus") { + if ("${imageTag}"==''){ + dir ("imageTag"){ + try{ + unstash 'imageTag' + imageTag=sh(returnStdout: true, script: 'cat imageTag.txt | tr -d \'\n\r\'') + }catch(e){ + print "No Image Tag info remained ,please rerun build to build new image." + exit 1 + } + } + } withCredentials([usernamePassword(credentialsId: "${env.CI_DOCKER_CREDENTIAL_ID}", usernameVariable: 'CI_REGISTRY_USERNAME', passwordVariable: 'CI_REGISTRY_PASSWORD')]){ sh """ MILVUS_CLUSTER_ENABLED=${clusterEnabled} \