-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
56 lines (51 loc) · 1.55 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
@Library("[email protected]")
final def p8 = new de.predic8.jenkinsutils.P8(this, scm, 'pg-op-mon')
pipeline {
agent {
kubernetes {
yamlFile 'deploy/builder-pod.yaml'
}
}
parameters {
string(name: 'KUBECTL_OPTS', defaultValue: '', description: 'Kubernetes Cluster URL')
}
stages {
stage('Build') {
steps {
sh 'sed -i "s/ARG VERSION/ENV VERSION=${BUILD_NUMBER}/" Dockerfile'
container('buildah') {
script {
p8.maven.useInternalRepo()
}
sh 'mv ~/.m2/settings.xml .'
script {
p8.oci.repoLogin()
p8.oci.buildV2()
}
}
}
}
stage('Docker push') {
steps {
container('buildah') {
script {
p8.oci.pushV2()
}
}
}
}
stage('Deploy') {
steps {
sh 'cp deploy/pg-op-mon.yaml pg-op-mon.yaml'
sh 'sed -i "s/\\\$BUILD_NUMBER/$BUILD_NUMBER/" ./pg-op-mon.yaml'
container('kubectl') {
script {
p8.kubectl.prepareCredentials()
p8.kubectl.applyV2()
}
sh 'kubectl $KUBECTL_OPTS -n monitoring rollout status deployment pg-op-mon'
}
}
}
}
}