Esempio n. 1
0
    def view_metrics(self):
        """Composes a report on the jobs contained within the view

        :return: Dictionary containing metrics about the view
        :rtype: :class:`dict`
        """
        data = self._api.get_api_data()

        broken_jobs = []
        disabled_jobs = []
        unstable_jobs = []
        broken_job_count = 0
        disabled_jobs_count = 0
        unstable_job_count = 0

        for job in data["jobs"]:

            temp_job = Job.instantiate(job, self._api)

            if temp_job.is_failing:
                broken_job_count += 1
                broken_jobs.append(temp_job)
            elif temp_job.is_disabled:
                disabled_jobs_count += 1
                disabled_jobs.append(temp_job)
            elif temp_job.is_unstable:
                unstable_job_count += 1
                unstable_jobs.append(temp_job)

        return {"broken_jobs_count": broken_job_count,
                "disabled_jobs_count": disabled_jobs_count,
                "unstable_jobs_count": unstable_job_count,
                "broken_jobs": broken_jobs,
                "unstable_jobs": unstable_jobs,
                "disabled_jobs": disabled_jobs}
    def jobs(self):
        """Gets all branch jobs managed by this multibranch pipeline

        :rtype: :class:`list` of :class:`~.pipelinejob.PipelineJob`
        """
        data = self._api.get_api_data(query_params="depth=0")

        retval = list()
        for j in data["jobs"]:
            retval.append(Job.instantiate(j, self._api))

        return retval
Esempio n. 3
0
    def jobs(self):
        """Gets all jobs managed by this Jenkins instance

        :rtype:  :class:`list` of :class:`~.job.Job` objects
        """
        data = self._api.get_api_data(query_params="depth=2")

        retval = list()
        for j in data['jobs']:
            retval.append(Job.instantiate(j, self._api))

        return retval
Esempio n. 4
0
    def jobs(self):
        """Gets a list of all jobs contained in this folder

        :rtype: :class:`list` of :class:`~.job.Job`
        """
        data = self._api.get_api_data()

        retval = list()
        for tjob in data['jobs']:
            retval.append(Job.instantiate(tjob, self._api))

        return retval
Esempio n. 5
0
    def jobs(self):
        """Gets all branch jobs managed by this multibranch pipeline

        :rtype: :class:`list` of :class:`~.pipelinejob.PipelineJob`
        """
        data = self._api.get_api_data(query_params="depth=0")

        retval = list()
        for j in data["jobs"]:
            retval.append(Job.instantiate(j, self._api))

        return retval
Esempio n. 6
0
    def jobs(self):
        """Gets a list of all jobs contained in this folder

        :rtype: :class:`list` of :class:`~.job.Job`
        """
        data = self._api.get_api_data()

        retval = list()
        for tjob in data['jobs']:
            retval.append(Job.instantiate(tjob, self._api))

        return retval
Esempio n. 7
0
    def jobs(self):
        """Gets all jobs managed by this Jenkins instance

        :rtype:  :class:`list` of :class:`~.job.Job` objects
        """
        data = self._api.get_api_data(query_params="depth=0")

        retval = list()
        for j in data['jobs']:
            retval.append(Job.instantiate(j, self._api))

        return retval
Esempio n. 8
0
    def downstream_jobs(self):
        """Gets the list of jobs to be triggered after this job completes

        :returns: A list of 0 or more jobs which depend on this one
        :rtype:  :class:`list` of :class:`~.job.Job` objects
        """
        data = self._api.get_api_data()

        jobs = data['downstreamProjects']

        retval = list()

        for j in jobs:
            retval.append(Job.instantiate(j, self._api))

        return retval
Esempio n. 9
0
    def upstream_jobs(self):
        """Gets the list of upstream dependencies for this job

        :returns: A list of 0 or more jobs that this job depends on
        :rtype: :class:`list` of :class:`~.job.Job` objects
        """
        data = self._api.get_api_data()

        jobs = data['upstreamProjects']

        retval = list()

        for j in jobs:
            retval.append(Job.instantiate(j, self._api))

        return retval
Esempio n. 10
0
    def find_job(self, job_name):
        """Searches all jobs managed by this Jenkins instance for a specific job

        .. seealso: :py:meth:`.get_job`

        :param str job_name: the name of the job to search for
        :returns:
            If a job with the specified name can be found, and object to manage
            the job will be returned, otherwise None
        :rtype: :class:`~.job.Job`
        """
        data = self._api.get_api_data()

        for cur_job in data['jobs']:
            if cur_job['name'] == job_name:
                return Job.instantiate(cur_job, self._api)

        return None
Esempio n. 11
0
    def find_job(self, job_name):
        """Searches all jobs managed by this Jenkins instance for a specific job

        .. seealso: :py:meth:`.get_job`

        :param str job_name: the name of the job to search for
        :returns:
            If a job with the specified name can be found, and object to manage
            the job will be returned, otherwise None
        :rtype: :class:`~.job.Job`
        """
        data = self._api.get_api_data()

        for cur_job in data['jobs']:
            if cur_job['name'] == job_name:
                return Job.instantiate(cur_job, self._api)

        return None
Esempio n. 12
0
    def jobs(self):
        """Gets a list of jobs associated with this view

        Views are simply filters to help organize jobs on the
        Jenkins dashboard. This method returns the set of jobs
        that meet the requirements of the filter associated
        with this view.

        :returns: list of 0 or more jobs that are included in this view
        :rtype:  :class:`list` of :class:`~.job.Job` objects
        """
        data = self._api.get_api_data(query_params="depth=2")

        view_jobs = data['jobs']

        retval = []
        for j in view_jobs:
            retval.append(Job.instantiate(j, self._api))

        return retval