-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
77 lines (64 loc) · 2.43 KB
/
Jenkinsfile
File metadata and controls
77 lines (64 loc) · 2.43 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def label = "mypod-${UUID.randomUUID().toString()}"
def dockerRegistry = "100.71.71.71:5000"
def Creds = "git_cred"
properties([
parameters([
stringParam(
defaultValue: '***',
description: '',
name: 'service')
])
])
podTemplate(label: label, annotations: [podAnnotation(key: "sidecar.istio.io/inject", value: "false")], containers: [
containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v3', command: 'cat', ttyEnabled: true),
containerTemplate(name: 'helm', image: 'ghostgoose33/kubectl_helm:v1', command: 'cat', ttyEnabled: true)
],
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock')
], serviceAccount: "jenkins")
{
node(label)
{
try{
stage("Pre-Test"){
dir('get'){
git(branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-GET.git', credentialsId: "${Creds}")
imageTagUI = (sh (script: "git rev-parse --short HEAD", returnStdout: true))
tmp = "1"
pathTocodeget = pwd()
}
}
stage("Deploy to Kubernetes"){
if(params.service == "db"){
container ("helm"){
sh "helm upgrade --install --namespace production --force db-service-v1 ${pathTocodeget}/List-Helm-Charts/db-service --set=deploy.version=v1,conf.ver=v1,image.tag=${params.imageTagDB_}"
}
}
if(params.service == "get"){
container ("helm"){
sh "helm upgrade --install --namespace production --force get-service-v1 ${pathTocodeget}/List-Helm-Charts/get-service --set=deploy.version=v1,conf.ver=v1,image.tag=${params.imageTagGET_}"
}
}
if(params.service == "ui"){
container ("helm"){
sh "helm upgrade --install --namespace production --force ui-service-v1 ${pathTocodeget}/List-Helm-Charts/ui-service --set=deploy.version=v1,conf.ver=v1,image.tag=${params.imageTagUI_}"
}
}
if(params.service == "post"){
container ("helm"){
sh "helm upgrade --install --namespace production --force post-service-v1 ${pathTocodeget}/List-Helm-Charts/post-service --set=deploy.version=v1,conf.ver=v1,image.tag=${params.imageTagPOST_}"
}
}
}
sleep 10
stage ("Prod Tests"){
container('python-alpine'){
//sh "python3 /e2e-test-prod.py"
}
}
}
catch(err){
currentBuild.result = 'Failure'
}
}
}