-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
56 lines (55 loc) · 1.52 KB
/
Jenkinsfile
File metadata and controls
56 lines (55 loc) · 1.52 KB
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
void setBuildStatus(String message, String state) {
step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/Flow-PDA/WS-Server.git"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}
pipeline {
agent any
post {
failure {
setBuildStatus("Build failed", "FAILURE");
}
success {
setBuildStatus("Build succeeded", "SUCCESS");
}
}
stages {
stage('init') {
steps {
echo 'init pipeline, check changes'
setBuildStatus("Pending", "PENDING")
}
}
stage('cofing') {
steps {
echo 'copy configuration files'
sh 'pwd'
sh 'cp /var/jenkins_home/workspace/config/.env.stock-server .env'
}
}
stage('build') {
steps {
echo 'build express'
sh 'docker-compose -p ws-server build'
}
}
stage('stop') {
steps {
echo 'stop container'
sh 'docker-compose -p ws-server stop express'
echo 'remove container'
sh 'docker-compose -p ws-server rm -f'
}
}
stage('deploy') {
steps {
echo 'run docker container'
sh 'docker-compose -p ws-server up -d'
}
}
}
}