-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
56 lines (56 loc) · 1.49 KB
/
Jenkinsfile
File metadata and controls
56 lines (56 loc) · 1.49 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
pipeline {
options {
disableConcurrentBuilds()
}
agent {
label "jenkins-maven"
}
environment {
DEPLOY_NAMESPACE = "jx-staging"
}
stages {
stage('Validate Environment') {
steps {
container('maven') {
dir('env') {
sh 'jx step helm build'
}
}
}
}
stage('Update Environment') {
when {
branch 'master'
}
steps {
container('maven') {
dir('env') {
sh 'jx step helm apply'
}
}
}
}
stage ('Deploy FortiWeb') {
when {
branch 'master'
}
steps {
container('maven') {
sh "kubectl get pods -A"
sh "kubectl apply -f fwb-deploy.yml"
sh """
cluster_ip=\$(kubectl get svc -n jx-staging -o=jsonpath='{.items[0].spec.clusterIP}')
port=\$(kubectl get svc -n jx-staging -o=jsonpath='{.items[0].spec.ports[0].port}')
fwb_ip=\$(kubectl get pods -l "app=fwb" -o=jsonpath={.items[0].status.podIP})
echo \$cluster_ip \$port \$fwb_ip
sed -i "s/{{cluster-ip}}/\${cluster_ip}/g" fwb-config.cfg
sed -i "s/{{cluster-port}}/\${port}/g" fwb-config.cfg
cat fwb-config.cfg
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no admin@\$fwb_ip show server-policy policy
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no admin@\$fwb_ip < fwb-config.cfg
"""
}
}
}
}
}