Browse Source

ZOOKEEPER-3896: Added cleanup bits to all ZK builds

Recently I noticed some weird null pointer exception issues during compile in out new builds. I usually resolve this by a full "git clean" locally, so I added it to the Jenkinsfiles too.

Author: Andor Molnar <andor@apache.org>

Reviewers: Enrico Olivelli <eolivelli@apache.org>

Closes #1431 from anmolnar/ZOOKEEPER-3896
Andor Molnar 4 years ago
parent
commit
e6c089b072
2 changed files with 12 additions and 0 deletions
  1. 11 0
      Jenkinsfile
  2. 1 0
      Jenkinsfile-PreCommit

+ 11 - 0
Jenkinsfile

@@ -52,6 +52,7 @@ pipeline {
                     stage('BuildAndTest') {
                         steps {
                             git 'https://github.com/apache/zookeeper'
+                            sh "git clean -fxd"
                             sh "mvn verify spotbugs:check checkstyle:check -Pfull-build -Dsurefire-forkcount=4"
                         }
                         post {
@@ -59,6 +60,16 @@ pipeline {
                                junit '**/target/surefire-reports/TEST-*.xml'
                                archiveArtifacts '**/target/*.jar'
                             }
+                            // Jenkins pipeline jobs fill slaves on PRs without this :(
+                            cleanup() {
+                                script {
+                                    sh label: 'Cleanup workspace', script: '''
+                                        # See HADOOP-13951
+                                        chmod -R u+rxw "${WORKSPACE}"
+                                        '''
+                                    deleteDir()
+                                }
+                            }
                         }
                     }
                 }

+ 1 - 0
Jenkinsfile-PreCommit

@@ -37,6 +37,7 @@ pipeline {
         stage('BuildAndTest') {
             steps {
                 git 'https://github.com/apache/zookeeper'
+                sh "git clean -fxd"
                 sh "mvn verify spotbugs:check checkstyle:check -Pfull-build -Dsurefire-forkcount=4"
             }
             post {