From 6646f3aec1d0c420ce8b3fd6e4116d3f71bb43c1 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Tue, 10 Sep 2019 10:12:45 +0100
Subject: [PATCH] CI: Work on both mac and linux docker hosts

---
 .ci/setup_ssh.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/.ci/setup_ssh.sh b/.ci/setup_ssh.sh
index 40c0c5c1e..9c07270b1 100644
--- a/.ci/setup_ssh.sh
+++ b/.ci/setup_ssh.sh
@@ -21,6 +21,22 @@ set -e
 
 if [[ -f /.dockerenv ]]; then
 
+ # We have to use different host names to connect
+ # to the docker daemon host on mac as opposed
+ # to on linux.
+ #
+ # On linux (assuming the docker job is running
+ # with --net=host), we can connect via
+ # username@localhost.
+ #
+ # On mac, we have to connect via
+ # username@host.docker.internal
+ if [[ "$CI_RUNNER_TAGS" == *"macOS"* ]]; then
+  if [[ "$FSL_HOST" == *"@localhost" ]]; then
+   FSL_HOST=${FSL_HOST/localhost/host.docker.internal}
+  fi
+ fi
+
  apt-get update -y                           || yum -y check-update                     || true;
  apt-get install -y openssh-client rsync git || yum install -y openssh-client rsync git || true;
 
-- 
GitLab