-
Notifications
You must be signed in to change notification settings - Fork 483
/
Jenkinsfile
85 lines (81 loc) · 3.59 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
#! groovy
// Keep logs/reports/etc of last 15 builds, only keep build artifacts of last build
properties([
buildDiscarder(logRotator(numToKeepStr: '15', artifactNumToKeepStr: '1')),
// specify projects to allow to copy artifacts with a comma-separated list.
copyArtifactPermission("/appcelerator-studio/titanium_studio/*,../Pydev/*,../studio3-ruby/*,../studio3-php/*,../studio3-rcp/*"),
])
// Set after copying upstream artifacts
// Tells maven where to assume a p2 repo holding the sftp libraries would be
def sftpURL = ''
def targetBranch = 'development'
def isPR = false
timestamps {
// node('((linux && vncserver) || osx) && jdk') { // TODO: Re-enable choosin osx box?
node('linux && vncserver && jdk') {
stage('Checkout') {
// checkout scm
// Hack for JENKINS-37658 - see https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-Customize-Checkout-for-Pipeline-Multibranch
checkout([
$class: 'GitSCM',
branches: scm.branches,
extensions: scm.extensions + [[$class: 'CleanCheckout'], [$class: 'CloneOption', honorRefspec: true, noTags: true, reference: '', shallow: true, depth: 30, timeout: 30]],
userRemoteConfigs: scm.userRemoteConfigs
])
isPR = env.BRANCH_NAME.startsWith('PR-')
if (isPR) {
targetBranch = env.CHANGE_TARGET
} else {
targetBranch = env.BRANCH_NAME
}
}
stage('Dependencies') {
step([$class: 'CopyArtifact',
filter: 'repository/',
fingerprintArtifacts: true,
projectName: "../libraries_com/${targetBranch}",
target: 'libraries_com'])
sftpURL = "file:${pwd()}/libraries_com/repository"
} // stage('Dependencies')
stage('Build') {
withEnv(["PATH+MAVEN=${tool name: 'Maven 3.5.0', type: 'maven'}/bin"]) {
// https://stackoverflow.com/questions/10463077/how-to-refer-environment-variable-in-pom-xml
withCredentials([usernamePassword(credentialsId: 'aca99bee-0f1e-4fc5-a3da-3dfd73f66432', passwordVariable: 'STOREPASS', usernameVariable: 'ALIAS')]) {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
try {
timeout(30) {
sh "mvn -Dsftp.p2.repo.url=${sftpURL} -Dmaven.test.failure.ignore=true -Djarsigner.keypass=${env.STOREPASS} -Djarsigner.storepass=${env.STOREPASS} -Djarsigner.keystore=${env.KEYSTORE} clean verify"
}
} catch (err) {
sleep(10) // try and wait for log to finish writing?
archiveArtifacts artifacts: 'tests/*/target/work/data/.metadata/.log,tests/*/target/work/configuration/*.log'
throw err
} finally {
// record tests even if we failed
junit 'tests/*/target/surefire-reports/TEST-*.xml'
}
} // xvnc
} // withCredentials
} // withEnv(maven)
dir('releng/com.aptana.studio.update/target') {
// To keep backwards compatability with existing build pipeline, rename to "dist"
sh 'mv repository dist'
archiveArtifacts artifacts: 'dist/**/*'
def jarName = sh(returnStdout: true, script: 'ls dist/features/com.aptana.feature_*.jar').trim()
def version = (jarName =~ /.*?_(.+)\.jar/)[0][1]
currentBuild.displayName = "#${version}-${currentBuild.number}"
}
dir('releng/com.aptana.studio.test.update/target') {
sh 'mv repository dist-tests'
archiveArtifacts artifacts: 'dist-tests/**/*'
}
} // stage('Build')
// If not a PR, trigger downstream builds for same branch
if (!isPR) {
build job: "appcelerator-studio/titanium_studio/${env.BRANCH_NAME}", wait: false
build job: "../studio3-php/${env.BRANCH_NAME}", wait: false
build job: "../studio3-ruby/${env.BRANCH_NAME}", wait: false
build job: "../Pydev/${env.BRANCH_NAME}", wait: false
}
} // node
} // timestamps