github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Cannot run action on Act

Open PierreSnell opened this issue 1 year ago • 3 comments

I would like to use act: https://github.com/nektos/act to test my actions.

However, at the tailscale step I got : failed to connect to local tailscaled; it doesn't appear to be running (sudo systemctl start tailscaled ?)

It should no matter but on the machine running act I also have tailscale configured and running.

Here is the github flow :

name: Pull request
on:
    pull_request:
      types: [opened, synchronize, reopened, ready_for_review]
      branches:
        - main

jobs:
  preview-deployment:
    if: github.event.pull_request.draft == false
    name: preview-deployment
    runs-on: ubuntu-latest
    steps:
    - name: Checkout 
      uses: actions/checkout@v4

    - name: Setup Node
      uses: actions/setup-node@v4
      with:
        node-version-file: package.json

    - name: Install Dependencies
      run: npm install

    - name: Tailscale
      uses: tailscale/github-action@main
      with:
        oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
        oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
        tags: tag:MySuperTag

    - uses: pulumi/actions@v5
      with:
        command: preview
        stack-name: dev
      env:
        PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}

Thanks in advance ! :) Have a great day

PierreSnell avatar Apr 24 '24 18:04 PierreSnell

I'm also experiencing this but not on ACT, on action runner on kubernetes self hosted.

omri-shilton avatar Jul 29 '24 09:07 omri-shilton

Same problem

screenshot_2024-08-28_21 23 56@2x

AMD-NICK avatar Aug 28 '24 18:08 AMD-NICK

A workaround I found that allows me to run Tailscale using nektos/act is the following:

  1. Add nohup to the tailscaled startup; this prevents the daemon from exiting, which I'm guessing happens if systemctl is not available; See https://github.com/Pikachews/tailscale-action/commit/72b6eb8850d8a3fa0c7ed8ca897b5aa877ba7bfe
  2. Enable userspace networking, because /dev/net/tun is not present on some(?) containers; see https://tailscale.com/kb/1112/userspace-networking. See https://github.com/Pikachews/tailscale-action/commit/83244b4e48caeeb6d6346e50b794a11f7e920fc9
  3. Use either the MagicDNS domain (e.g. machine-name.tailnet-name.ts.net) or the machine's Tailscale IP to connect to the machine, because /etc/resolve.conf won't be updated to be able to resolve the machine name.

This allowed me to successfully connect to other machines on the tailnet.

I've incorporated 1 and 2 into https://github.com/Pikachews/tailscale-action so that it is a drop-in replacement for this action.

Pikachews avatar Jan 05 '25 02:01 Pikachews