increased verbosity

increased verbosity of jenkinsfile
worked on help message of sftp_test script
This commit is contained in:
psycho 2021-02-01 23:35:24 +01:00
parent 14ebd18f27
commit 22cd2e1844
2 changed files with 37 additions and 13 deletions

40
Jenkinsfile vendored
View File

@ -120,17 +120,23 @@ def checkout()
{ {
cleanWs() 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) if(statusCode != 0)
{ {
throw new Exception("Error checking out configs") 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) if(statusCode != 0)
{ {
throw new Exception("Error checking out OWRT") 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')) if(ret.trim().equalsIgnoreCase('True'))
{ {
isBuildNeeded = true isBuildNeeded = true
@ -142,17 +148,23 @@ def pre_build()
{ {
stage('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) if(statusCode != 0)
{ {
throw new Exception("Error patching sources") 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) if(statusCode != 0)
{ {
throw new Exception("Error updating feeds") 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) if(statusCode != 0)
{ {
throw new Exception("Error installing feeds") throw new Exception("Error installing feeds")
@ -164,17 +176,23 @@ def build()
{ {
stage('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) if(statusCode != 0)
{ {
throw new Exception("Error copying config") 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) if(statusCode != 0)
{ {
add2mail('multicore failed') add2mail('multicore failed')
printDebug('multicore build failed -> trying to build verbosely on a single core') 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) if(statusCode != 0)
{ {
throw new Exception("Error building images") throw new Exception("Error building images")
@ -184,7 +202,9 @@ def build()
stage('move_bin_to_ftp') 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) if(statusCode != 0)
{ {
throw new Exception("Error copying binaries") throw new Exception("Error copying binaries")

View File

@ -28,10 +28,14 @@ class DatafileFormatError(Exception):
##prints message how to use this script ##prints message how to use this script
def usage(): def usage():
print('check if new build is necessary') print('check if new build is necessary')
print('usage: ' + os.path.basename(sys.argv[0]) + ' -a <host> -u <user> -p <passwd> -f <host_file> -g <git_link> -k <known_hosts> [-d] [-v]\n') print('usage: ' + os.path.basename(sys.argv[0]) + ' -a <host> -u <user> -p <passwd> -f <host_file> -g <git_link> -l <sftp_path>[-d] [-v]\n')
print('arguments:') print('arguments:')
print('\t-f --file=\t\t.xls/.xlsx/.xlsm file to update UIDs') print('\t-a --host=\t\thost to connect')
print('\t-p --path=\t\tpath to protocol files') 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('optional:')
print('\t-d --debug\t\t') print('\t-d --debug\t\t')
print('\t-v --version\t\tprints version of script') print('\t-v --version\t\tprints version of script')