-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
37 lines (34 loc) · 1.22 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
def outSh() {
OUT = sh(script: 'ls -alh', returnStdout: true).trim()
slackSend color: "good", message: "Build: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was successful. ${OUT}"
}
pipeline {
agent any
stages {
stage('Build') {
steps {
slackSend color: "good", message: "Build start: ${env.GIT_BRANCH} started"
echo 'Hello'
sh 'cd /home/deployer/'
sh "pwd"
sh "git pull [email protected]:cube13/ddruk_com_ua.git"
slackSend color: "good", message: "Build: ${env.JOB_NAME} with buildnumber ${env.BUILD_NUMBER} was successful"
}
}
stage('Deploy') {
steps {
slackSend color: "good", message: "Deploy start: ${env.JOB_NAME} started"
sh "rsync -rvae \"ssh -p2212 -i /home/deployer/.ssh/id_rsa\" --exclude .git --exclude .idea --delete ${WORKSPACE}/ [email protected]:/home/deployer/${env.JOB_NAME}/"
slackSend color: "good", message: "Deploy: ${env.BUILD_TAG} success"
}
}
}
post {
success {
slackSend (color: '#00FF00', message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.NODE_NAME}]' (${env.BUILD_URL})")
}
failure {
slackSend (color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}