tailscale / github-action

A GitHub Action to connect your workflow to your Tailscale network.
BSD 3-Clause "New" or "Revised" License
519 stars 78 forks source link

sorry, you must have a tty to run sudo error when installing tailscale #94

Closed aubreyyan closed 8 months ago

aubreyyan commented 8 months ago
Run if [ X64 = "ARM64" ]; then
  if [ X64 = "ARM64" ]; then
    TS_ARCH="arm64"
  elif [ X64 = "ARM" ]; then
    TS_ARCH="arm"
  elif [ X64 = "..." ]; then
    TS_ARCH="386"
  elif [ X64 = "X64" ]; then
    TS_ARCH="amd64"
  else
    TS_ARCH="amd64"
  fi
  MINOR=$(echo "$VERSION" | awk -F '.' {'print $2'})
  if [ $((MINOR % 2)) -eq 0 ]; then
    URL="https://pkgs.tailscale.com/stable/tailscale_${VERSION}_${TS_ARCH}.tgz"
  else
    URL="https://pkgs.tailscale.com/unstable/tailscale_${VERSION}_${TS_ARCH}.tgz"
  fi
  if ! [[ "$SHA256SUM" ]] ; then
    SHA256SUM="$(curl -H user-agent:tailscale-github-action -L "${URL}.sha256")"
  fi
  curl -H user-agent:tailscale-github-action -L "$URL" -o tailscale.tgz --max-time 300
  echo "$SHA256SUM  tailscale.tgz" | sha256sum -c
  tar -C /tmp -xzf tailscale.tgz
  rm tailscale.tgz
  TSPATH=/tmp/tailscale_${VERSION}_${TS_ARCH}
  sudo mv "${TSPATH}/tailscale" "${TSPATH}/tailscaled" /usr/bin
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    VERSION: 1.42.0
    SHA256SUM: 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[10](...2:11)0    64  100    64    0     0    3[18](...:2:19)      0 --:--:-- --:--:-- --:--:--   318
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    81  100    81    0     0    455      0 --:--:-- --:--:-- --:--:--   452

100 [22](...:2:23).5M  100 22.5M    0     0  [37](...:2:38).7M      0 --:--:-- --:--:-- --:--:-- 37.7M
tailscale.tgz: OK
sudo: sorry, you must have a tty to run sudo
Error: Process completed with exit code 1.

any idea what could be causing this?

DentonGentry commented 8 months ago

Are these GitHub runners or self-hosted? Using ubuntu-latest or something else?

aubreyyan commented 8 months ago

Oh this is self hosted. So we would need to follow something like https://unix.stackexchange.com/questions/376076/how-to-use-ssh-to-run-a-shell-script-on-a-remote-machine on said runner?

that fixed it thanks