You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/06/24 02:05:19 UTC

[arrow] branch master updated: ARROW-3572: [Crossbow] Raise more helpful exception if Crossbow queue has an SSH origin URL

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new ba4e0f3  ARROW-3572: [Crossbow] Raise more helpful exception if Crossbow queue has an SSH origin URL
ba4e0f3 is described below

commit ba4e0f3f1f0ce8fd846cc6fadf70ad4383809c4a
Author: Wes McKinney <we...@apache.org>
AuthorDate: Sun Jun 23 21:05:11 2019 -0500

    ARROW-3572: [Crossbow] Raise more helpful exception if Crossbow queue has an SSH origin URL
    
    Author: Wes McKinney <we...@apache.org>
    
    Closes #4666 from wesm/ARROW-3572 and squashes the following commits:
    
    867a1561e <Wes McKinney> Raise more helpful exception if Crossbow queue has an SSH origin URL
---
 dev/tasks/crossbow.py | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/dev/tasks/crossbow.py b/dev/tasks/crossbow.py
index b58ae9d..f7518d0 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 from
     arrow's repository and pushing continuous integration tasks to the queue
     repository.
-    """
 
-    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_https
         self._updated_refs = []
 
     def __str__(self):
@@ -253,7 +258,11 @@ class Repo:
 
     @property
     def origin(self):
-        return self.repo.remotes['origin']
+        remote = self.repo.remotes['origin']
+        if self.require_https and remote.url.startswith('git@github.com'):
+            raise ValueError("Change SSH origin URL to HTTPS to use "
+                             "Crossbow: {}".format(remote.url))
+        return remote
 
     def 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 https
         equivalent usable with Github OAuth token.
         """
-        return self.remote.url.replace('git@github.com:',
-                                       'https://github.com/')
+        return _git_ssh_to_https(self.remote.url)
 
     @property
     def user_name(self):
@@ -385,6 +393,10 @@ class Repo:
         return gh.repository(username, reponame)
 
 
+def _git_ssh_to_https(url):
+    return url.replace('git@github.com:', '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()