def __init__(self, stream, project, event): self.id = utils.get_rnd_name("EVNT", length=10) self.stream = stream self.root = stream.root self.log = stream.root.log self.event = event self.project = project self.jobs = {} self.jobs_list = [] self.finished_at = 0 self.cfg = self.root.config.data["project"][self.project] env = self._get_env() if event["type"] == "ref-updated": for job_name in self.cfg.get("on-ref-updated", []): job = Job(self, job_name) job.env.update(env) self.jobs_list.append(job) return for job_name in self.cfg.get("jobs", []): job = Job(self, job_name) job.env.update(env) self.jobs_list.append(job) for job_name in self.cfg.get("non-voting-jobs", []): job = Job(self, job_name) job.env.update(env) job.voting = False self.jobs_list.append(job)
def _prepare_job(self, job_name, voting=True): cfg = self.config.data["jobs"][job_name] LOG.debug("Preparing job %s (id %s)" % (job_name, self.id)) job = Job(self, job_name, cfg, self.event) job.voting = voting LOG.debug("Prepared job %r" % job) self.jobs.append(job)
def __init__(self, stream, raw_event): self.id = utils.get_rnd_name(prefix="", length=10) self.stream = stream self.root = stream.root self.raw_event = raw_event self.project_name = self.get_project_name(raw_event) self.jobs = {} self.jobs_list = [] self.cfg = self.root.config.data["project"][self.project_name] for job_name in self.cfg.get("jobs", []): self.jobs_list.append(Job(self, job_name)) for job_name in self.cfg.get("non-voting-jobs", []): job = Job(self, job_name) job.voting = False self.jobs_list.append(job)