From 14ebd18f278776652b97c89a4105250cba97d82b Mon Sep 17 00:00:00 2001 From: psycho Date: Mon, 1 Feb 2021 23:18:31 +0100 Subject: [PATCH 1/2] delete unbuild fix --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cf071e3..dd56a68 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ sftp_host = '' sftp_user = '' sftp_path = '/jenkins/owrt/' isBuildNeeded = false -deleteUnbuild = true +deleteUnbuild = false force_build = false pre_clean = true post_clean = false @@ -49,9 +49,9 @@ if(params.KNOWN_HOSTS) { known_hosts = params.KNOWN_HOSTS } -if(params.DeleteUnbuild) +if(params.DEL_UNBUILD) { - deleteUnbuild = params.DeleteUnbuild + deleteUnbuild = params.DEL_UNBUILD } if(params.PRE_CLEAN) { From 22cd2e1844a73e4b2a42150264d6530d6f094cd3 Mon Sep 17 00:00:00 2001 From: psycho Date: Mon, 1 Feb 2021 23:35:24 +0100 Subject: [PATCH 2/2] increased verbosity increased verbosity of jenkinsfile worked on help message of sftp_test script --- Jenkinsfile | 40 ++++++++++++++++++++++++++++++---------- scripts/sftp_test.py | 10 +++++++--- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dd56a68..846174a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -120,17 +120,23 @@ def checkout() { cleanWs() } - statusCode = sh label: 'checkout_configs', script: 'git clone ' + script_git + ' ' + script_folder, returnStatus:true + script = 'git clone ' + script_git + ' ' + script_folder + printDebug(script) + statusCode = sh label: 'checkout_configs', script: script, returnStatus:true if(statusCode != 0) { throw new Exception("Error checking out configs") } - statusCode = sh label: 'checkout_openwrt', script: 'git clone ' + git_link + ' ' + git_folder, returnStatus:true + script = 'git clone ' + git_link + ' ' + git_folder + printDebug(script) + statusCode = sh label: 'checkout_openwrt', script: script, returnStatus:true if(statusCode != 0) { throw new Exception("Error checking out OWRT") } - def ret = sh label: 'is_build_needed', script: 'set +x; python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + '; set -x', returnStdout: true + script = 'set +x; python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + '; set -x' + printDebug(script) + def ret = sh label: 'is_build_needed', script: script, returnStdout: true if(ret.trim().equalsIgnoreCase('True')) { isBuildNeeded = true @@ -142,17 +148,23 @@ def pre_build() { stage('pre-build') { - statusCode = sh label: 'patch_sources', script: 'cd ' + git_folder + '; patch -p1 < ../' + patch, returnStatus:true + script = 'cd ' + git_folder + '; patch -p1 < ../' + patch + printDebug(script) + statusCode = sh label: 'patch_sources', script: script, returnStatus:true if(statusCode != 0) { throw new Exception("Error patching sources") } - statusCode = sh label: 'feeds_update', script: 'cd ' + git_folder + '; ./scripts/feeds update -a', returnStatus:true + script = 'cd ' + git_folder + '; ./scripts/feeds update -a' + printDebug(script) + statusCode = sh label: 'feeds_update', script: script, returnStatus:true if(statusCode != 0) { throw new Exception("Error updating feeds") } - statusCode = sh label: 'feeds_install', script: 'cd ' + git_folder + '; ./scripts/feeds install -a', returnStatus:true + script = 'cd ' + git_folder + '; ./scripts/feeds install -a' + printDebug(script) + statusCode = sh label: 'feeds_install', script: script, returnStatus:true if(statusCode != 0) { throw new Exception("Error installing feeds") @@ -164,17 +176,23 @@ def build() { stage('build') { - sh label: 'copy_config', script: 'cp ' + config_path + 'tl_wr841_config ' + git_folder + '/.config' + script = 'cp ' + config_path + 'tl_wr841_config ' + git_folder + '/.config' + printDebug(script) + sh label: 'copy_config', script: script if(statusCode != 0) { throw new Exception("Error copying config") } - statusCode = sh label: 'build', script: 'cd ' + git_folder + '; make defconfig; make download; make -j$((`nproc` + 1))', returnStatus:true + script = 'cd ' + git_folder + '; make defconfig; make download; make -j$((`nproc` + 1))' + printDebug(script) + statusCode = sh label: 'build', script: script, returnStatus:true if(statusCode != 0) { add2mail('multicore failed') printDebug('multicore build failed -> trying to build verbosely on a single core') - statusCode = sh label: 'build_single_core', script: 'cd ' + git_folder + '; make defconfig; make download; make -j1 V=s', returnStatus:true + script = 'cd ' + git_folder + '; make defconfig; make download; make -j1 V=s' + printDebug(script) + statusCode = sh label: 'build_single_core', script: script, returnStatus:true if(statusCode != 0) { throw new Exception("Error building images") @@ -184,7 +202,9 @@ def build() stage('move_bin_to_ftp') { - statusCode = sh label: 'copy_binaries', script: 'python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + ' -c ' + bin_path, returnStatus:true + script = 'python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + params.SFTP_PASSWD + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path + ' -c ' + bin_path + printDebug(script) + statusCode = sh label: 'copy_binaries', script: script, returnStatus:true if(statusCode != 0) { throw new Exception("Error copying binaries") diff --git a/scripts/sftp_test.py b/scripts/sftp_test.py index 7d32097..f90435e 100644 --- a/scripts/sftp_test.py +++ b/scripts/sftp_test.py @@ -28,10 +28,14 @@ class DatafileFormatError(Exception): ##prints message how to use this script def usage(): print('check if new build is necessary') - print('usage: ' + os.path.basename(sys.argv[0]) + ' -a -u -p -f -g -k [-d] [-v]\n') + print('usage: ' + os.path.basename(sys.argv[0]) + ' -a -u -p -f -g -l [-d] [-v]\n') print('arguments:') - print('\t-f --file=\t\t.xls/.xlsx/.xlsm file to update UIDs') - print('\t-p --path=\t\tpath to protocol files') + print('\t-a --host=\t\thost to connect') + print('\t-a --user=\t\tusername') + print('\t-p --passwd=\t\tpassword') + print('\t-f --host_file=\tknown host file') + print('\t-g --git_link=\tpath to git repo') + print('\t-l --sftp_path=\tpath to builds') print('optional:') print('\t-d --debug\t\t') print('\t-v --version\t\tprints version of script')