forked from aptana/studio3-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
77 lines (72 loc) · 3.07 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
#! groovy
properties([
// Keep logs/reports/etc of last 3 builds, only keep build artifacts of last build
buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '1')),
// specify projects to allow to copy artifacts with a comma-separated list.
copyArtifactPermission("/aptana-studio-sync/sync-nightlies-aptana-${env.BRANCH_NAME},../studio3-rcp/${env.BRANCH_NAME}"),
])
timestamps {
def studio3RepoURL = ''
def studio3TestRepoURL = ''
def targetBranch = 'development'
def isPR = false
// node('((linux && vncserver) || osx) && jdk') {
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: 'CleanBeforeCheckout'], [$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: 'dist/,dist-tests/',
fingerprintArtifacts: true,
selector: lastSuccessful(),
projectName: "/aptana-studio/studio3/${targetBranch}",
target: 'studio3'])
studio3RepoURL = "file:${pwd()}/studio3/dist"
studio3TestRepoURL = "file:${pwd()}/studio3/dist-tests"
}
stage('Build') {
withEnv(["PATH+MAVEN=${tool name: 'Maven 3.5.0', type: 'maven'}/bin"]) {
withCredentials([usernamePassword(credentialsId: 'aca99bee-0f1e-4fc5-a3da-3dfd73f66432', passwordVariable: 'STOREPASS', usernameVariable: 'ALIAS')]) {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
try {
timeout(30) {
// TODO Get package vs verify goals running in separate stages!
sh "mvn -Dstudio3.p2.repo.url=${studio3RepoURL} -Dstudio3.tests.p2.repo.url=${studio3TestRepoURL} -Dmaven.test.failure.ignore=true -Djarsigner.keypass=${env.STOREPASS} -Djarsigner.storepass=${env.STOREPASS} -Djarsigner.keystore=${env.KEYSTORE} clean verify"
}
} finally {
// record tests even if we failed
junit 'tests/*/target/surefire-reports/TEST-*.xml'
}
} // xvnc
} // withCredentials
} // withEnv(maven)
// Archive the generated p2 repo
dir('releng/com.aptana.studio.php.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.php.feature_*.jar').trim()
def version = (jarName =~ /.*?_(.+)\.jar/)[0][1]
currentBuild.displayName = "#${version}-${currentBuild.number}"
}
} // stage('Build')
// If not a PR, trigger downstream builds for same branch
if (!isPR) {
build job: "../studio3-rcp/${env.BRANCH_NAME}", wait: false
}
} // node
} // timestamps