Last active
June 30, 2019 19:39
-
-
Save Osein/9b484df1c6c0eb8e686001ea100cb322 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
| stage('Init') { | |
| steps { | |
| script { | |
| lastCommitInfo = sh(script: "git log -1", returnStdout: true).trim() | |
| commitContainsSkip = sh(script: "git log -1 | grep '.*\\[skip ci\\].*'", returnStatus: true) | |
| if(commitContainsSkip == 0) { | |
| skippingText = "Skipping commit." | |
| env.shouldBuild = false | |
| currentBuild.result = "NOT_BUILT" | |
| } | |
| slackMessage = "*${env.JOB_NAME}* *${env.BRANCH_NAME}* received a new commit. ${skippingText}\nHere is commmit info: ${lastCommitInfo}" | |
| } | |
| } | |
| } | |
| stage('Send info to Slack') { | |
| steps { | |
| slackSend color: "#2222FF", message: slackMessage | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment