# Run the ssh integration tests in various Docker containers and on macOS. # These tests can also be run locally via `make sshintegrationtest`. name: "ssh-integrationtest" concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true on: workflow_dispatch: pull_request: paths: - "ssh/**" # gliderssh and x/crypto/ssh bumps. - "go.mod" - "go.sum" - "Makefile" - ".github/workflows/ssh-integrationtest.yml" schedule: # Changes outside ssh/** (ipn/ipnlocal, util/osuser, envknob, # cmd/tailscaled) can break Tailscale SSH without triggering the # pull_request paths above, so also run on main daily around # midnight UK time (cron is UTC; 00:13 GMT, 01:13 BST), so results # are ready the next morning. Off the hour to avoid GitHub's :00 # cron backlog. - cron: "13 0 * * *" jobs: ssh-integrationtest: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - base: "ubuntu:focal" tag: "ssh-ubuntu-focal" - base: "ubuntu:jammy" tag: "ssh-ubuntu-jammy" - base: "ubuntu:noble" tag: "ssh-ubuntu-noble" - base: "alpine:latest" tag: "ssh-alpine-latest" steps: - name: Check out code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Build test binaries run: | GOOS=linux GOARCH=amd64 CGO_ENABLED=0 ./tool/go test -tags integrationtest -c ./ssh/tailssh -o ssh/tailssh/testcontainers/tailssh.test GOOS=linux GOARCH=amd64 CGO_ENABLED=0 ./tool/go build -o ssh/tailssh/testcontainers/tailscaled ./cmd/tailscaled - name: Run SSH integration tests (${{ matrix.base }}) run: | docker build --build-arg="BASE=${{ matrix.base }}" -t "${{ matrix.tag }}" ssh/tailssh/testcontainers ssh-integrationtest-macos: runs-on: macos-latest steps: - name: Check out code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Build test binaries run: | ./tool/go test -tags integrationtest -c ./ssh/tailssh -o /tmp/tailssh.test ./tool/go build -o /tmp/tailscaled ./cmd/tailscaled - name: Set up test user and Paramiko run: | sudo dseditgroup -o create groupone sudo dseditgroup -o create grouptwo # The Linux containers also give testuser /bin/sh. zsh, the macOS # default, turns ECHO back on for the commands it runs, which # TestIntegrationPTYTerminalModes notices. sudo sysadminctl -addUser testuser -password "$(uuidgen)" -shell /bin/sh sudo dseditgroup -o edit -a testuser -t user groupone sudo dseditgroup -o edit -a testuser -t user grouptwo sudo createhomedir -c -u testuser sudo -H python3 -m pip install paramiko==3.5.1 || sudo -H python3 -m pip install --break-system-packages paramiko==3.5.1 - name: Run SSH integration tests as root working-directory: /tmp run: | eval $(ssh-agent -s) sudo --preserve-env=SSH_AUTH_SOCK TAILSCALED_PATH=/tmp/tailscaled ./tailssh.test -test.v \ -test.run 'TestSSHAgentForwarding|TestIntegration|TestOpenSSHExitCodes|TestLocalUnixForwardingHalfClose' - name: Run SSH integration tests as testuser working-directory: /tmp run: | sudo touch /tmp/tailscalessh.log sudo chown testuser /tmp/tailscalessh.log sudo -u testuser env TAILSCALED_PATH=/tmp/tailscaled sh -c 'eval $(ssh-agent -s) && ./tailssh.test -test.v \ -test.run "TestSSHAgentForwarding|TestIntegration|TestOpenSSHExitCodes|TestLocalUnixForwardingHalfClose|TestDoDropPrivileges"'