-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathJenkinsfile
121 lines (113 loc) · 4.96 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
109
110
111
112
113
114
115
116
117
118
119
120
121
pipeline {
agent { label 'migration' }
tools {
maven 'apache-maven-latest'
jdk 'openjdk-jdk17-latest'
}
environment {
JACOCO_VERSION = "0.8.10"
MVN_QUALITY_PROFILES = '-P full -P test -P rcptt'
JACOCO_EXEC_FILE_PATH = '${WORKSPACE}/jacoco.exec'
}
stages {
stage('Generate Target Platform') {
steps {
script {
sh 'mvn clean verify -f releng/plugins/org.polarsys.capella.studio.releng.targets/pom.xml'
}
}
}
stage('Package & Install Capella Studio') {
steps {
withEnv(['MAVEN_OPTS=-Xmx3g']) {
script {
sh "mvn clean install -P full -P sign -P product -e "
}
}
}
}
stage('Archive artifacts') {
steps {
archiveArtifacts artifacts: 'releng/plugins/org.polarsys.capella.studio.releng.updatesite/target/repository/**'
}
}
stage('Deploy') {
steps {
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
script {
def VERSION = BRANCH_NAME
if (VERSION.matches("v\\d\\.\\d\\.x")) {
VERSION = VERSION.substring(1)
}
def DEST_UPDATESITE_DIR='/home/data/httpd/download.eclipse.org/capella/studio/updates/nightly/'+VERSION
def DEST_PRODUCT_DIR='/home/data/httpd/download.eclipse.org/capella/studio/products/nightly/'+VERSION
sh "echo 'deploy update site'"
sh "ssh [email protected] rm -rf ${DEST_UPDATESITE_DIR}"
sh "ssh [email protected] mkdir -p ${DEST_UPDATESITE_DIR}"
sh "scp -r releng/plugins/org.polarsys.capella.studio.releng.updatesite/target/repository/* [email protected]:${DEST_UPDATESITE_DIR}"
sh "echo 'deploy product'"
sh "ssh [email protected] rm -rf ${DEST_PRODUCT_DIR}"
sh "ssh [email protected] mkdir -p ${DEST_PRODUCT_DIR}"
sh "scp -r releng/plugins/org.polarsys.capella.studio.releng.product/target/products/*.zip [email protected]:${DEST_PRODUCT_DIR}"
}
}
}
}
stage('Run RCPTT Tests') {
steps {
wrap([$class: 'Xvnc', takeScreenshot: true, useXauthority: true]) {
withEnv(['MAVEN_OPTS=-Xmx3g']) {
script {
def jacocoPrepareAgent = "-Djacoco.destFile=$JACOCO_EXEC_FILE_PATH -Djacoco.append=true org.jacoco:jacoco-maven-plugin:$JACOCO_VERSION:prepare-agent"
sh "mvn -Dmaven.test.failure.ignore=true -Dtycho.localArtifacts=ignore ${jacocoPrepareAgent} verify -P rcptt -e "
}
}
}
}
}
stage('Run JUnit Tests') {
steps {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
withEnv(['MAVEN_OPTS=-Xmx3g']) {
script {
def jacocoPrepareAgent = "-Djacoco.destFile=$JACOCO_EXEC_FILE_PATH -Djacoco.append=true org.jacoco:jacoco-maven-plugin:$JACOCO_VERSION:prepare-agent"
sh "mvn -Dmaven.test.failure.ignore=true -Dtycho.localArtifacts=ignore ${jacocoPrepareAgent} verify -P full -P product -P test -e "
}
}
}
}
}
stage('Publish tests results') {
steps {
junit allowEmptyResults: true, testResults: '*.xml,**/target/surefire-reports/*.xml'
sh "mvn -Djacoco.dataFile=$JACOCO_EXEC_FILE_PATH org.jacoco:jacoco-maven-plugin:$JACOCO_VERSION:report $MVN_QUALITY_PROFILES -e -f pom.xml"
}
}
stage('Perform Sonar analysis') {
environment {
PROJECT_NAME = 'capella-studio'
SONARCLOUD_TOKEN = credentials('sonar-token-capella-studio')
SONAR_PROJECT_KEY = 'eclipse-capella_capella-studio'
}
steps {
withEnv(['MAVEN_OPTS=-Xmx3g']) {
script {
def jacocoParameters = "-Dsonar.coverage.jacoco.xmlReportPaths='target/site/jacoco/jacoco.xml,target/surefire-reports/TEST*.xml' -Dsonar.java.coveragePlugin=jacoco -Dsonar.core.codeCoveragePlugin=jacoco "
def sonarExclusions = "-Dsonar.exclusions='**/generated/**/*.java,**/src-gen/**/*.java' "
def javaVersion = "8"
def sonarCommon = "sonar:sonar -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.organization=eclipse-capella -Dsonar.host.url=https://sonarcloud.io -Dsonar.login='$SONARCLOUD_TOKEN' -Dsonar.skipDesign=true -Dsonar.dynamic=reuseReports -Dsonar.java.source=${javaVersion} -Dsonar.scanner.force-deprecated-java-version=true "
def sonarBranchAnalysis = "-Dsonar.branch.name=${BRANCH_NAME}"
def sonarPullRequestAnalysis = ("${BRANCH_NAME}".contains('PR-') ? "-Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.repository=eclipse/$PROJECT_NAME -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.pullrequest.branch=${CHANGE_BRANCH}" : "" )
def sonar = sonarCommon + jacocoParameters + sonarExclusions + ("${BRANCH_NAME}".contains('PR-') ? sonarPullRequestAnalysis : sonarBranchAnalysis)
sh "mvn ${sonar} $MVN_QUALITY_PROFILES -e -f pom.xml"
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: '**/*.log,**/*.layout'
}
}
}