Beispiel #1
0
 def get_job_info_by_name(self, job_name):
     """
     Get the json snip for a job by name
     :param job_name: string of the job name
     :return: the json object for that job or None if not found
     """
     job_info_url = "{0}/{1}".format(self.base_server_url, JSON_API_SUFFIX)
     r = request_helper.get_json(job_info_url)
     job_rel_info = next((job for job in r.get('jobs') if job.get('name') == job_name), None)
     logging.debug(job_rel_info)
     return request_helper.get_json("{}/{}".format(job_rel_info.get('url'), JSON_API_SUFFIX))
Beispiel #2
0
 def get_views(self):
     """
     Get all the jobs from the Jenkins server
     :return: a list of job names on the jenkins server
     :returns list
     """
     jobs_url = "{0}/{1}".format(self.base_server_url, JSON_API_SUFFIX)
     r = request_helper.get_json(jobs_url)
     return [job.get('name') for job in r.get('views')]