This repository has been archived by the owner on Feb 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
108 lines (95 loc) · 3.22 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
100
101
102
103
104
105
106
107
108
pipeline {
agent {
label "jenkins-maven-java11"
}
environment {
ORG = 'activiti'
APP_NAME = 'activiti-cloud-api'
}
stages {
stage('CI Build and push snapshot') {
when {
branch 'PR-*'
}
environment {
PREVIEW_VERSION = "0.0.0-SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER"
PREVIEW_NAMESPACE = "$APP_NAME-$BRANCH_NAME".toLowerCase()
HELM_RELEASE = "$PREVIEW_NAMESPACE".toLowerCase()
}
steps {
container('maven') {
sh "mvn versions:set -DnewVersion=$PREVIEW_VERSION"
sh "mvn install"
sh 'export VERSION=$PREVIEW_VERSION' // && skaffold build -f skaffold.yaml'
}
}
}
stage('Build Release') {
when {
branch 'develop'
}
steps {
container('maven') {
// ensure we're not on a detached head
sh "git checkout develop"
sh "git config --global credential.helper store"
sh "jx step git credentials"
// so we can retrieve the version in later steps
sh "echo \$(jx-release-version) > VERSION"
sh "mvn versions:set -DnewVersion=\$(cat VERSION)"
sh "mvn clean verify"
sh "git add --all"
sh "git commit -m \"Release \$(cat VERSION)\" --allow-empty"
sh "git tag -fa v\$(cat VERSION) -m \"Release version \$(cat VERSION)\""
sh "git push origin v\$(cat VERSION)"
}
container('maven') {
sh 'mvn clean deploy -DskipTests'
sh 'export VERSION=`cat VERSION`' // && skaffold build -f skaffold.yaml'
sh "updatebot push-version --kind maven org.activiti.cloud.api:activiti-cloud-api-dependencies \$(cat VERSION)"
sh "updatebot update --merge false"
}
}
}
stage('Build Release from Tag') {
when {
tag '*RELEASE'
}
steps {
container('maven') {
// ensure we're not on a detached head
sh "git checkout $TAG_NAME"
sh "git config --global credential.helper store"
sh "jx step git credentials"
// so we can retrieve the version in later steps
sh "echo \$TAG_NAME > VERSION"
sh "mvn versions:set -DnewVersion=\$(cat VERSION)"
}
container('maven') {
sh '''
mvn clean deploy -P !alfresco -P central
'''
sh 'export VERSION=`cat VERSION`'// && skaffold build -f skaffold.yaml'
sh "git config --global credential.helper store"
sh "jx step git credentials"
//sh "updatebot push"
//sh "updatebot update"
sh "echo pushing with update using version \$(cat VERSION)"
sh "updatebot push-version --kind maven org.activiti.cloud.api:activiti-cloud-api-dependencies \$(cat VERSION)"
}
}
}
}
post {
failure {
slackSend(
channel: "#activiti-community-builds",
color: "danger",
message: "$BUILD_URL"
)
}
always {
cleanWs()
}
}
}