This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
87 lines (76 loc) · 2.08 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
pipeline {
agent any
environment {
APPLICATION_NAME = 'dagpenger-joark-mottak'
ZONE = 'fss'
NAMESPACE = 'default'
VERSION = sh(script: './gradlew -q printVersion', returnStdout: true).trim()
}
stages {
stage('Install dependencies') {
steps {
sh "./gradlew assemble"
}
}
stage('Build') {
steps {
sh "./gradlew check"
}
post {
always {
publishHTML target: [
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/tests/test',
reportFiles: 'index.html',
reportName: 'Test coverage'
]
junit 'build/test-results/test/*.xml'
}
}
}
stage('Publish') {
steps {
timeout(10) {
input 'Keep going?'
}
withCredentials([usernamePassword(
credentialsId: 'repo.adeo.no',
usernameVariable: 'REPO_USERNAME',
passwordVariable: 'REPO_PASSWORD'
)]) {
sh "docker login -u ${REPO_USERNAME} -p ${REPO_PASSWORD} repo.adeo.no:5443"
}
script {
sh "./gradlew dockerPush"
}
}
}
stage("Publish service contract") {
steps {
withCredentials([usernamePassword(
credentialsId: 'repo.adeo.no',
usernameVariable: 'REPO_USERNAME',
passwordVariable: 'REPO_PASSWORD'
)]) {
sh "curl -vvv --user ${REPO_USERNAME}:${REPO_PASSWORD} --upload-file nais.yaml https://repo.adeo.no/repository/raw/nais/${APPLICATION_NAME}/${VERSION}/nais.yaml"
}
}
}
stage('Deploy to non-production') {
steps {
script {
response = naisDeploy.createNaisAutodeployment(env.APPLICATION_NAME, env.VERSION,"t0",env.ZONE ,env.NAMESPACE, "")
}
}
}
stage('Deploy to production') {
steps {
script {
response = naisDeploy.createNaisAutodeployment(env.APPLICATION_NAME, env.VERSION,"p", env.ZONE ,env.NAMESPACE, "")
}
}
}
}
}