forked from apache/incubator-kie-kogito-runtimes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.release
88 lines (88 loc) · 3.88 KB
/
Jenkinsfile.release
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
pipeline {
agent {
label 'kie-rhel7 && kie-mem16g'
}
tools {
maven 'kie-maven-3.6.2'
jdk 'kie-jdk11'
}
parameters {
string(name: 'RELEASE_VERSION', defaultValue: '', description: 'Kogito release version')
string(name: 'BASE_BRANCH', defaultValue: 'master', description: 'Base branch to release from. Usually from master but if releasing a minor version version the use ex: 0.9.x')
string(name: 'TARGET_BRANCH', defaultValue: '', description: 'Branch to be pushed upstream. Usually not needed if just releasing from master and no need for maintenance branch.')
}
environment {
MAVEN_OPTS = '-Xms1024m -Xmx4g'
}
stages {
stage('CleanWorkspace') {
steps {
cleanWs()
}
}
stage('Clone repositories') {
steps {
wrap([$class: 'BuildUser']) {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'kie-ci', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) {
sh 'git clone -c user.name="${BUILD_USER}" -c user.email="${BUILD_USER_EMAIL}" -b $BASE_BRANCH https://$GIT_USERNAME:[email protected]/kiegroup/kogito-runtimes'
sh 'git clone -c user.name="${BUILD_USER}" -c user.email="${BUILD_USER_EMAIL}" -b $BASE_BRANCH https://$GIT_USERNAME:[email protected]/kiegroup/kogito-apps'
sh 'git clone -c user.name="${BUILD_USER}" -c user.email="${BUILD_USER_EMAIL}" -b $BASE_BRANCH https://$GIT_USERNAME:[email protected]/kiegroup/kogito-examples'
}
}
sh 'chmod -R +x kogito-runtimes/scripts'
}
}
stage('Prepare Maven settings'){
steps {
configFileProvider([configFile(fileId: '771ff52a-a8b4-40e6-9b22-d54c7314aa1e', targetLocation: 'jenkins-settings.xml', variable: 'SETTINGS_XML_FILE')]){
sh "cd kogito-runtimes && mkdir -p .mvn && echo '-B -s $WORKSPACE/jenkins-settings.xml' > .mvn/maven.config"
sh "cd kogito-apps && mkdir -p .mvn && echo '-B -s $WORKSPACE/jenkins-settings.xml' > .mvn/maven.config"
sh "cd kogito-examples && mkdir -p .mvn && echo '-B -s $WORKSPACE/jenkins-settings.xml' > .mvn/maven.config"
}
}
}
stage('Branch and update version') {
steps {
sh "cd kogito-runtimes/scripts/release && ./01-create-local-release-branches.sh ${params.RELEASE_VERSION} ${params.BASE_BRANCH} ${params.TARGET_BRANCH}"
sh "cd kogito-runtimes/scripts/release && ./02-update-version-all.sh ${params.RELEASE_VERSION}"
}
}
stage('Build') {
steps {
sh "cd kogito-runtimes/scripts/release && ./03-build-local-release-branches.sh"
}
}
stage('Tag and release') {
steps {
sh "cd kogito-runtimes/scripts/release && ./04-commit-local-release-branches.sh ${params.RELEASE_VERSION}"
}
}
stage('Approval') {
steps {
input message: 'Is release ready to be pushed?', ok: 'Go ahead and release'
}
}
stage('Push release tag') {
steps {
sh "cd kogito-runtimes/scripts/release && ./05-tag-and-push-local-release-branches.sh ${params.RELEASE_VERSION} ${params.TARGET_BRANCH}"
}
}
stage('Deploy to maven') {
steps {
configFileProvider([configFile(fileId: '771ff52a-a8b4-40e6-9b22-d54c7314aa1e', targetLocation: 'jenkins-settings.xml', variable: 'SETTINGS_XML_FILE')]) {
sh 'cd kogito-runtimes/scripts/release && ./06-deploy-release.sh $SETTINGS_XML_FILE'
}
}
}
stage('Results') {
steps {
echo "Release of ${params.RELEASE_VERSION} done successfully"
}
}
}
post {
always {
cleanWs()
}
}
}