diff --git a/build/ci/jenkins/Jenkinsfile b/build/ci/jenkins/Jenkinsfile index 0d83574690..e8b6a7529d 100644 --- a/build/ci/jenkins/Jenkinsfile +++ b/build/ci/jenkins/Jenkinsfile @@ -6,7 +6,10 @@ pipeline { timestamps() timeout(time: 30, unit: 'MINUTES') buildDiscarder logRotator(artifactDaysToKeepStr: '30') + // This is required if you want to clean before build + skipDefaultCheckout(true) // parallelsAlwaysFailFast() + } stages { stage ('E2E Test') { @@ -33,6 +36,7 @@ pipeline { SEMVER = "${BRANCH_NAME.contains('/') ? BRANCH_NAME.substring(BRANCH_NAME.lastIndexOf('/') + 1) : BRANCH_NAME}" IMAGE_REPO = "dockerhub-mirror-sh.zilliz.cc/milvusdb" DOCKER_BUILDKIT = 1 + CUSTOM_THIRDPARTY_PATH = "/tmp/third_party" ARTIFACTS = "${env.WORKSPACE}/artifacts" } stages { @@ -76,6 +80,11 @@ pipeline { 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' } + cleanWs(cleanWhenNotBuilt: false, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true, + patterns: [[pattern: '.gitignore', type: 'INCLUDE']]) } } } diff --git a/build/ci/jenkins/NightlyCI.groovy b/build/ci/jenkins/NightlyCI.groovy index e700cb8422..308fcaebfd 100644 --- a/build/ci/jenkins/NightlyCI.groovy +++ b/build/ci/jenkins/NightlyCI.groovy @@ -15,6 +15,8 @@ pipeline { timestamps() timeout(time: 1, unit: 'HOURS') buildDiscarder logRotator(artifactDaysToKeepStr: '30') + // This is required if you want to clean before build + skipDefaultCheckout(true) // parallelsAlwaysFailFast() } stages { @@ -40,6 +42,7 @@ pipeline { SEMVER = "${BRANCH_NAME.contains('/') ? BRANCH_NAME.substring(BRANCH_NAME.lastIndexOf('/') + 1) : BRANCH_NAME}" IMAGE_REPO = "dockerhub-mirror-sh.zilliz.cc/milvusdb" DOCKER_BUILDKIT = 1 + CUSTOM_THIRDPARTY_PATH = "/tmp/third_party" ARTIFACTS = "${env.WORKSPACE}/artifacts" DOCKER_CREDENTIALS_ID = "ba070c98-c8cc-4f7c-b657-897715f359fc" DOKCER_REGISTRY_URL = "registry.zilliz.com" @@ -99,6 +102,11 @@ pipeline { 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' } + cleanWs(cleanWhenNotBuilt: false, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true, + patterns: [[pattern: '.gitignore', type: 'INCLUDE']]) } } } diff --git a/build/ci/jenkins/PublishImages.groovy b/build/ci/jenkins/PublishImages.groovy index a9aee9347a..8efb9cf1e6 100644 --- a/build/ci/jenkins/PublishImages.groovy +++ b/build/ci/jenkins/PublishImages.groovy @@ -16,6 +16,8 @@ pipeline { options { timestamps() timeout(time: 30, unit: 'MINUTES') + // This is required if you want to clean before build + skipDefaultCheckout(true) // parallelsAlwaysFailFast() } @@ -53,4 +55,17 @@ pipeline { } } } + post { + always { + container('main') { + script { + cleanWs(cleanWhenNotBuilt: false, + deleteDirs: true, + disableDeferredWipeout: true, + notFailBuild: true, + patterns: [[pattern: '.gitignore', type: 'INCLUDE']]) + } + } + } + } }