WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

jenkins.py 799B

123456789101112131415161718192021222324
  1. import jenkins
  2. from bs4 import BeautifulSoup
  3. from .service import Service
  4. class Jenkins(Service):
  5. SCM_CLASS = "hudson.plugins.git.GitSCM"
  6. def __init__(self, url, username, password):
  7. super().__init__("jenkins")
  8. self._server = jenkins.Jenkins(url, username=username, password=password)
  9. def get_jobs(self):
  10. for job in self._server.get_all_jobs():
  11. name = job["fullname"]
  12. config = BeautifulSoup(self._server.get_job_config(name), features="xml")
  13. for git_config in config.find_all("scm", class_=self.SCM_CLASS):
  14. branch_spec = git_config.find("branches").find("name").text
  15. yield name, branch_spec, git_config.find("url").text
  16. def build_job(self, name):
  17. self._server.build_job(name)