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

sha256sum: WARNING: 1 computed checksum did NOT match #97

Closed lukehsiao closed 8 months ago

lukehsiao commented 8 months ago

We are seeing many failures in GitHub-hosted runners that use Tailscale.

if [ X64 = "ARM64" ]; then
    TS_ARCH="arm64"
  elif [ X64 = "ARM" ]; then
    TS_ARCH="arm"
  elif [ X64 = "X86" ]; 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 "Expected sha256: $SHA256SUM"
  echo "Actual sha256: $(sha256sum tailscale.tgz)"
  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.52.0
    SHA256SUM: 
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/c6e5af21-4b7d-487a-95b4-3488255beb1f.sh
  % 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    64  100    64    0     0    263      0 --:--:-- --:--:-- --:--:--   263
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    81  100    81    0     0    405      0 --:--:-- --:--:-- --:--:--   407

 89 24.1M   89 21.6M    0     0  25.3M      0 --:--:-- --:--:-- --:--:-- 25.3M
100 24.1M  100 24.1M    0     0  27.2M      0 --:--:-- --:--:-- --:--:-- 73.2M
Expected sha256: d6dc6759edfb36a34c564ca409f91032a7ae049b212b6dcbdba8599566e2bd19
Actual sha256: 42[262](https://github.com/NumbersStationAI/mlcore/actions/runs/6722722735/job/18271279084#step:2:263)6d767aeb3a9dfccbfd432f24d2f74317faa3947c07c87d413c8dded4d9a  tailscale.tgz
sha256sum: WARNING: 1 computed checksum did NOT match
tailscale.tgz: FAILED
Error: Process completed with exit code 1.

since updating our tailscale action to use v1.52.0 yesterday.

      - name: Tailscale
        uses: tailscale/github-action@main
        with:
          oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
          oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
          version: "1.52.0"

I cannot reproduce this locally

❯ curl -H user-agent:tailscale-github-action -L 'https://pkgs.tailscale.com/stable/tailscale_1.52.0_amd64.tgz' --max-time 300 | sha256sum
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    81  100    81    0     0    287      0 --:--:-- --:--:-- --:--:--   287
100 24.1M  100 24.1M    0     0  45.0M      0 --:--:-- --:--:-- --:--:-- 45.0M
d6dc6759edfb36a34c564ca409f91032a7ae049b212b6dcbdba8599566e2bd19  -

Seems related to #88

Occasionally, after several re-runs, things will work.

bradfitz commented 8 months ago

@lukehsiao, what size is the wrong file? Is it truncated?

bradfitz commented 8 months ago

/cc @creachadair @danderson

lukehsiao commented 8 months ago

@lukehsiao, what size is the wrong file? Is it truncated?

Apologies, should've included in the original issue. Updated the snippet to show the curl output. Does that answer your question?

bradfitz commented 8 months ago

"24.1M" is rounded a fair bit. How many bytes is it?

lukehsiao commented 8 months ago

"24.1M" is rounded a fair bit. How many bytes is it?

I'm afraid I don't know how to answer that from the log for the failing download, as I can't reproduce that locally.

If you wanted to make a tweak to the action, happy to run it at a specific hash that provides more useful debugging output.

Or, if you know of a way to get the information you want from the logs of the action, happy to follow instructions.

DentonGentry commented 8 months ago

I think we've identified the state the CDN had gotten itself into, and cleared it. It should repopulate its cache and all nodes return the same SHA256. Let us know if there is still a problem.

lukehsiao commented 8 months ago

I think we've identified the state the CDN had gotten itself into, and cleared it. It should repopulate its cache and all nodes return the same SHA256. Let us know if there is still a problem.

This does appear to be working consistently now. I believe we can close this issue.