diff options
Diffstat (limited to 'resources/tools/presentation/specification_parser.py')
-rw-r--r-- | resources/tools/presentation/specification_parser.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/resources/tools/presentation/specification_parser.py b/resources/tools/presentation/specification_parser.py index 61ef42ef8d..548bbff532 100644 --- a/resources/tools/presentation/specification_parser.py +++ b/resources/tools/presentation/specification_parser.py @@ -528,14 +528,15 @@ class Specification: continue if isinstance(builds, dict): build_end = builds.get(u"end", None) + max_builds = builds.get(u"max-builds", None) try: build_end = int(build_end) except ValueError: # defined as a range <start, build_type> build_end = self._get_build_number(job, build_end) - builds = [x for x in range(builds[u"start"], - build_end + 1) - if x not in builds.get(u"skip", list())] + builds = [x for x in range(builds[u"start"], build_end + 1)] + if max_builds and max_builds < len(builds): + builds = builds[:max_builds] self.configuration[u"data-sets"][set_name][job] = builds elif isinstance(builds, list): for idx, item in enumerate(builds): @@ -590,14 +591,23 @@ class Specification: if builds: if isinstance(builds, dict): build_end = builds.get(u"end", None) + max_builds = builds.get(u"max-builds", None) + reverse = bool(builds.get(u"reverse", False)) try: build_end = int(build_end) except ValueError: # defined as a range <start, build_type> + if build_end in (u"lastCompletedBuild", + u"lastSuccessfulBuild"): + reverse = True build_end = self._get_build_number(job, build_end) builds = [x for x in range(builds[u"start"], build_end + 1) if x not in builds.get(u"skip", list())] + if reverse: + builds.reverse() + if max_builds and max_builds < len(builds): + builds = builds[:max_builds] self._specification[u"input"][u"builds"][job] = list() for build in builds: self._specification[u"input"][u"builds"][job]. \ @@ -608,6 +618,7 @@ class Specification: f"No build is defined for the job {job}. Trying to " f"continue without it." ) + except KeyError: raise PresentationError(u"No data to process.") |