Skip to content

Commit

Permalink
Expose host.docker.internal correctly in GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Jan 15, 2024
1 parent 94693f3 commit 3797c10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ jobs:
COMPLEMENT_SHARE_ENV_PREFIX: PASS_
PASS_SYNAPSE_COMPLEMENT_DATABASE: sqlite
DOCKER_BUILDKIT: 1
- run: |
docker ps | grep mitm | grep -Eo '[^ ]*$' | xargs docker logs
name: Debugging
- name: Upload logs
uses: actions/upload-artifact@v2
Expand Down
11 changes: 11 additions & 0 deletions internal/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync"
"testing"
"time"

"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"
"github.com/matrix-org/complement"
"github.com/matrix-org/complement/must"
Expand Down Expand Up @@ -167,6 +169,15 @@ func RunNewDeployment(t *testing.T, shouldTCPDump bool) *SlidingSyncDeployment {
Mounts: testcontainers.Mounts(
testcontainers.BindMount(filepath.Join(workingDir, "addons"), "/addons"),
),
HostConfigModifier: func(hc *container.HostConfig) {
if runtime.GOOS == "linux" { // Specifically useful for GHA
// Ensure that the container can contact the host, so they can
// interact with a complement-controlled test server.
// Note: this feature of docker landed in Docker 20.10,
// see https://github.com/moby/moby/pull/40007
hc.ExtraHosts = []string{"host.docker.internal:host-gateway"}
}
},
},
Started: true,
})
Expand Down

0 comments on commit 3797c10

Please sign in to comment.