forked from navikt/pdfgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
99 lines (94 loc) · 2.92 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env groovy
pipeline {
agent any
tools {
jdk "openjdk11"
}
environment {
ZONE = 'fss'
APPLICATION_NAME = 'pdf-gen'
DOCKER_SLUG = 'integrasjon'
GITHUB_NAME = 'pdfgen'
KUBECONFIG="kubeconfig-teamsykefravr"
FASIT_ENVIRONMENT = 'q1'
}
stages {
stage('initialize') {
environment { APPLICATION_NAME = "${env.GITHUB_NAME}" }
steps {
init action: 'gradle'
}
}
stage('build') {
steps {
sh './gradlew build -x test'
}
}
stage('run tests (unit & intergration)') {
steps {
sh './gradlew test'
slackStatus status: 'passed'
}
}
stage('create uber jar') {
steps {
sh './gradlew shadowJar'
}
}
stage('push docker image') {
steps {
dockerUtils action: 'createPushImage'
}
}
stage('deploy to preprod') {
parallel {
stage("deploy to preprod FSS") {
steps {
deployApp action: 'kubectlDeploy', cluster: 'preprod-fss'
}
}
stage("deploy to preprod SBS") {
steps {
deployApp action: 'kubectlDeploy', cluster: 'preprod-sbs'
}
}
}
}
stage('deploy to production') {
when { environment name: 'DEPLOY_TO', value: 'production' }
parallel {
stage("deploy to prod FSS") {
steps {
deployApp action: 'kubectlDeploy', cluster: 'prod-fss'
}
}
stage("deploy to prod SBS") {
steps {
deployApp action: 'kubectlDeploy', cluster: 'prod-sbs'
}
}
}
}
stage('tag git release') {
when { environment name: "DEPLOY_TO", value: 'production' }
steps {
githubStatus action: 'tagRelease', applicationName: "${env.GITHUB_NAME}"
}
}
}
post {
always {
postProcess action: 'always', applicationName: "${env.GITHUB_NAME}"
junit '**/build/test-results/test/*.xml'
archiveArtifacts artifacts: 'build/reports/rules.csv', allowEmptyArchive: true
archiveArtifacts artifacts: '**/build/libs/*', allowEmptyArchive: true
archiveArtifacts artifacts: '**/build/install/*', allowEmptyArchive: true
}
success {
postProcess action: 'success', applicationName: "${env.GITHUB_NAME}"
}
failure {
postProcess action: 'failure', applicationName: "${env.GITHUB_NAME}"
}
}
}