From d350177b3f009fdae01edfdae4d5ace1930f9cb1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 6 Mar 2020 12:02:34 +0100 Subject: [PATCH] migrate Jenkinsfile from mercurial to git --- Jenkinsfile | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 010a583f6e..8dee82b57a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ import com.cloudogu.ces.cesbuildlib.* node('docker') { // Change this as when we go back to default - necessary for proper SonarQube analysis - mainBranch = 'default' + mainBranch = 'develop' properties([ // Keep only the last 10 build to preserve space @@ -20,6 +20,8 @@ node('docker') { timeout(activity: true, time: 40, unit: 'MINUTES') { + Git git = new Git(this) + catchError { Maven mvn = setupMavenBuild() @@ -49,7 +51,7 @@ node('docker') { } } - def commitHash = getCommitHash() + def commitHash = git.getCommitHash() def dockerImageTag = "2.0.0-dev-${commitHash.substring(0,7)}-${BUILD_NUMBER}" if (isMainBranch()) { @@ -96,7 +98,7 @@ node('docker') { // Archive Unit and integration test results, if any junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml,**/target/jest-reports/TEST-*.xml' - mailIfStatusChanged(commitAuthorEmail) + mailIfStatusChanged(git.commitAuthorEmail) } } @@ -158,15 +160,3 @@ boolean waitForQualityGateWebhookToBeCalled() { return isQualityGateSucceeded } -String getCommitAuthorComplete() { - new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{author}"' -} - -String getCommitHash() { - new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{node}"' -} - -String getCommitAuthorEmail() { - def matcher = getCommitAuthorComplete() =~ "<(.*?)>" - matcher ? matcher[0][1] : "" -}