-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
51 lines (47 loc) · 1.9 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
pipeline {
agent any
stages {
stage('main branch clone') {
steps {
git branch: 'main', credentialsId: 'github_rsa_key',
url: 'https://github.com/CUKCatSnap/CUKCATSNAP_Server'
}
}
stage('copy application.yml file') {
steps {
withCredentials([file(credentialsId: 'CATSNAP_SPRING_APPLICATION_FILE', variable: 'application')]) {
script {
sh '''
mkdir -p ./src/main/resources
cp $application ./src/main/resources/application-dev.yml
'''
}
}
}
}
stage('project build') {
steps {
sh './gradlew build -x test'
}
}
stage('send jar file') {
steps {
// Publish over SSH를 통해 원격 서버로 JAR 파일 전송
sshPublisher(
publishers: [
sshPublisherDesc(
configName: 'catsnap_was_server',
transfers: [
sshTransfer(
sourceFiles: 'build/libs/catsnap-0.0.1-SNAPSHOT.jar',
removePrefix: 'build/libs/',
execCommand: 'sudo kill -9 $(sudo lsof -i :8080 -t) ; sleep 5 ;nohup java -jar ./spring_jar/catsnap-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev> ./spring_jar/log.txt 2>&1 &'
)
]
)
]
)
}
}
}
}