owrt_build_script/Jenkinsfile
psycho d3122336b7 testing_19
19
2020-08-13 21:54:14 +02:00

95 lines
2.1 KiB
Groovy

def debug = false
def stageName = ''
def git_link
def script_git = 'https://git.psychobox.org/psycho/owrt_build_script.git'
def git_folder = 'openwrt'
def script_folder = 'owrt_build_script'
def config_path = script_folder + '/configs/'
def patch_path = script_folder + '/patches/'
def scripts_path = script_folder + '/scripts/'
def patch = patch_path + '16M.patch'
def sftp_host = ''
def sftp_user = ''
def sftp_passwd = ''
def ftp_path = '/jenkins/owrt/'
if(params.DEBUG)
{
debug = true
}
if(params.GIT)
{
git_link = params.GIT
}
if(params.SFTP_HOST)
{
sftp_host = params.SFT_HOST
}
if(params.SFTP_USER)
{
sftp_user = params.SFT_USER
}
if(params.SFTP_PASSWD)
{
sftp_passwd = params.SFT_PASSWD
}
if(params.SFTP_PATH)
{
sftp_path = params.SFT_PATH
}
def printDebug(msg)
{
println 'DEBUG: ' + msg
}
node('test')
{
stageName = 'checkout'
stage(stageName)
{
cleanWs()
sh label: 'checkout_configs', script: 'git clone ' + script_git + ' ' + script_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
printDebug(ret)
}
return
stageName = 'pre-build'
stage(stageName)
{
sh label: 'patch_sources', script: 'cd ' + git_folder + '; patch -p1 < ../' + patch
sh label: 'feeds_update', script: 'cd ' + git_folder + '; ./scripts/feeds update -a'
sh label: 'feeds_install', script: 'cd ' + git_folder + '; ./scripts/feeds install -a'
}
stageName = 'build'
stage(stageName)
{
//step
//{
sh label: 'copy_config', script: 'cp ' + config_path + 'tl_wr841_v11_config ' + git_folder + '/.config'
sh label: 'build_v11', script: 'cd ' + git_folder + '; make oldconfig; make -j13 V=s'
//}
//step
//{
sh label: 'copy_config', script: 'cp ' + config_path + 'tl_wr841_v12_config ' + git_folder + '/.config'
sh label: 'build_v12', script: 'cd ' + git_folder + '; make oldconfig; make -j13 V=s'
//}
}
stageName = 'clean'
stage(stageName)
{
//cleanWs()
}
}