Example #1
0
 def _include_job(self, job: Job) -> bool:
     """Return whether this job should be included."""
     if not job.get("latestCompletedBuild", {}).get("result"):
         return False  # The job has no completed builds
     jobs_to_include = self._parameter("jobs_to_include")
     if len(jobs_to_include) > 0 and not match_string_or_regular_expression(job["name"], jobs_to_include):
         return False
     return not match_string_or_regular_expression(self.__job_name(job), self._parameter("jobs_to_ignore"))
Example #2
0
 def _build_datetime(self, job: Job) -> datetime:
     """Return the date and time of the most recent build of the job."""
     builds = [
         build for build in job.get("builds", [])
         if self._include_build(build)
     ]
     return datetime.utcfromtimestamp(int(builds[0]["timestamp"]) /
                                      1000.0) if builds else datetime.min
Example #3
0
 def _build_status(self, job: Job) -> str:
     """Return the status of the most recent build of the job."""
     builds = [
         build for build in job.get("builds", [])
         if self._include_build(build)
     ]
     for build in builds:
         if status := build.get("result"):
             return str(status).capitalize().replace("_", " ")
Example #4
0
 def _build_status(job: Job) -> str:
     """Return the build status of the job."""
     for build in job.get("builds", []):
         if status := build.get("result"):
             return str(status).capitalize().replace("_", " ")
Example #5
0
 def _build_datetime(job: Job) -> datetime:
     """Return the date and time of the most recent build of the job."""
     builds = job.get("builds")
     return datetime.utcfromtimestamp(int(builds[0]["timestamp"]) / 1000.) if builds else datetime.min
 def _ignore_job(self, job: Job) -> bool:
     """Return whether this job should be ignored"""
     if not job.get("latestCompletedBuild", {}).get("result"):
         return True  # The job has no completed builds
     return match_string_or_regular_expression(self.__job_name(job), self._parameter("jobs_to_ignore"))