From 174896c9863ba34414b7cd31da7f2a5563a2d50d Mon Sep 17 00:00:00 2001 From: psycho Date: Tue, 9 Feb 2021 10:39:25 +0100 Subject: [PATCH] added parameter to choose device config file in Jenkinsfile --- Jenkinsfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b554caa..d2ebf73 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,6 +24,7 @@ core_count_str = '$((`nproc` + 1))' statusCode = 0 mail_body = "

${JOB_NAME} - Build # ${BUILD_NUMBER} - ${currentBuild.currentResult}:

" mail_subject = "${JOB_NAME} - Build # ${BUILD_NUMBER} - ${currentBuild.currentResult}!" +device_conf = '' if(params.DEBUG) { @@ -73,6 +74,10 @@ if(params.BUILD_NODE) { build_node = params.BUILD_NODE } +if(params.DEViCE_CONF) +{ + device_conf = params.DEVICE_CONF +} def printDebug(msg) { @@ -149,6 +154,13 @@ def pre_build() { stage('pre-build') { + script = 'test -f ' + config_path + '/' + device_conf + ' && echo true' + printDebug(script) + stdout = sh label: 'check for config file', script: script, returnStdout: true + if(!stdout.trim().equalsIgnoreCase('true')) + { + throw new Exception('Error: ' + device_conf + ' not found') + } script = 'cd ' + git_folder + '; patch -p1 < ../' + patch printDebug(script) statusCode = sh label: 'patch_sources', script: script, returnStatus:true @@ -177,7 +189,7 @@ def build() { stage('build') { - script = 'cp ' + config_path + 'tl_wr841_config ' + git_folder + '/.config' + script = 'cp ' + config_path + '/' + device_conf + ' ' + git_folder + '/.config' printDebug(script) sh label: 'copy_config', script: script if(statusCode != 0) @@ -230,6 +242,11 @@ def post_build() job.save() } } + +def file_present(String[] file) +{ + +} def send_mail() {