Beispiel #1
0
 def _copy_cloned_upstream_dir(self):
     """
     Copy cloned upstream directory stored in self.upstream_cloned_dir
     into upstream synced directory stored in self.upstream_synced_dir
     """
     self.upstream_synced_dir = self.timestamp_dir / Git.get_reponame_from_git_url(
         self.msg_upstream_url)
     if os.path.isdir(self.upstream_synced_dir):
         shutil.rmtree(self.upstream_synced_dir)
     shutil.copytree(str(self.upstream_cloned_dir),
                     str(self.upstream_synced_dir),
                     symlinks=True)
Beispiel #2
0
 def github_api(self):
     """
     Init GitHubAPI for working with GitHub PRs
     :return:
     """
     if not self._github_api:
         self._github_api = GitHubAPI(
             self.image,
             self.headers,
             Git.get_reponame_from_git_url(self.msg_upstream_url),
             Git.get_username_from_git_url(self.msg_upstream_url),
             self.config_json,
         )
     return self._github_api
Beispiel #3
0
    def deploy_image(self, image_url):

        # Sources are generated in another OpenShift POD
        self.debug("Starting OpenShift POD")
        from betka.openshift import OpenshiftDeployer

        self._copy_cloned_downstream_dir()
        di = OpenshiftDeployer(
            Git.get_reponame_from_git_url(self.msg_upstream_url),
            self.image,
            str(self.timestamp_dir),
            image_url,
            self.betka_config["project"],
        )
        result = di.deploy_image()
        results_dir = "results"
        list_dir_content(self.timestamp_dir / results_dir)
        if not result:
            return False

        copy_upstream2downstream(self.timestamp_dir / results_dir,
                                 self.downstream_dir)
        return True