Apache DataFusion SQL Query Engine
ARROW-3572: [Crossbow] Raise more helpful exception if Crossbow queue has an SSH origin URL
Wes McKinney4e3c19b1e11d
diff --git a/dev/tasks/crossbow.py b/dev/tasks/crossbow.pyindex b58ae9de96..f7518d0f0d 100755--- a/dev/tasks/crossbow.py+++ b/dev/tasks/crossbow.py@@ -232,12 +232,17 @@ class Repo:A high level wrapper used for both reading revision information fromarrow's repository and pushing continuous integration tasks to the queuerepository.- """- def __init__(self, path, github_token=None):+ Parameters+ ----------+ require_https : boolean, default False+ Raise exception for SSH origin URLs+ """+ def __init__(self, path, github_token=None, require_https=False):self.path = Path(path)self.repo = pygit2.Repository(str(self.path))self.github_token = github_token+ self.require_https = require_httpsself._updated_refs = []def __str__(self):@@ -253,7 +258,11 @@ class Repo:@propertydef origin(self):- return self.repo.remotes['origin']+ remote = self.repo.remotes['origin']+ if self.require_https and remote.url.startswith('[email protected]'):+ raise ValueError("Change SSH origin URL to HTTPS to use "+ "Crossbow: {}".format(remote.url))+ return remotedef fetch(self):refspec = '+refs/heads/*:refs/remotes/origin/*'@@ -297,8 +306,7 @@ class Repo:If an SSH github url is set, it will be replaced by the httpsequivalent usable with Github OAuth token."""- return self.remote.url.replace('[email protected]:',- 'https://github.com/')+ return _git_ssh_to_https(self.remote.url)@propertydef user_name(self):@@ -385,6 +393,10 @@ class Repo:return gh.repository(username, reponame)+def _git_ssh_to_https(url):+ return url.replace('[email protected]:', 'https://github.com/')++class Queue(Repo):def _next_job_id(self, prefix):@@ -631,8 +643,9 @@ def crossbow(ctx, github_token, arrow_path, queue_path):'valid GitHub access token or pass one to --github-token.')- ctx.obj['arrow'] = Repo(Path(arrow_path))- ctx.obj['queue'] = Queue(Path(queue_path), github_token=github_token)+ ctx.obj['arrow'] = Repo(arrow_path)+ ctx.obj['queue'] = Queue(queue_path, github_token=github_token,+ require_https=True)@crossbow.command()