-
Notifications
You must be signed in to change notification settings - Fork 65
/
Jenkinsfile
54 lines (43 loc) · 1.53 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
podTemplate(
inheritFrom: "maven",
label: "myJenkins",
cloud: "openshift",
volumes: [
persistentVolumeClaim(claimName: "m2repo", mountPath: "/home/jenkins/.m2/")
]) {
node("myJenkins") {
@Library('github.com/redhat-helloworld-msa/jenkins-library@master') _
stage ('SCM checkout'){
echo 'Checking out git repository'
checkout scm
}
stage ('Maven build'){
echo 'Building project'
sh "mvn package"
}
stage ('DEV - Image build'){
echo 'Building docker image and deploying to Dev'
buildApp('helloworld-msa-dev', "aloha")
echo "This is the build number: ${env.BUILD_NUMBER}"
}
stage ('Automated tests'){
echo 'This stage simulates automated tests'
sh "mvn -B -Dmaven.test.failure.ignore test"
}
stage ('QA - Promote image'){
echo 'Deploying to QA'
promoteImage('helloworld-msa-dev', 'helloworld-msa-qa', 'aloha', 'latest')
}
stage ('Wait for approval'){
input 'Approve to production?'
}
stage ('PRD - Promote image'){
echo 'Deploying to production'
promoteImage('helloworld-msa-qa', 'helloworld-msa', 'aloha', env.BUILD_NUMBER)
}
stage ('PRD - Canary Deploy'){
echo 'Performing a canary deployment'
canaryDeploy('helloworld-msa', 'aloha', env.BUILD_NUMBER)
}
}
}