testing_24
24
This commit is contained in:
parent
a614997ad9
commit
5edec87c27
89
Jenkinsfile
vendored
89
Jenkinsfile
vendored
@ -14,6 +14,10 @@ def sftp_host = ''
|
||||
def sftp_user = ''
|
||||
def sftp_passwd = ''
|
||||
def sftp_path = '/jenkins/owrt/'
|
||||
def isBuildNeeded = false
|
||||
def deleteUnbuild = true
|
||||
def pre_clean = true
|
||||
def post_clean = false
|
||||
|
||||
|
||||
if(params.DEBUG)
|
||||
@ -44,6 +48,18 @@ if(params.KNOWN_HOSTS)
|
||||
{
|
||||
known_hosts = params.KNOWN_HOSTS
|
||||
}
|
||||
if(params.DeleteUnbuild)
|
||||
{
|
||||
deleteUnbuild = params.DeleteUnbuild
|
||||
}
|
||||
if(params.PRE_CLEAN)
|
||||
{
|
||||
pre_clean = params.PRE_CLEAN
|
||||
}
|
||||
if(params.POST_CLEAN)
|
||||
{
|
||||
post_clean = params.POST_CLEAN
|
||||
}
|
||||
|
||||
def printDebug(msg)
|
||||
{
|
||||
@ -55,44 +71,63 @@ def printDebug(msg)
|
||||
node('test')
|
||||
{
|
||||
|
||||
stageName = 'checkout'
|
||||
stage(stageName)
|
||||
stage('checkout')
|
||||
{
|
||||
cleanWs()
|
||||
if(pre_clean)
|
||||
{
|
||||
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 + 'sftp_test.py -a ' + sftp_host + ' -u ' + sftp_user + ' -p ' + sftp_passwd + ' -g ' + git_folder + ' -f ' + scripts_path + known_hosts + ' -l ' + sftp_path, returnStdout: true
|
||||
printDebug(ret)
|
||||
if(ret.trim().equalsIgnoreCase('True')
|
||||
isBuildNeeded = true
|
||||
}
|
||||
return
|
||||
|
||||
stageName = 'pre-build'
|
||||
stage(stageName)
|
||||
if(isBuildNeeded)
|
||||
{
|
||||
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'
|
||||
stage('pre-build')
|
||||
{
|
||||
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'
|
||||
//}
|
||||
}
|
||||
|
||||
stage('build')
|
||||
{
|
||||
//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)
|
||||
if(post_clean)
|
||||
{
|
||||
//cleanWs()
|
||||
stage('clean')
|
||||
{
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
|
||||
if((!isBuildNeeded && deleteUnbuild))
|
||||
{
|
||||
//if no build is needed, then the last build is deleted and the next build number is set to previous build number
|
||||
|
||||
def jobName = JOB_NAME
|
||||
def job = Jenkins.instance.getItem(jobName)
|
||||
logger.printInfo('job is getting deleted ' + currentBuild.id.toString())//job.nextBuildNumber)
|
||||
job.getLastBuild().delete()
|
||||
//job.nextBuildNumber -= 1 //updateNextBuildNumber(job.getNextBuildNumber() - 1) //resetting next build number does not work. if done, the next build start will do nothing
|
||||
job.save()
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user