|
| 1 | +#!groovy |
| 2 | + |
| 3 | +node('linux && ant && eclipse && jdk && vncserver') { |
| 4 | + try { |
| 5 | + def targetBranch = 'development' |
| 6 | + def minimums = [] |
| 7 | + def isPR = false |
| 8 | + timestamps() { |
| 9 | + stage('Checkout') { |
| 10 | + checkout scm |
| 11 | + isPR = env.BRANCH_NAME.startsWith('PR-') |
| 12 | + if (!isPR) { |
| 13 | + targetBranch = env.BRANCH_NAME |
| 14 | + } else { |
| 15 | + targetBranch = env.CHANGE_TARGET |
| 16 | + } |
| 17 | + } |
| 18 | + |
| 19 | + // Copy over dependencies |
| 20 | + stage('Dependencies') { |
| 21 | + step([$class: 'CopyArtifact', |
| 22 | + filter: 'dist/', |
| 23 | + fingerprintArtifacts: true, |
| 24 | + projectName: "Studio/studio3/${targetBranch}", |
| 25 | + target: 'studio3-core']) |
| 26 | + } |
| 27 | + |
| 28 | + stage('Build') { |
| 29 | + env.PATH = "${tool name: 'Ant 1.9.2', type: 'ant'}/bin:${env.PATH}" |
| 30 | + writeFile file: 'override.properties', text: """scs.branch.name=${targetBranch} |
| 31 | +workspace=${env.WORKSPACE} |
| 32 | +deploy.dir=${env.WORKSPACE}/dist |
| 33 | +buildDirectory=${env.WORKSPACE} |
| 34 | +vanilla.eclipse=${env.ECLIPSE_4_4_HOME} |
| 35 | +launcher.plugin=${env.ECLIPSE_4_4_LAUNCHER} |
| 36 | +builder.plugin=${env.ECLIPSE_4_4_BUILDER} |
| 37 | +configs=win32, win32, x86 & win32, win32, x86_64 & linux, gtk, x86 & linux, gtk, x86_64 & macosx, cocoa, x86 & macosx, cocoa, x86_64 |
| 38 | +studio3.p2.repo=file://${env.WORKSPACE}/studio3-core/dist/ |
| 39 | +""" |
| 40 | + timeout(10) { |
| 41 | + sh 'ant -propertyfile override.properties -f builders/com.aptana.pydev.build/build.xml build' |
| 42 | + } |
| 43 | + |
| 44 | + dir('dist') { |
| 45 | + def zipName = sh(returnStdout: true, script: 'ls *.zip').trim() |
| 46 | + def version = (zipName =~ /^.*?\-(.+)\.zip/)[0][1] |
| 47 | + currentBuild.displayName = "#${version}-${currentBuild.number}" |
| 48 | + } |
| 49 | + archiveArtifacts artifacts: 'dist/**/*', excludes: 'dist/*.zip' |
| 50 | + } // end Build stage |
| 51 | + |
| 52 | + // If not a PR, trigger downstream builds for same branch |
| 53 | + if (!env.BRANCH_NAME.startsWith('PR-')) { |
| 54 | + build job: "studio3-feature-${env.BRANCH_NAME}", wait: false |
| 55 | + } |
| 56 | + } // end timestamps |
| 57 | + } catch (e) { |
| 58 | + // if any exception occurs, mark the build as failed |
| 59 | + currentBuild.result = 'FAILURE' |
| 60 | + office365ConnectorSend(message: 'Build failed', status: currentBuild.result, webhookUrl: 'https://outlook.office.com/webhook/ba1960f7-fcca-4b2c-a5f3-095ff9c87b22@300f59df-78e6-436f-9b27-b64973e34f7d/JenkinsCI/5dcba6d96f54460d9264e690b26b663e/72931ee3-e99d-4daf-84d2-1427168af2d9') |
| 61 | + throw e |
| 62 | + } finally { |
| 63 | + step([$class: 'WsCleanup', notFailBuild: true]) |
| 64 | + } |
| 65 | +} // end node |
0 commit comments