WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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)