testing_20

20
This commit is contained in:
psycho 2020-08-13 22:00:46 +02:00
parent d3122336b7
commit a883f52242
2 changed files with 15 additions and 8 deletions

16
Jenkinsfile vendored
View File

@ -13,7 +13,7 @@ def patch = patch_path + '16M.patch'
def sftp_host = '' def sftp_host = ''
def sftp_user = '' def sftp_user = ''
def sftp_passwd = '' def sftp_passwd = ''
def ftp_path = '/jenkins/owrt/' def sftp_path = '/jenkins/owrt/'
if(params.DEBUG) if(params.DEBUG)
@ -26,19 +26,23 @@ if(params.GIT)
} }
if(params.SFTP_HOST) if(params.SFTP_HOST)
{ {
sftp_host = params.SFT_HOST sftp_host = params.SFTP_HOST
} }
if(params.SFTP_USER) if(params.SFTP_USER)
{ {
sftp_user = params.SFT_USER sftp_user = params.SFTP_USER
} }
if(params.SFTP_PASSWD) if(params.SFTP_PASSWD)
{ {
sftp_passwd = params.SFT_PASSWD sftp_passwd = params.SFTP_PASSWD
} }
if(params.SFTP_PATH) if(params.SFTP_PATH)
{ {
sftp_path = params.SFT_PATH sftp_path = params.SFTP_PATH
}
if(params.KNOWN_HOSTS)
{
known_hosts = params.KNOWN_HOSTS
} }
def printDebug(msg) def printDebug(msg)
@ -57,7 +61,7 @@ node('test')
cleanWs() cleanWs()
sh label: 'checkout_configs', script: 'git clone ' + script_git + ' ' + script_folder sh label: 'checkout_configs', script: 'git clone ' + script_git + ' ' + script_folder
sh label: 'checkout_openwrt', script: 'git clone ' + git_link + ' ' + git_folder sh label: 'checkout_openwrt', script: 'git clone ' + git_link + ' ' + git_folder
def ret = sh label: 'is_build_needed', script: 'python ' + scripts_path + ' -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + sftp_passwd + ' -g ' + git_folder + ' -f ' + ftp_path, returnStdout: true def ret = sh label: 'is_build_needed', script: 'python ' + scripts_path + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + sftp_passwd + ' -g ' + git_folder + ' -f ' + known_hosts + ' -l ' + sftp_path, returnStdout: true
printDebug(ret) printDebug(ret)
} }
return return

View File

@ -65,7 +65,7 @@ def print_version():
def parse_args(): def parse_args():
#try parsing arguments according to defined format #try parsing arguments according to defined format
try: try:
opts, args = getopt.getopt(sys.argv[1:], 'a:u:p:f:g:dvh', ['host=', 'user=', 'passwd=', 'host_file=', 'git_path=', 'debug', 'version', 'help']) opts, args = getopt.getopt(sys.argv[1:], 'a:u:p:f:g:l:dvh', ['host=', 'user=', 'passwd=', 'host_file=', 'git_path=', 'sftp_path', 'debug', 'version', 'help'])
except getopt.GetoptError: except getopt.GetoptError:
err('',2) #parsing failed err('',2) #parsing failed
@ -73,6 +73,7 @@ def parse_args():
sftp_host = '' sftp_host = ''
sftp_user = '' sftp_user = ''
sftp_passwd = '' sftp_passwd = ''
sftp_path = ''
known_hosts = '' known_hosts = ''
git_path = '' git_path = ''
@ -101,6 +102,8 @@ def parse_args():
if not os.path.isdir(arg): if not os.path.isdir(arg):
err(arg, 5) err(arg, 5)
git_path = arg git_path = arg
elif opt in ('-l', '--sftp_path'):
git_path = arg
elif opt in ('-d', '--debug'): elif opt in ('-d', '--debug'):
debug = True debug = True
else: else:
@ -161,7 +164,7 @@ def build_needed(current, last_build_version):
def main(): def main():
params = parse_args() params = parse_args()
last = get_last_build(params['sftp_host'], params['sftp_user'], params['sftp_passwd'], known_hosts=params['known_hosts']) last = get_last_build(params['sftp_host'], params['sftp_user'], params['sftp_passwd'], known_hosts=params['known_hosts'], bin_path=params['sftp_path'])
os.chdir(params['git_path']) os.chdir(params['git_path'])
out = subprocess.check_output(['git', 'describe']).decode(sys.stdout.encoding).strip() out = subprocess.check_output(['git', 'describe']).decode(sys.stdout.encoding).strip()