Created
March 5, 2020 09:20
-
-
Save FyberEngineers/5783f168aee54294fafd5ab1a36c9683 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String branch = env.BRANCH_NAME.toString() | |
| stage('Maven build') { | |
| //returns a set of git revisions with the name of the committer | |
| @NonCPS | |
| def commitList = { | |
| def changes = "" | |
| currentBuild.changeSets.each { set -> | |
| set.each { entry -> | |
| changes += "${entry.commitId} - ${entry.msg} \n by ${entry.author.fullName}\n" | |
| } | |
| } | |
| return changes | |
| } | |
| def handleFailures = { | |
| if (branch.startsWith("ST-")) { | |
| step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'RequesterRecipientProvider']]), sendToIndividuals: true]) | |
| } else { | |
| step('Send notification') { | |
| mail(to: 'server@fullgc.com', | |
| subject: "Maven build failed for branch: " + env.BRANCH_NAME.toString(), | |
| body: "last commits are: " + commitList().toString() + " (<$BUILD_URL/console|Job>)"); | |
| } | |
| slackSend channel: 'server', color: 'warning', message: "Maven build failed for branch ${branch} \". \nlast Commits are: \n" + commitList().toString() + "\n (<$BUILD_URL/console|Job>)" | |
| } | |
| } | |
| try { | |
| withMaven(jdk: 'JDK 8 update 66', maven: 'Maven 3.0.5') { | |
| sh "mvn -Dmaven.test.failure.ignore=true clean install" | |
| } | |
| if (currentBuild.result("UNSTABLE")) { | |
| handleFailures() | |
| } | |
| } catch (Exception e) { | |
| manager.buildFailure() | |
| handleFailures() | |
| throw e | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment