2020-11-01 19:13:27 +02:00
|
|
|
pipeline {
|
|
|
|
|
agent any
|
2023-02-04 15:11:02 +02:00
|
|
|
environment {
|
|
|
|
|
TELEAPI_KEY = credentials('telegram-token')
|
|
|
|
|
}
|
2020-11-01 19:13:27 +02:00
|
|
|
stages {
|
|
|
|
|
stage('Git-checout') {
|
|
|
|
|
steps {
|
|
|
|
|
echo "Checkout from git repo"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('Compile') {
|
|
|
|
|
steps {
|
|
|
|
|
echo "Compilation was a success!!!"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('JUnit') {
|
|
|
|
|
steps {
|
|
|
|
|
echo "JUnit passed!!"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('Quality-gate') {
|
|
|
|
|
steps {
|
|
|
|
|
echo "Sonaqube static code analysis passed!!"
|
2023-02-04 15:12:08 +02:00
|
|
|
sh 'return 0' // change to 1 for testing a failure
|
2020-11-01 19:13:27 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('Deploy') {
|
|
|
|
|
steps {
|
|
|
|
|
echo "Deployment successful!!"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
post {
|
|
|
|
|
always {
|
|
|
|
|
echo "This will always run"
|
|
|
|
|
}
|
|
|
|
|
success {
|
|
|
|
|
echo "This will run only upon success"
|
2023-02-04 15:11:02 +02:00
|
|
|
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"'
|
2020-11-01 19:13:27 +02:00
|
|
|
}
|
|
|
|
|
failure {
|
|
|
|
|
echo "This will run/show only if failed"
|
2023-02-04 15:11:02 +02:00
|
|
|
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 😱"'
|
2020-11-01 19:13:27 +02:00
|
|
|
}
|
|
|
|
|
unstable {
|
|
|
|
|
echo "This will show only if the was marked as unstable!"
|
|
|
|
|
}
|
|
|
|
|
changed {
|
|
|
|
|
echo "This will run only if the state of the pipeline has changed."
|
|
|
|
|
echo "For example, if the pipeline was previously failing but it's now successful."
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-29 12:41:27 +02:00
|
|
|
|