This repository has been archived by the owner on Aug 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathJenkinsfile-cd
56 lines (50 loc) · 1.67 KB
/
Jenkinsfile-cd
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
pipeline {
agent any
environment {
PATH = "/opt/gradle/gradle-6.3/bin:$PATH"
SLACK_CHANNEL = '#jenkins-notification'
}
stages {
stage('Git Checkout') {
steps {
checkout scm
echo 'Git Checkout Success!'
}
}
stage('Test') {
steps {
sh 'gradle test'
echo 'test success'
}
}
stage('Deploy') {
steps([$class: 'BapSshPromotionPublisherPlugin']) {
sshPublisher(
continueOnError: false, failOnError: true,
publishers: [
sshPublisherDesc(
configName: "shoe-auction-deploy",
verbose: true,
transfers: [
sshTransfer(
sourceFiles: "",
removePrefix: "",
remoteDirectory: "",
execCommand: "sh /root/app/deploy/run.sh"
)
]
)
]
)
}
}
}
post {
success {
slackSend (channel: SLACK_CHANNEL, color: '#00FF00', message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
failure {
slackSend (channel: SLACK_CHANNEL, color: '#F01717', message: "FAILURE: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}