You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:39:26 UTC

[buildstream] branch abderrahim/resolve-remotes created (now 2330501)

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

root pushed a change to branch abderrahim/resolve-remotes
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 2330501  _sandboxremote: resolve hostname before sending to grpc

This branch includes the following new commits:

     new c7c38d7  _remote: resolve hostname before sending to grpc
     new 2330501  _sandboxremote: resolve hostname before sending to grpc

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/02: _remote: resolve hostname before sending to grpc

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch abderrahim/resolve-remotes
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c7c38d73fd8e433eb61b602f826282ec41e78bf6
Author: Abderrahim Kitouni <ak...@gnome.org>
AuthorDate: Sun Mar 22 11:24:19 2020 +0100

    _remote: resolve hostname before sending to grpc
    
    grpc uses ares to resolve hostnames, which doesn't support all the nss modules
    the user may have configured
---
 src/buildstream/_remote.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/_remote.py b/src/buildstream/_remote.py
index d01b13b..02686b9 100644
--- a/src/buildstream/_remote.py
+++ b/src/buildstream/_remote.py
@@ -17,6 +17,7 @@
 
 import os
 from collections import namedtuple
+from socket import gethostbyname
 from urllib.parse import urlparse
 
 import grpc
@@ -157,9 +158,11 @@ class BaseRemote:
 
         # Set up the communcation channel
         url = urlparse(self.spec.url)
+        host = gethostbyname(url.hostname)
+
         if url.scheme == "http":
             port = url.port or 80
-            self.channel = grpc.insecure_channel("{}:{}".format(url.hostname, port))
+            self.channel = grpc.insecure_channel("{}:{}".format(host, port))
         elif url.scheme == "https":
             port = url.port or 443
             try:
@@ -174,7 +177,7 @@ class BaseRemote:
             credentials = grpc.ssl_channel_credentials(
                 root_certificates=self.server_cert, private_key=self.client_key, certificate_chain=self.client_cert
             )
-            self.channel = grpc.secure_channel("{}:{}".format(url.hostname, port), credentials)
+            self.channel = grpc.secure_channel("{}:{}".format(host, port), credentials)
         else:
             raise RemoteError("Unsupported URL: {}".format(self.spec.url))
 


[buildstream] 02/02: _sandboxremote: resolve hostname before sending to grpc

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch abderrahim/resolve-remotes
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 2330501ba3b81e86d4a77173542659ae8f82e25d
Author: Abderrahim Kitouni <ak...@gnome.org>
AuthorDate: Sun Mar 22 11:31:39 2020 +0100

    _sandboxremote: resolve hostname before sending to grpc
---
 src/buildstream/sandbox/_sandboxremote.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/buildstream/sandbox/_sandboxremote.py b/src/buildstream/sandbox/_sandboxremote.py
index 3dcbb2c..f98c934 100644
--- a/src/buildstream/sandbox/_sandboxremote.py
+++ b/src/buildstream/sandbox/_sandboxremote.py
@@ -22,6 +22,7 @@ import os
 import shutil
 from collections import namedtuple
 from urllib.parse import urlparse
+from socket import gethostbyname
 from functools import partial
 
 import grpc
@@ -353,10 +354,13 @@ class SandboxRemote(SandboxREAPI):
                     "You must supply a protocol and port number in the execution-service url, "
                     "for example: http://buildservice:50051."
                 )
+
+            host = gethostbyname(url.hostname)
+
             if url.scheme == "http":
-                channel = grpc.insecure_channel("{}:{}".format(url.hostname, url.port))
+                channel = grpc.insecure_channel("{}:{}".format(host, url.port))
             elif url.scheme == "https":
-                channel = grpc.secure_channel("{}:{}".format(url.hostname, url.port), self.exec_credentials)
+                channel = grpc.secure_channel("{}:{}".format(host, url.port), self.exec_credentials)
             else:
                 raise SandboxError(
                     "Remote execution currently only supports the 'http' protocol "
@@ -410,10 +414,13 @@ class SandboxRemote(SandboxREAPI):
                 "You must supply a protocol and port number in the action-cache-service url, "
                 "for example: http://buildservice:50051."
             )
+
+        host = gethostbyname(url.hostname)
+
         if url.scheme == "http":
-            channel = grpc.insecure_channel("{}:{}".format(url.hostname, url.port))
+            channel = grpc.insecure_channel("{}:{}".format(host, url.port))
         elif url.scheme == "https":
-            channel = grpc.secure_channel("{}:{}".format(url.hostname, url.port), self.action_credentials)
+            channel = grpc.secure_channel("{}:{}".format(host, url.port), self.action_credentials)
 
         with channel:
             request = remote_execution_pb2.GetActionResultRequest(