-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile-GetVersion
85 lines (82 loc) · 3.75 KB
/
Jenkinsfile-GetVersion
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
// @Library(['github.com/Magik3a/Jenkinsfile_Gitflow_Versioning@master']) _
pipeline {
agent any
libraries {
lib('github.com/Magik3a/Jenkinsfile_Gitflow_Versioning@' + BRANCH_NAME)
}
environment {
PROJECT_VERSION = '3.22.21.0'
}
stages {
stage('Test Versions') {
parallel {
// Template for testing
// - Master Branch - 1.19.12.BUILD_NUMBER = 1.19.12.0
// - Hotfix Branch - *.**.+1.BUILD_NUMBER = 1.19.13.1
// - Release Branch - *.+1.+1.BUILD_NUMBER = 1.20.13.1
// - Develop Branch - *.+1.+1.BUILD_NUMBER = 1.20.13.1
// - Feature Branch -+1.+1.+1.BUILD_NUMBER = 2.20.13.1
stage('Test master branch') {
steps {
script{
if(get_version('master') != "1.19.12.${BUILD_NUMBER}"){
error 'Not Correct Version for master branch!!'
}
if(get_version('master', PROJECT_VERSION) != "3.22.21.${BUILD_NUMBER}"){
error 'Not Correct Version for master branch!!'
}
}
}
}
stage('Test hotfix branch') {
steps {
script{
if(get_version('hotfix/lv-666') != "1.19.12.${BUILD_NUMBER}"){
error 'Not Correct Version for hotfix branch!'
}
if(get_version('hotfix/lv-666', PROJECT_VERSION) != "3.22.21.${BUILD_NUMBER}"){
error 'Not Correct Version for hotfix branch!'
}
}
}
}
stage('Test release branch') {
steps {
script{
if(get_version('release/1.19.13') != "1.19.13.${BUILD_NUMBER}"){
error 'Not Correct Version for release branch!'
}
if(get_version('release/3.22.22', PROJECT_VERSION) != "3.22.22.${BUILD_NUMBER}"){
error 'Not Correct Version for release branch!'
}
}
}
}
stage('Test develop branch') {
steps {
script{
if(get_version('develop') != "1.20.13.${BUILD_NUMBER}"){
error 'Not Correct Version for develop branch!'
}
if(get_version('develop', PROJECT_VERSION) != "3.23.22.${BUILD_NUMBER}"){
error 'Not Correct Version for develop branch!'
}
}
}
}
stage('Test feature branch') {
steps {
script{
if(get_version('feature/lv-333') != "2.20.13.${BUILD_NUMBER}"){
error 'Not Correct Version for feature branch!'
}
if(get_version('feature/lv-333', PROJECT_VERSION) != "4.23.22.${BUILD_NUMBER}"){
error 'Not Correct Version for feature branch!'
}
}
}
}
}
}
}
}