-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
47 lines (39 loc) · 1.39 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
#!/usr/bin/env groovy
node('nimble-jenkins-slave') {
stage('Clone and Update') {
git(url: 'https://github.com/nimble-platform/catalog-search-service.git', branch: env.BRANCH_NAME)
}
stage('Build Java') {
sh 'mvn clean package -DskipTests'
}
if (env.BRANCH_NAME == 'staging') {
stage('Build Docker') {
sh 'mvn docker:build -P docker -DdockerImageTag=staging'
}
stage('Push Docker') {
sh 'docker push nimbleplatform/catalog-search-service:staging'
}
stage('Deploy') {
sh 'ssh staging "cd /srv/nimble-staging/ && ./run-staging.sh restart-single search-service"'
}
} else {
stage('Build Docker') {
sh 'mvn docker:build -P docker'
}
stage('Deploy') {
sh 'ssh nimble "cd /data/deployment_setup/prod/ && sudo ./run-prod.sh restart-single search-service"'
}
}
// push and apply only master branch
// if (env.BRANCH_NAME == 'master') {
// stage('Push Docker') {
// withDockerRegistry([credentialsId: 'NimbleDocker']) {
// sh 'docker push nimbleplatform/catalog-search-service'
// }
// }
//
// stage('Apply to Cluster') {
// sh 'kubectl apply -f kubernetes/deploy-prod.yml -n prod --validate=false'
// }
// }
}