-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
executable file
·55 lines (45 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
pipeline {
agent {
label "jenkins-maven"
}
environment {
ORG = 'jenkinsx'
APP_NAME = 'draft-spring-boot-app'
}
stages {
stage('Build Release') {
steps {
container('maven') {
// ensure we're not on a detached head
sh "git checkout master"
// until we switch to the new kubernetes / jenkins credential implementation use git credentials store
sh "git config credential.helper store"
// so we can retrieve the version in later steps
sh "echo \$(jx-release-version) > VERSION"
sh "mvn versions:set -DnewVersion=\$(jx-release-version)"
}
dir ('./charts/draft-spring-boot-app') {
container('maven') {
sh "make tag"
}
}
container('maven') {
sh 'mvn clean deploy'
sh "docker build -f Dockerfile.release -t $JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST:$JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT/$ORG/$APP_NAME:\$(cat VERSION) ."
sh "docker push $JENKINS_X_DOCKER_REGISTRY_SERVICE_HOST:$JENKINS_X_DOCKER_REGISTRY_SERVICE_PORT/$ORG/$APP_NAME:\$(cat VERSION)"
}
}
}
stage('Deploy Staging') {
steps {
dir ('./charts/draft-spring-boot-app') {
container('maven') {
sh 'make release'
sh 'helm install . --namespace staging --name example-release'
sh 'exposecontroller --namespace staging --http' // until we switch to git environments where helm hooks will expose services
}
}
}
}
}
}