-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
74 lines (74 loc) · 2.58 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
pipeline{
agent any
environment {
SCRIPT_PATH = '/var/jenkins_home/custom/kurum'
}
tools {
gradle 'kurum'
}
stages{
stage('Checkout') {
steps {
checkout scm
}
}
stage('Prepare'){
steps {
sh 'gradle clean'
}
}
stage('Replace Prod Properties') {
steps {
withCredentials([
file(credentialsId: 'kurumprod', variable: 'kurumprod'),
file(credentialsId: 'firebase', variable: 'firebase')
]) {
script {
sh 'cp $kurumprod ./src/main/resources/application-prod.yml'
sh 'cp $firebase ./src/main/resources/kuroom-90fb5-firebase-adminsdk-fbsvc-f264f66c64.json'
}
}
}
}
stage('Build') {
steps {
sh 'gradle build'
}
}
stage('Deploy') {
steps {
sh '''
cp ./docker/docker-compose.blue.yml ${SCRIPT_PATH}
cp ./docker/docker-compose.green.yml ${SCRIPT_PATH}
cp ./docker/Dockerfile ${SCRIPT_PATH}
cp ./scripts/deploy.sh ${SCRIPT_PATH}
cp ./build/libs/*.jar ${SCRIPT_PATH}
chmod +x ${SCRIPT_PATH}/deploy.sh
${SCRIPT_PATH}/deploy.sh
'''
}
}
}
post {
success {
withCredentials([string(credentialsId: 'Discord-Webhook', variable: 'DISCORD')]) {
discordSend description: "✅ 성공: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})\n최근 커밋: '${env.GIT_COMMIT_MESSAGE}'",
footer: "footer 표시",
link: env.BUILD_URL,
result: currentBuild.currentResult,
title: "젠킨스 JOB",
webhookURL: "$DISCORD"
}
}
failure {
withCredentials([string(credentialsId: 'Discord-Webhook', variable: 'DISCORD')]) {
discordSend description: "❌ 실패: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})\n최근 커밋: '${env.GIT_COMMIT_MESSAGE}'",
footer: "footer 표시",
link: env.BUILD_URL,
result: currentBuild.currentResult,
title: "젠킨스 JOB",
webhookURL: "$DISCORD"
}
}
}
}