-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
40 lines (40 loc) · 1.2 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pipeline {
agent any
environment {
SLACK_CHANNEL = '#general' // or use '@roshan-sax1539' for direct message
SLACK_CREDENTIAL_ID = '3' // The ID you used in the Jenkins configuration
SLACK_TEAM_DOMAIN = 'roshan-sax1539'
}
stages {
stage('Run Script') {
steps {
script {
// Ensure the script is executable
sh 'chmod +x bash.sh'
// Run the script
sh './bash.sh'
}
}
}
}
post {
success {
slackSend (
channel: env.SLACK_CHANNEL,
color: 'good',
message: "Build Successful: ${env.JOB_NAME} ${env.BUILD_NUMBER}",
teamDomain: env.SLACK_TEAM_DOMAIN,
tokenCredentialId: env.SLACK_CREDENTIAL_ID
)
}
failure {
slackSend (
channel: env.SLACK_CHANNEL,
color: 'danger',
message: "Build Failed: ${env.JOB_NAME} ${env.BUILD_NUMBER}",
teamDomain: env.SLACK_TEAM_DOMAIN,
tokenCredentialId: env.SLACK_CREDENTIAL_ID
)
}
}
}