Skip to content

Commit

Permalink
Merge pull request #1 from lgrill-pentaho/master
Browse files Browse the repository at this point in the history
[BACKLOG-22219] Squashed fixes and improvments
  • Loading branch information
lgrill-pentaho committed Mar 26, 2018
2 parents 706f678 + 6e8488b commit 11ea5cc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 17 deletions.
68 changes: 54 additions & 14 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@Library ('jenkins-shared-libraries') _

import org.hvbuilders.MappedBuildData

MappedBuildData mbd = new MappedBuildData()
// We need a global mapped build data object to pass down through the stages of the build
def mappedBuildData


pipeline {
Expand All @@ -24,6 +23,8 @@ pipeline {
string(defaultValue: '10', description: 'Maximum parallel source checkout chunk size',
name: 'PARALLEL_CHECKOUT_CHUNKSIZE')
string(defaultValue: '20', description: 'Shallow clone depth (leave blank for infinite)', name: 'CHECKOUT_DEPTH')
string(defaultValue: '60', description: 'Build timeout in minutes', name: 'BUILD_TIMEOUT')
string(defaultValue: '2', description: 'Build retry count', name: 'BUILD_RETRIES')
string(defaultValue: 'http://nexus.pentaho.org/content/groups/omni',
description: 'Maven resolve repo global mirror', name: 'MAVEN_RESOLVE_REPO_URL')
string(defaultValue: 'github-buildguy', description: 'Use this Jenkins credential for checkouts',
Expand All @@ -33,12 +34,15 @@ pipeline {
string(defaultValue: 'maven3-auto', description: 'Use this Jenkins Maven label for builds',
name: 'JENKINS_MAVEN_FOR_BUILDS')

booleanParam(defaultValue: false, description: 'Clean all build dependency caches', name: 'CLEAN_ALL_CACHES')
booleanParam(defaultValue: false, description: 'Clean build scm workspaces', name: 'CLEAN_SCM_WORKSPACES')
booleanParam(defaultValue: true, description: 'Run the scm checkouts', name: 'RUN_CHECKOUTS')
booleanParam(defaultValue: true, description: 'Run the code builds', name: 'RUN_BUILDS')
booleanParam(defaultValue: true, description: 'Run the code tests', name: 'RUN_UNIT_TESTS')
booleanParam(defaultValue: true, description: 'Archive the artifacts', name: 'ARCHIVE_ARTIFACTS')

booleanParam(defaultValue: false, description: 'Clean all build dependency caches', name: 'CLEAN_ALL_CACHES')
booleanParam(defaultValue: false, description: 'Clean build scm workspaces', name: 'CLEAN_SCM_WORKSPACES')
booleanParam(defaultValue: false, description: 'Clean build buuild workspace (this happens post build)', name: 'CLEAN_BUILD_WORKSPACE')

booleanParam(defaultValue: false, description: 'No op build (test the build config)', name: 'NOOP')
booleanParam(defaultValue: false, description: 'Distributes source checkouts on remote nodes ' +
'(Otherwise assume workspace is shared on all). Not yet fully implmented--do not use.', name: 'USE_DISTRIBUTED_SOURCE_CACHING')
Expand Down Expand Up @@ -95,20 +99,19 @@ pipeline {
stage('Configure'){
steps {
script{
String dataFilePath = "${WORKSPACE}/resources/builders/${params.BUILD_DATA_FILE}"
println "doBuild: Loading build data from ${dataFilePath}"
mbd.createMappedData( dataFilePath )
mappedBuildData = doConfig("${WORKSPACE}/resources/builders/${params.BUILD_DATA_FILE}")
}
}
}

stage('Checkouts'){
when {
expression {
return params.RUN_CHECKOUTS
}
}
steps {
doCheckouts(mbd)
doCheckouts(mappedBuildData)
}
}

Expand All @@ -118,8 +121,13 @@ pipeline {
return params.RUN_BUILDS
}
}
failFast true
steps {
doBuilds(mbd)
timeout(time: Integer.valueOf(params.BUILD_TIMEOUT), unit: 'MINUTES') {
retry(Integer.valueOf(params.BUILD_RETRIES)) {
doBuilds(mappedBuildData)
}
}
}
}

Expand All @@ -129,32 +137,64 @@ pipeline {
return params.RUN_UNIT_TESTS
}
}
failFast true
steps {
doUnitTests(mbd)
timeout(time: 90, unit: 'MINUTES') {
doUnitTests(mappedBuildData)
}
}
}

stage('Archive Test Results') {
when {
expression {
return params.RUN_UNIT_TESTS
return (params.RUN_UNIT_TESTS && !params.NOOP)
}
}
steps {
junit allowEmptyResults: true, testResults: '**/target/**/TEST*.xml'
}
}

stage('Archive Build Artifacts') {
stage('Archive Artifacts') {
when {
expression {
return params.ARCHIVE_ARTIFACTS
return (params.ARCHIVE_ARTIFACTS && !params.NOOP)
}
}
steps {
archiveArtifacts artifacts: '**/target/**/*.gz, **/target/**/*.tar.gz, **/target/**/*.zip', fingerprint: false
}
}

stage('Clean Workspace') {
when {
expression {
return params.CLEAN_BUILD_WORKSPACE
}
}
steps {
deleteDir() /* clean up our workspace */
}
}
}

// @TODO Put some notification stuff in here..chatops or whatever
post {
always {
echo 'One way or another, I have finished'
}
success {
echo 'I succeeeded!'
}
unstable {
echo 'I am unstable :/'
}
failure {
echo 'I failed :('
}
changed {
echo 'Things were different before...'
}
}
}
6 changes: 3 additions & 3 deletions resources/builders/thinBuildControlDataTest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ jobGroups:
scmUrl : ${PENTAHO_SCM_ROOT}pentaho-data-refinery.git
scmBranch : ${DEFAULT_BRANCH}

- jobID : pdi-plugins
scmUrl : ${PENTAHO_SCM_ROOT}pentaho-ee.git
4:
- jobID : parent-poms-ee
scmUrl : ${PENTAHO_SCM_ROOT}maven-parent-poms-ee.git
scmBranch : ${DEFAULT_BRANCH}
root : data-integration/plugins


0 comments on commit 11ea5cc

Please sign in to comment.