diff --git a/Jenkinsfile b/Jenkinsfile index 2f456ad..cf071e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,8 +15,10 @@ sftp_user = '' sftp_path = '/jenkins/owrt/' isBuildNeeded = false deleteUnbuild = true +force_build = false pre_clean = true post_clean = false +build_node = 'linux' bin_path = 'bin' core_count_str = '$((`nproc` + 1))' statusCode = 0 @@ -63,6 +65,14 @@ if(params.BIN_PATH) { bin_path = params.BIN_PATH } +if(params.FORCE_BUILD) +{ + force_build = params.FORCE_BUILD +} +if(params.BUILD_NODE) +{ + build_node = params.BUILD_NODE +} def printDebug(msg) { @@ -78,12 +88,12 @@ printDebug(currentBuild.id.toString()) printDebug(JOB_NAME) -node('test') +node(build_node) { try { checkout() - if(isBuildNeeded) + if(isBuildNeeded || force_build) { pre_build() build() @@ -93,7 +103,6 @@ node('test') { printDebug(e.getMessage()) add2mail(e.getMessage()) - handle_failure() } finally { @@ -189,8 +198,10 @@ def post_build() { cleanWs() } + + send_mail() - if((!isBuildNeeded && deleteUnbuild)) + if((!isBuildNeeded && !force_build && deleteUnbuild)) { //if no build is needed, then the last build is deleted and the next build number is set to previous build number def job = Jenkins.instance.getItem(JOB_NAME) @@ -199,7 +210,7 @@ def post_build() } } -def handle_failure() +def send_mail() { //def body_text = "${JOB_NAME} - Build # ${BUILD_NUMBER} - ${currentBuild.currentResult}:
Check console output at ${BUILD_URL} to view the results." add2mail("Check console output at ${BUILD_URL} to view the results.")