Using curl to send telegrams
Some checks failed
ci-tests/jenkins-template/pipeline/head There was a failure building this commit

This commit is contained in:
2023-02-04 15:11:02 +02:00
parent fa1c26c978
commit 1b9932f492

9
Jenkinsfile vendored
View File

@@ -1,5 +1,8 @@
pipeline {
agent any
environment {
TELEAPI_KEY = credentials('telegram-token')
}
stages {
stage('Git-checout') {
steps {
@@ -22,7 +25,7 @@ pipeline {
stage('Quality-gate') {
steps {
echo "Sonaqube static code analysis passed!!"
sh 'return 0' // change to 1 for testing a failure
sh 'return 1' // change to 1 for testing a failure
}
}
@@ -39,11 +42,11 @@ pipeline {
}
success {
echo "This will run only upon success"
telegramSend(message: '[✅] Build Is a success', chatId: "${env.TELE_CHAT_ID}")
sh 'curl -s -o /dev/null https://api.telegram.org/bot${TELEAPI_KEY}/sendMessage -d chat_id="${TELE_CHAT_ID}" -d text="[✅] Build Is a success"'
}
failure {
echo "This will run/show only if failed"
telegramSend(message: '[❌] Failed to build 😱', chatId: "${env.TELE_CHAT_ID}")
sh 'curl -s -o /dev/null https://api.telegram.org/bot${TELEAPI_KEY}/sendMessage -d chat_id="${TELE_CHAT_ID}" -d text="[❌] Failed to build 😱"'
}
unstable {
echo "This will show only if the was marked as unstable!"