-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
100 lines (96 loc) · 3.99 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
// Tell Jenkins how to build projects from this repository
pipeline {
agent {
label 'magicdraw19'
}
parameters {
string(name: 'RELEASE_VERSION', defaultValue: '',
description: 'Set this parameter to update the project version version accordingly, should be used to remove -SNAPSHOT from version numbers. Leave it empty to keep version from the repository.')
}
// Keep only the last 5 builds
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
}
environment {
VERSION_STRINGS = " ${params.RELEASE_VERSION ? '-Pversion=' + params.RELEASE_VERSION : ''} "
}
tools {
maven 'Maven 3.3.9'
jdk 'OpenJDK 8'
}
stages {
stage('Build SoS Deployment Plug-in') {
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername'), usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
dir ('./SoS Deployment Plugin/'){
sh "./gradlew clean"
sh "./gradlew ${VERSION_STRINGS} assemble bundle"
}
}
}
}
stage('Deploy SoS Deployment Plug-in') {
when {branch "master"}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername'), usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
script{
dir ('./SoS Deployment Plugin/') {
sh "./gradlew ${VERSION_STRINGS} publish"
}
}
}
}
}
stage('Build SoS Design Plug-in') {
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername'), usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
dir ('./SoS Design Plugin/'){
sh "./gradlew clean"
sh "./gradlew ${VERSION_STRINGS} assemble bundle"
}
}
}
}
stage('Deploy SoS Design Plug-in') {
when {branch "master"}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername'), usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
script{
dir ('./SoS Design Plugin/') {
sh "./gradlew ${VERSION_STRINGS} publish"
}
}
}
}
}
stage('Build Toolchain Design Plug-in') {
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername'), usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
dir ('./Toolchain Design Plugin/'){
sh "./gradlew clean"
sh "./gradlew ${VERSION_STRINGS} assemble bundle"
}
}
}
}
stage('Deploy Toolchain Design Plug-in') {
when {branch "master"}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername'), usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
script{
dir ('./Toolchain Design Plugin/') {
sh "./gradlew ${VERSION_STRINGS} publish"
}
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'SoS Deployment Plugin/build/bundles/arrowhead-vorto-extension-magicdraw-plugin.zip', onlyIfSuccessful: true
archiveArtifacts artifacts: 'SoS Design Plugin/build/bundles/arrowhead-magicdraw-plugin.zip', onlyIfSuccessful: true
archiveArtifacts artifacts: 'Toolchain Design Plugin/build/bundles/arrowhead-tools-magicdraw-plugin.zip', onlyIfSuccessful: true
}
}
}