forked from alexcheng1982/happyride
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
77 lines (76 loc) · 1.62 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
75
76
77
addressServiceImageTag = ''
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
serviceAccountName: deploy-user
securityContext:
fsGroup: 1000
containers:
- name: maven
image: maven:3.6.3-jdk-8
command:
- sleep
args:
- infinity
resources:
requests:
cpu: "0.5"
memory: 512Mi
limits:
cpu: "1"
memory: 1Gi
volumeMounts:
- name: dockersock
mountPath: "/var/run/docker.sock"
- name: helmfile
image: quay.io/roboll/helmfile:helm3-v0.125.0
command:
- sleep
args:
- infinity
resources:
limits:
cpu: "0.5"
memory: 256Mi
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
"""
}
}
stages {
stage('Build') {
environment {
BUILD_DOCKER = true
CONTAINER_REGISTRY='docker-registry:5000'
}
steps {
git 'https://github.com/alexcheng1982/happyride'
container('maven') {
sh 'mvn -B -ntp -Dmaven.test.failure.ignore install'
junit '**/target/surefire-reports/TEST-*.xml'
script {
addressServiceImageTag = readFile("happyride-address-service/target/image_tag.txt")
}
}
}
}
stage('Deploy') {
environment {
ADDRESS_SERVICE_VERSION = "${addressServiceImageTag}"
CONTAINER_REGISTRY = "localhost:30000"
}
steps {
git 'https://github.com/alexcheng1982/happyride'
container('helmfile') {
sh 'cd k8s/happyride/apps/address-service && helmfile apply'
}
}
}
}
}