mirror of
https://pagure.io/fedora-qa/createhdds.git
synced 2024-11-25 08:13:07 +00:00
Polishing of the download_all() method
The patch jskladan applied was an older broken one I sent accidentally; apologies. This is more or less my intended version, with some of the cleanups from jskladan preserved and a couple of his suggestions added (!= instead of not ==, and a bit of just-in-case exception handling).
This commit is contained in:
parent
49c3e75edf
commit
8c7a99fae8
@ -169,32 +169,49 @@ def run_compose(args, wiki=None):
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def run_all(args, wiki=None):
|
def run_all(args, wiki=None):
|
||||||
"""Do everything we can: test both Rawhide and Branched nightlies
|
"""Do everything we can: test current validation event compose if
|
||||||
if they exist, and test current compose if it's different from
|
it's new, amd test both Rawhide and Branched nightlies if they
|
||||||
either and it's new.
|
exist and aren't the same as the 'current' compose.
|
||||||
"""
|
"""
|
||||||
skip = None
|
skip = ''
|
||||||
|
|
||||||
|
# Run for 'current' validation event.
|
||||||
(jobs, currev) = jobs_from_current(wiki)
|
(jobs, currev) = jobs_from_current(wiki)
|
||||||
print("Jobs from current validation event: {0}".format(jobs))
|
print("Jobs from current validation event: {0}".format(jobs))
|
||||||
|
|
||||||
yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1)
|
utcdate = datetime.datetime.utcnow()
|
||||||
if currev and currev.compose == yesterday.strftime('%Y%m%d'):
|
if args.yesterday:
|
||||||
|
utcdate = utcdate - datetime.timedelta(days=1)
|
||||||
|
if currev and currev.compose == utcdate.strftime('%Y%m%d'):
|
||||||
|
# Don't schedule tests for the same compose as both "today's
|
||||||
|
# nightly" and "current validation event"
|
||||||
skip = currev.milestone
|
skip = currev.milestone
|
||||||
|
|
||||||
if not skip.lower() == 'rawhide':
|
# Run for day's Rawhide nightly (if not same as current event.)
|
||||||
|
if skip.lower() != 'rawhide':
|
||||||
|
try:
|
||||||
rawhide_ffrel = fedfind.release.get_release(
|
rawhide_ffrel = fedfind.release.get_release(
|
||||||
release='Rawhide', compose=yesterday)
|
release='Rawhide', compose=utcdate)
|
||||||
rawjobs = jobs_from_fedfind(rawhide_ffrel)
|
rawjobs = jobs_from_fedfind(rawhide_ffrel)
|
||||||
print("Jobs from {0}: {1}".format(rawhide_ffrel.version, rawjobs))
|
print("Jobs from {0}: {1}".format(rawhide_ffrel.version, rawjobs))
|
||||||
jobs.extend(rawjobs)
|
jobs.extend(rawjobs)
|
||||||
|
except ValueError as err:
|
||||||
|
print("Rawhide image discovery failed: {0}".format(err))
|
||||||
|
|
||||||
if not skip.lower() == 'branched':
|
# Run for day's Branched nightly (if not same as current event.)
|
||||||
|
# We must guess a release for Branched, fedfind cannot do so. Best
|
||||||
|
# guess we can make is the same as the 'current' validation event
|
||||||
|
# compose (this is why we have jobs_from_current return currev).
|
||||||
|
if skip.lower() != 'branched':
|
||||||
|
try:
|
||||||
branched_ffrel = fedfind.release.get_release(
|
branched_ffrel = fedfind.release.get_release(
|
||||||
release=currev.release, compose=yesterday)
|
release=currev.release, milestone='Branched', compose=utcdate)
|
||||||
branchjobs = jobs_from_fedfind(branched_ffrel)
|
branchjobs = jobs_from_fedfind(branched_ffrel)
|
||||||
print("Jobs from {0}: {1}".format(branched_ffrel.version, branchjobs))
|
print("Jobs from {0}: {1}".format(branched_ffrel.version,
|
||||||
|
branchjobs))
|
||||||
jobs.extend(branchjobs)
|
jobs.extend(branchjobs)
|
||||||
|
except ValueError as err:
|
||||||
|
print("Branched image discovery failed: {0}".format(err))
|
||||||
if jobs:
|
if jobs:
|
||||||
report_results(jobs)
|
report_results(jobs)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
@ -241,7 +258,11 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
parser_all = subparsers.add_parser(
|
parser_all = subparsers.add_parser(
|
||||||
'all', description="Run for the current validation event (if needed) "
|
'all', description="Run for the current validation event (if needed) "
|
||||||
"and today's Rawhide and Branched nightly's (if found).")
|
"and today's Rawhide and Branched nightly's (if found). 'Today' is "
|
||||||
|
"calculated for the UTC time zone, no matter the system timezone.")
|
||||||
|
parser_all.add_argument(
|
||||||
|
'-y', '--yesterday', help="Run on yesterday's nightlies, not today's",
|
||||||
|
required=False, action='store_true')
|
||||||
parser_all.add_argument(
|
parser_all.add_argument(
|
||||||
'-t', '--test', help=test_help, required=False, action='store_true')
|
'-t', '--test', help=test_help, required=False, action='store_true')
|
||||||
parser_all.set_defaults(func=run_all)
|
parser_all.set_defaults(func=run_all)
|
||||||
|
Loading…
Reference in New Issue
Block a user