Created
November 14, 2019 10:41
-
-
Save PrashantBhatasana/a4e94a398dd6701baf5beb6eef47367e to your computer and use it in GitHub Desktop.
This is Demo Jenkinsfile for Slack integration.
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
def err = null | |
try { | |
node { | |
stage('Start Notification') { | |
slackSend baseUrl: 'https://prashant-bhatasana.slack.com/services/hooks/jenkins-ci/', channel: '#test_notification', color: 'Green', failOnError: true, message: " Android build pipeline - '${env.BUILD_NUMBER}' -- $STAGE ", teamDomain: 'https://prashant-bhatasana.slack.com', tokenCredentialId: '7ca00656-3323-7789-9b1a-e2c836b9a73f' | |
} | |
<<<<<<<<<<<<<<<<< Add your Pipeline Script here >>>>>>>>>>>>>>>>> | |
} | |
} catch (caughtError) { | |
err = caughtError | |
currentBuild.result = "FAILURE" | |
} finally { | |
if(currentBuild.result == "FAILURE"){ | |
slackSend(color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}] -- $STAGE' (${env.BUILD_URL})") | |
}else{ | |
slackSend(color: '#58b368', message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}] -- $STAGE' (${env.BUILD_URL}) (${BUILD_URL}artifact/android/app/build/outputs/apk/release/app-release.apk)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment