Пример #1
0
	def get_view_status(self, view_name):
		views = Views(self.jenkins)
		view = views.__getitem__(view_name)
		jobs = []
		for item in view._get_jobs():
			job = self.jenkins.get_job(item[0])
			project = {'project': item[0]}
			build = job.get_last_build_or_none()
			if ( build ):
				project.update({'last_build': build.get_number()})
				project.update({'status': build.get_status()})

				previousBuild = job.get_build(build.get_number() - 1)
				project.update({'previousBuildStatus': previousBuild.get_status()})

				if ( build.is_running() ):
					project.update({'status': 'BUILDING'})

					estimated = build._data['estimatedDuration']
					completed = (time.time() * 1000) - build._data['timestamp']
					completeRate = (completed * 100) / estimated
					if (completeRate > 99):
						completeRate = 99
					project.update({'completeRate': completeRate})

				# who broke the build
				if ( build.get_actions()["causes"][0].has_key("userId") ):
					project.update({'user': build.get_actions()["causes"][0]["userId"]})
			else:
				project.update({'last_build': None})
			jobs.append(project)

		return jobs
Пример #2
0
    def get_view_status(self, view_name):
        views = Views(self.jenkins)
        view = views.__getitem__(view_name)
        jobs = []
        for item in view._get_jobs():
            job = self.jenkins.get_job(item[0])
            project = {'project': item[0]}
            build = job.get_last_build_or_none()
            if (build):
                project.update({'last_build': build.get_number()})
                project.update({'status': build.get_status()})

                previousBuild = job.get_build(build.get_number() - 1)
                project.update(
                    {'previousBuildStatus': previousBuild.get_status()})

                if (build.is_running()):
                    project.update({'status': 'BUILDING'})

                    estimated = build._data['estimatedDuration']
                    completed = (time.time() * 1000) - build._data['timestamp']
                    completeRate = (completed * 100) / estimated
                    if (completeRate > 99):
                        completeRate = 99
                    project.update({'completeRate': completeRate})

                # who broke the build
                if (build.get_actions()["causes"][0].has_key("userId")):
                    project.update(
                        {'user': build.get_actions()["causes"][0]["userId"]})
            else:
                project.update({'last_build': None})
            jobs.append(project)

        return jobs
Пример #3
0
 def views(self):
     return Views(self)